From c5d3bb9d8e5b3df4d17f337049097b4a764cd251 Mon Sep 17 00:00:00 2001 From: Adrien Brault Date: Tue, 9 Jan 2024 10:49:12 +0100 Subject: [PATCH 1/8] feat: update openai-openapi --- .jane-openapi | 4 ++-- Makefile | 6 +----- build/ModelWithConstructorGenerator.php | 3 +++ openai-openapi | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.jane-openapi b/.jane-openapi index 68a1d00..4cf8765 100644 --- a/.jane-openapi +++ b/.jane-openapi @@ -1,7 +1,7 @@ __DIR__ . '/var/openapi-no-deprecated.yaml', + 'openapi-file' => __DIR__ . '/openai-openapi/openapi.yaml', 'namespace' => 'Sourceability\OpenAIClient\Generated', 'directory' => __DIR__ . '/generated', -]; \ No newline at end of file +]; diff --git a/Makefile b/Makefile index 526d53a..f083551 100644 --- a/Makefile +++ b/Makefile @@ -3,10 +3,6 @@ SHELL = /bin/bash openai-openapi: git clone git@github.com:openai/openai-openapi.git -var/openapi-no-deprecated.yaml: - mkdir -p ./var - yq eval 'del(.paths | .. | select(has("deprecated") and .deprecated == true))' ./openai-openapi/openapi.yaml > $@ - generated: openai-openapi vendor/bin/jane-openapi generate @@ -39,5 +35,5 @@ pre-commit: $(MAKE) -k rector cs phpunit .PHONY: build -build: var/openapi-no-deprecated.yaml +build: time (time bin/jane generate ; for in in {1..4} ; do time (vendor/bin/rector process ; vendor/bin/ecs --fix); done) diff --git a/build/ModelWithConstructorGenerator.php b/build/ModelWithConstructorGenerator.php index e4cf2a1..7e5d317 100644 --- a/build/ModelWithConstructorGenerator.php +++ b/build/ModelWithConstructorGenerator.php @@ -47,6 +47,9 @@ protected function doCreateModel(BaseClassGuess $class, array $properties, array protected function createConstructorArgumentDoc(Property $property): string { $docTypeHint = $property->getType()->getDocTypeHint(''); + if ($docTypeHint instanceof Name) { + $docTypeHint = $docTypeHint->toString(); + } if ($property->isNullable() && ! str_contains($docTypeHint, 'null')) { $docTypeHint .= '|null'; } diff --git a/openai-openapi b/openai-openapi index 6c5d357..3d9e0ae 160000 --- a/openai-openapi +++ b/openai-openapi @@ -1 +1 @@ -Subproject commit 6c5d35708876915233f9a5632942c171b2dbfe8d +Subproject commit 3d9e0aeb21ec75aa616aa4c17ea54c369e344cd0 From b5221f2cc9377693d5175a4d17023549cd2bc149 Mon Sep 17 00:00:00 2001 From: Adrien Brault Date: Tue, 9 Jan 2024 11:10:08 +0100 Subject: [PATCH 2/8] chore: update rector --- composer.json | 8 ++++---- ecs.php | 3 ++- rector.php | 3 --- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 41b4ce9..294d6d8 100644 --- a/composer.json +++ b/composer.json @@ -28,10 +28,10 @@ "guzzlehttp/psr7": "^2.4", "guzzlehttp/guzzle": "^7.5", "php-http/guzzle7-adapter": "^1.0", - "jane-php/open-api-3": "^7.4", - "rector/rector": "^0.15.16", - "symplify/easy-coding-standard": "^11.2", - "slevomat/coding-standard": "^8.8", + "jane-php/open-api-3": "^7.5", + "rector/rector": "^0.19.0", + "symplify/easy-coding-standard": "^12.1", + "slevomat/coding-standard": "^8.14", "php-http/logger-plugin": "^1.3", "phpunit/phpunit": "^10.0" }, diff --git a/ecs.php b/ecs.php index 0e6c1f8..ebe311e 100644 --- a/ecs.php +++ b/ecs.php @@ -22,9 +22,10 @@ SetList::DOCBLOCK, SetList::NAMESPACES, SetList::SPACES, + SetList::STRICT, ]); $ecsConfig->ruleWithConfiguration(ArraySyntaxFixer::class, [ 'syntax' => 'short', ]); -}; \ No newline at end of file +}; diff --git a/rector.php b/rector.php index 590b27f..d378e01 100644 --- a/rector.php +++ b/rector.php @@ -31,14 +31,11 @@ $rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class); $rectorConfig->rule(AddMethodCallBasedStrictParamTypeRector::class); $rectorConfig->rule(AddParamTypeFromPropertyTypeRector::class); - $rectorConfig->rule(ArrayShapeFromConstantArrayReturnRector::class); $rectorConfig->rule(ParamTypeByMethodCallTypeRector::class); - $rectorConfig->rule(ParamTypeFromStrictTypedPropertyRector::class); $rectorConfig->rule(PropertyTypeFromStrictSetterGetterRector::class); $rectorConfig->rule(ReturnTypeFromReturnDirectArrayRector::class); $rectorConfig->rule(ReturnTypeFromReturnNewRector::class); $rectorConfig->rule(TypedPropertyFromStrictConstructorRector::class); - $rectorConfig->rule(TypedPropertyFromStrictGetterMethodReturnTypeRector::class); $rectorConfig->ruleWithConfiguration(TypedPropertyFromAssignsRector::class, [ TypedPropertyFromAssignsRector::INLINE_PUBLIC => true, ]); From 737acd36fa5c4033bbc3d524d0e35acc14cfdce1 Mon Sep 17 00:00:00 2001 From: Adrien Brault Date: Tue, 9 Jan 2024 11:15:52 +0100 Subject: [PATCH 3/8] chore: update generated --- .../ApiKeyAuthAuthentication.php | 30 + generated/Client.php | 495 +++++++++++++++- generated/Endpoint/CancelFineTune.php | 5 +- generated/Endpoint/CancelFineTuningJob.php | 64 ++ generated/Endpoint/CancelRun.php | 66 +++ generated/Endpoint/CreateAssistant.php | 67 +++ generated/Endpoint/CreateAssistantFile.php | 72 +++ generated/Endpoint/CreateChatCompletion.php | 5 +- generated/Endpoint/CreateCompletion.php | 5 +- generated/Endpoint/CreateEdit.php | 5 +- generated/Endpoint/CreateEmbedding.php | 5 +- generated/Endpoint/CreateFile.php | 7 +- generated/Endpoint/CreateFineTune.php | 5 +- generated/Endpoint/CreateFineTuningJob.php | 67 +++ generated/Endpoint/CreateImage.php | 5 +- generated/Endpoint/CreateImageEdit.php | 7 +- generated/Endpoint/CreateImageVariation.php | 7 +- generated/Endpoint/CreateMessage.php | 72 +++ generated/Endpoint/CreateModeration.php | 5 +- generated/Endpoint/CreateRun.php | 72 +++ generated/Endpoint/CreateSpeech.php | 62 ++ generated/Endpoint/CreateThread.php | 67 +++ generated/Endpoint/CreateThreadAndRun.php | 67 +++ generated/Endpoint/CreateTranscription.php | 7 +- generated/Endpoint/CreateTranslation.php | 7 +- generated/Endpoint/DeleteAssistant.php | 64 ++ generated/Endpoint/DeleteAssistantFile.php | 66 +++ generated/Endpoint/DeleteFile.php | 7 +- generated/Endpoint/DeleteModel.php | 5 +- generated/Endpoint/DeleteThread.php | 64 ++ generated/Endpoint/DownloadFile.php | 9 +- generated/Endpoint/GetAssistant.php | 64 ++ generated/Endpoint/GetAssistantFile.php | 66 +++ generated/Endpoint/GetMessage.php | 66 +++ generated/Endpoint/GetMessageFile.php | 68 +++ generated/Endpoint/GetRun.php | 66 +++ generated/Endpoint/GetRunStep.php | 68 +++ generated/Endpoint/GetThread.php | 64 ++ generated/Endpoint/ListAssistantFiles.php | 89 +++ generated/Endpoint/ListAssistants.php | 86 +++ generated/Endpoint/ListFiles.php | 26 +- generated/Endpoint/ListFineTuneEvents.php | 6 +- generated/Endpoint/ListFineTunes.php | 5 +- generated/Endpoint/ListFineTuningEvents.php | 84 +++ generated/Endpoint/ListMessageFiles.php | 91 +++ generated/Endpoint/ListMessages.php | 89 +++ generated/Endpoint/ListModels.php | 5 +- .../Endpoint/ListPaginatedFineTuningJobs.php | 81 +++ generated/Endpoint/ListRunSteps.php | 91 +++ generated/Endpoint/ListRuns.php | 89 +++ generated/Endpoint/ModifyAssistant.php | 72 +++ generated/Endpoint/ModifyMessage.php | 74 +++ generated/Endpoint/ModifyRun.php | 74 +++ generated/Endpoint/ModifyThread.php | 72 +++ generated/Endpoint/RetrieveFile.php | 7 +- generated/Endpoint/RetrieveFineTune.php | 5 +- generated/Endpoint/RetrieveFineTuningJob.php | 64 ++ generated/Endpoint/RetrieveModel.php | 5 +- generated/Endpoint/SubmitToolOuputsToRun.php | 74 +++ generated/Model/AssistantFileObject.php | 131 ++++ generated/Model/AssistantObject.php | 311 ++++++++++ generated/Model/AssistantToolsCode.php | 50 ++ generated/Model/AssistantToolsFunction.php | 68 +++ generated/Model/AssistantToolsRetrieval.php | 50 ++ .../ChatCompletionFunctionCallOption.php | 50 ++ generated/Model/ChatCompletionFunctions.php | 67 ++- .../Model/ChatCompletionMessageToolCall.php | 104 ++++ .../ChatCompletionMessageToolCallChunk.php | 113 ++++ ...CompletionMessageToolCallChunkFunction.php | 77 +++ ...ChatCompletionMessageToolCallFunction.php} | 2 +- .../Model/ChatCompletionNamedToolChoice.php | 68 +++ .../ChatCompletionNamedToolChoiceFunction.php | 50 ++ .../ChatCompletionRequestAssistantMessage.php | 170 ++++++ ...ionRequestAssistantMessageFunctionCall.php | 80 +++ .../ChatCompletionRequestFunctionMessage.php | 107 ++++ .../Model/ChatCompletionRequestMessage.php | 131 ---- ...mpletionRequestMessageContentPartImage.php | 68 +++ ...RequestMessageContentPartImageImageUrl.php | 77 +++ ...ompletionRequestMessageContentPartText.php | 77 +++ .../ChatCompletionRequestSystemMessage.php | 104 ++++ .../ChatCompletionRequestToolMessage.php | 104 ++++ .../ChatCompletionRequestUserMessage.php | 108 ++++ .../Model/ChatCompletionResponseMessage.php | 97 ++- ...tCompletionResponseMessageFunctionCall.php | 49 +- .../ChatCompletionStreamResponseDelta.php | 137 +++++ ...pletionStreamResponseDeltaFunctionCall.php | 80 +++ .../Model/ChatCompletionTokenLogprob.php | 143 +++++ ...tCompletionTokenLogprobTopLogprobsItem.php | 110 ++++ generated/Model/ChatCompletionTool.php | 68 +++ ...tResponseUsage.php => CompletionUsage.php} | 67 ++- generated/Model/CreateAnswerRequest.php | 557 ----------------- generated/Model/CreateAnswerResponse.php | 149 ----- ...ateAnswerResponseSelectedDocumentsItem.php | 59 -- .../Model/CreateAssistantFileRequest.php | 48 ++ generated/Model/CreateAssistantRequest.php | 232 ++++++++ .../CreateChatCompletionFunctionResponse.php | 225 +++++++ ...tCompletionFunctionResponseChoicesItem.php | 104 ++++ .../Model/CreateChatCompletionRequest.php | 560 +++++++++++++----- ...ateChatCompletionRequestResponseFormat.php | 50 ++ .../Model/CreateChatCompletionResponse.php | 143 ++++- ...reateChatCompletionResponseChoicesItem.php | 84 ++- ...tCompletionResponseChoicesItemLogprobs.php | 56 ++ .../CreateChatCompletionResponseUsage.php | 77 --- .../CreateChatCompletionStreamResponse.php | 195 ++++++ ...hatCompletionStreamResponseChoicesItem.php | 137 +++++ ...etionStreamResponseChoicesItemLogprobs.php | 56 ++ .../Model/CreateClassificationRequest.php | 447 -------------- .../Model/CreateClassificationResponse.php | 140 ----- ...sificationResponseSelectedExamplesItem.php | 77 --- generated/Model/CreateCompletionRequest.php | 439 ++++++++------ generated/Model/CreateCompletionResponse.php | 143 ++++- .../CreateCompletionResponseChoicesItem.php | 52 +- ...eCompletionResponseChoicesItemLogprobs.php | 74 +-- .../Model/CreateCompletionResponseUsage.php | 77 --- generated/Model/CreateEditRequest.php | 72 ++- generated/Model/CreateEditResponse.php | 94 ++- .../Model/CreateEditResponseChoicesItem.php | 90 +-- .../CreateEditResponseChoicesItemLogprobs.php | 131 ---- generated/Model/CreateEmbeddingRequest.php | 71 ++- generated/Model/CreateEmbeddingResponse.php | 81 ++- .../Model/CreateEmbeddingResponseUsage.php | 22 +- generated/Model/CreateFileRequest.php | 31 +- generated/Model/CreateFineTuneRequest.php | 391 ++++++------ .../CreateFineTuneRequestHyperparameters.php | 56 ++ .../Model/CreateFineTuningJobRequest.php | 192 ++++++ ...ateFineTuningJobRequestHyperparameters.php | 122 ++++ generated/Model/CreateImageEditRequest.php | 57 +- generated/Model/CreateImageRequest.php | 127 +++- .../Model/CreateImageVariationRequest.php | 79 ++- generated/Model/CreateMessageRequest.php | 141 +++++ generated/Model/CreateModerationRequest.php | 17 +- generated/Model/CreateModerationResponse.php | 32 +- .../CreateModerationResponseResultsItem.php | 33 +- ...oderationResponseResultsItemCategories.php | 187 +++++- ...ationResponseResultsItemCategoryScores.php | 187 +++++- generated/Model/CreateRunRequest.php | 195 ++++++ generated/Model/CreateSearchRequest.php | 207 ------- generated/Model/CreateSpeechRequest.php | 160 +++++ generated/Model/CreateThreadAndRunRequest.php | 186 ++++++ generated/Model/CreateThreadRequest.php | 87 +++ .../Model/CreateTranscriptionRequest.php | 84 +-- generated/Model/CreateTranslationRequest.php | 30 +- ...ne.php => DeleteAssistantFileResponse.php} | 54 +- ...taItem.php => DeleteAssistantResponse.php} | 56 +- generated/Model/DeleteMessageResponse.php | 77 +++ generated/Model/DeleteModelResponse.php | 34 +- generated/Model/DeleteThreadResponse.php | 77 +++ ...dingResponseDataItem.php => Embedding.php} | 70 ++- generated/Model/Error.php | 38 +- generated/Model/FineTune.php | 317 ++++++---- generated/Model/FineTuneEvent.php | 41 +- generated/Model/FineTuneHyperparams.php | 220 +++++++ generated/Model/FineTuningJob.php | 407 +++++++++++++ generated/Model/FineTuningJobError.php | 104 ++++ generated/Model/FineTuningJobEvent.php | 113 ++++ .../Model/FineTuningJobHyperparameters.php | 56 ++ generated/Model/FunctionObject.php | 114 ++++ generated/Model/Image.php | 104 ++++ generated/Model/ImagesResponse.php | 8 +- generated/Model/ImagesResponseDataItem.php | 59 -- .../Model/ListAssistantFilesResponse.php | 122 ++++ generated/Model/ListAssistantsResponse.php | 122 ++++ generated/Model/ListFilesResponse.php | 40 +- .../Model/ListFineTuneEventsResponse.php | 40 +- generated/Model/ListFineTunesResponse.php | 40 +- ...hp => ListFineTuningJobEventsResponse.php} | 46 +- generated/Model/ListMessageFilesResponse.php | 122 ++++ generated/Model/ListMessagesResponse.php | 122 ++++ generated/Model/ListModelsResponse.php | 2 +- ...> ListPaginatedFineTuningJobsResponse.php} | 72 +-- generated/Model/ListRunStepsResponse.php | 122 ++++ generated/Model/ListRunsResponse.php | 122 ++++ generated/Model/ListThreadsResponse.php | 122 ++++ .../Model/MessageContentImageFileObject.php | 68 +++ ...MessageContentImageFileObjectImageFile.php | 50 ++ ...ntentTextAnnotationsFileCitationObject.php | 131 ++++ ...otationsFileCitationObjectFileCitation.php | 77 +++ ...geContentTextAnnotationsFilePathObject.php | 131 ++++ ...tTextAnnotationsFilePathObjectFilePath.php | 50 ++ generated/Model/MessageContentTextObject.php | 68 +++ .../Model/MessageContentTextObjectText.php | 77 +++ generated/Model/MessageFileObject.php | 131 ++++ generated/Model/MessageObject.php | 311 ++++++++++ generated/Model/Model.php | 76 ++- generated/Model/ModifyAssistantRequest.php | 232 ++++++++ generated/Model/ModifyMessageRequest.php | 54 ++ generated/Model/ModifyRunRequest.php | 54 ++ generated/Model/ModifyThreadRequest.php | 54 ++ generated/Model/OpenAIFile.php | 139 ++++- generated/Model/RunObject.php | 527 ++++++++++++++++ generated/Model/RunObjectLastError.php | 77 +++ generated/Model/RunObjectRequiredAction.php | 77 +++ ...nObjectRequiredActionSubmitToolOutputs.php | 56 ++ .../RunStepDetailsMessageCreationObject.php | 68 +++ ...lsMessageCreationObjectMessageCreation.php | 50 ++ .../RunStepDetailsToolCallsCodeObject.php | 104 ++++ ...ailsToolCallsCodeObjectCodeInterpreter.php | 83 +++ ...pDetailsToolCallsCodeOutputImageObject.php | 68 +++ ...ilsToolCallsCodeOutputImageObjectImage.php | 50 ++ ...epDetailsToolCallsCodeOutputLogsObject.php | 77 +++ .../RunStepDetailsToolCallsFunctionObject.php | 104 ++++ ...DetailsToolCallsFunctionObjectFunction.php | 104 ++++ .../Model/RunStepDetailsToolCallsObject.php | 83 +++ ...RunStepDetailsToolCallsRetrievalObject.php | 110 ++++ generated/Model/RunStepObject.php | 440 ++++++++++++++ generated/Model/RunStepObjectLastError.php | 77 +++ generated/Model/RunToolCallObject.php | 104 ++++ generated/Model/RunToolCallObjectFunction.php | 77 +++ .../Model/SubmitToolOutputsRunRequest.php | 54 ++ ...itToolOutputsRunRequestToolOutputsItem.php | 77 +++ generated/Model/ThreadObject.php | 137 +++++ ....php => AssistantFileObjectNormalizer.php} | 53 +- .../Normalizer/AssistantObjectNormalizer.php | 161 +++++ .../AssistantToolsCodeNormalizer.php | 84 +++ ...p => AssistantToolsFunctionNormalizer.php} | 43 +- .../AssistantToolsRetrievalNormalizer.php | 84 +++ ...CompletionFunctionCallOptionNormalizer.php | 84 +++ .../ChatCompletionFunctionsNormalizer.php | 21 +- ...essageToolCallChunkFunctionNormalizer.php} | 21 +- ...mpletionMessageToolCallChunkNormalizer.php | 106 ++++ ...etionMessageToolCallFunctionNormalizer.php | 89 +++ ...hatCompletionMessageToolCallNormalizer.php | 95 +++ ...etionNamedToolChoiceFunctionNormalizer.php | 84 +++ ...atCompletionNamedToolChoiceNormalizer.php} | 43 +- ...AssistantMessageFunctionCallNormalizer.php | 89 +++ ...etionRequestAssistantMessageNormalizer.php | 124 ++++ ...letionRequestFunctionMessageNormalizer.php | 96 +++ ...sageContentPartImageImageUrlNormalizer.php | 91 +++ ...uestMessageContentPartImageNormalizer.php} | 49 +- ...equestMessageContentPartTextNormalizer.php | 89 +++ ...pletionRequestSystemMessageNormalizer.php} | 41 +- ...CompletionRequestToolMessageNormalizer.php | 94 +++ ...CompletionRequestUserMessageNormalizer.php | 96 +++ ...nResponseMessageFunctionCallNormalizer.php | 27 +- ...hatCompletionResponseMessageNormalizer.php | 51 +- ...eamResponseDeltaFunctionCallNormalizer.php | 93 +++ ...ompletionStreamResponseDeltaNormalizer.php | 119 ++++ .../ChatCompletionTokenLogprobNormalizer.php | 121 ++++ ...nTokenLogprobTopLogprobsItemNormalizer.php | 107 ++++ .../ChatCompletionToolNormalizer.php | 90 +++ ...izer.php => CompletionUsageNormalizer.php} | 31 +- .../CreateAnswerRequestNormalizer.php | 231 -------- .../CreateAnswerResponseNormalizer.php | 131 ---- .../CreateAssistantFileRequestNormalizer.php | 73 +++ .../CreateAssistantRequestNormalizer.php | 141 +++++ ...nFunctionResponseChoicesItemNormalizer.php | 95 +++ ...atCompletionFunctionResponseNormalizer.php | 128 ++++ .../CreateChatCompletionRequestNormalizer.php | 242 +++++--- ...letionRequestResponseFormatNormalizer.php} | 38 +- ...nResponseChoicesItemLogprobsNormalizer.php | 95 +++ ...ompletionResponseChoicesItemNormalizer.php | 39 +- ...CreateChatCompletionResponseNormalizer.php | 48 +- ...mResponseChoicesItemLogprobsNormalizer.php | 95 +++ ...ionStreamResponseChoicesItemNormalizer.php | 107 ++++ ...ChatCompletionStreamResponseNormalizer.php | 120 ++++ .../CreateClassificationRequestNormalizer.php | 207 ------- ...CreateClassificationResponseNormalizer.php | 123 ---- .../CreateCompletionRequestNormalizer.php | 202 ++++--- ...nResponseChoicesItemLogprobsNormalizer.php | 81 +-- ...ompletionResponseChoicesItemNormalizer.php | 41 +- .../CreateCompletionResponseNormalizer.php | 48 +- .../CreateEditRequestNormalizer.php | 21 +- ...tResponseChoicesItemLogprobsNormalizer.php | 140 ----- ...reateEditResponseChoicesItemNormalizer.php | 45 +- .../CreateEditResponseNormalizer.php | 35 +- .../CreateEmbeddingRequestNormalizer.php | 26 +- .../CreateEmbeddingResponseNormalizer.php | 35 +- ...CreateEmbeddingResponseUsageNormalizer.php | 11 +- .../CreateFileRequestNormalizer.php | 14 +- ...neTuneRequestHyperparametersNormalizer.php | 86 +++ .../CreateFineTuneRequestNormalizer.php | 144 ++--- ...ingJobRequestHyperparametersNormalizer.php | 100 ++++ .../CreateFineTuningJobRequestNormalizer.php | 115 ++++ .../CreateImageEditRequestNormalizer.php | 28 +- .../CreateImageRequestNormalizer.php | 50 +- .../CreateImageVariationRequestNormalizer.php | 38 +- .../CreateMessageRequestNormalizer.php | 107 ++++ .../CreateModerationRequestNormalizer.php | 11 +- .../CreateModerationResponseNormalizer.php | 11 +- ...esponseResultsItemCategoriesNormalizer.php | 31 +- ...nseResultsItemCategoryScoresNormalizer.php | 43 +- ...oderationResponseResultsItemNormalizer.php | 11 +- .../Normalizer/CreateRunRequestNormalizer.php | 129 ++++ .../CreateSearchRequestNormalizer.php | 128 ---- .../CreateSpeechRequestNormalizer.php | 96 +++ .../CreateThreadAndRunRequestNormalizer.php | 128 ++++ .../CreateThreadRequestNormalizer.php | 100 ++++ .../CreateTranscriptionRequestNormalizer.php | 26 +- .../CreateTranscriptionResponseNormalizer.php | 11 +- .../CreateTranslationRequestNormalizer.php | 14 +- .../CreateTranslationResponseNormalizer.php | 11 +- ...DeleteAssistantFileResponseNormalizer.php} | 38 +- .../DeleteAssistantResponseNormalizer.php | 94 +++ .../DeleteFileResponseNormalizer.php | 11 +- .../DeleteMessageResponseNormalizer.php | 94 +++ .../DeleteModelResponseNormalizer.php | 21 +- .../DeleteThreadResponseNormalizer.php | 94 +++ ...Normalizer.php => EmbeddingNormalizer.php} | 31 +- generated/Normalizer/ErrorNormalizer.php | 31 +- .../Normalizer/ErrorResponseNormalizer.php | 11 +- .../Normalizer/FineTuneEventNormalizer.php | 21 +- .../FineTuneHyperparamsNormalizer.php | 126 ++++ generated/Normalizer/FineTuneNormalizer.php | 144 ++--- .../FineTuningJobErrorNormalizer.php | 96 +++ .../FineTuningJobEventNormalizer.php | 104 ++++ ...FineTuningJobHyperparametersNormalizer.php | 84 +++ .../Normalizer/FineTuningJobNormalizer.php | 169 ++++++ .../Normalizer/FunctionObjectNormalizer.php | 106 ++++ ...ItemNormalizer.php => ImageNormalizer.php} | 38 +- .../Normalizer/ImagesResponseNormalizer.php | 15 +- generated/Normalizer/JaneObjectNormalizer.php | 397 +++++++++++-- .../ListAssistantFilesResponseNormalizer.php | 113 ++++ .../ListAssistantsResponseNormalizer.php | 113 ++++ .../ListFilesResponseNormalizer.php | 21 +- .../ListFineTuneEventsResponseNormalizer.php | 21 +- .../ListFineTunesResponseNormalizer.php | 21 +- ...FineTuningJobEventsResponseNormalizer.php} | 35 +- .../ListMessageFilesResponseNormalizer.php | 113 ++++ .../ListMessagesResponseNormalizer.php | 113 ++++ .../ListModelsResponseNormalizer.php | 11 +- ...natedFineTuningJobsResponseNormalizer.php} | 59 +- .../ListRunStepsResponseNormalizer.php | 113 ++++ .../Normalizer/ListRunsResponseNormalizer.php | 113 ++++ .../ListThreadsResponseNormalizer.php | 113 ++++ ...tentImageFileObjectImageFileNormalizer.php | 84 +++ ...essageContentImageFileObjectNormalizer.php | 90 +++ ...leCitationObjectFileCitationNormalizer.php | 89 +++ ...nnotationsFileCitationObjectNormalizer.php | 105 ++++ ...ationsFilePathObjectFilePathNormalizer.php | 84 +++ ...extAnnotationsFilePathObjectNormalizer.php | 105 ++++ .../MessageContentTextObjectNormalizer.php | 90 +++ ...MessageContentTextObjectTextNormalizer.php | 97 +++ .../MessageFileObjectNormalizer.php | 99 ++++ .../Normalizer/MessageObjectNormalizer.php | 159 +++++ generated/Normalizer/ModelNormalizer.php | 21 +- .../ModifyAssistantRequestNormalizer.php | 143 +++++ .../ModifyMessageRequestNormalizer.php | 85 +++ .../Normalizer/ModifyRunRequestNormalizer.php | 85 +++ .../ModifyThreadRequestNormalizer.php | 85 +++ generated/Normalizer/OpenAIFileNormalizer.php | 53 +- .../RunObjectLastErrorNormalizer.php | 89 +++ generated/Normalizer/RunObjectNormalizer.php | 209 +++++++ .../RunObjectRequiredActionNormalizer.php | 90 +++ ...uiredActionSubmitToolOutputsNormalizer.php | 93 +++ ...reationObjectMessageCreationNormalizer.php | 84 +++ ...DetailsMessageCreationObjectNormalizer.php | 90 +++ ...llsCodeObjectCodeInterpreterNormalizer.php | 105 ++++ ...epDetailsToolCallsCodeObjectNormalizer.php | 95 +++ ...lsCodeOutputImageObjectImageNormalizer.php | 84 +++ ...olCallsCodeOutputImageObjectNormalizer.php | 90 +++ ...oolCallsCodeOutputLogsObjectNormalizer.php | 89 +++ ...lCallsFunctionObjectFunctionNormalizer.php | 96 +++ ...tailsToolCallsFunctionObjectNormalizer.php | 95 +++ ...unStepDetailsToolCallsObjectNormalizer.php | 105 ++++ ...ailsToolCallsRetrievalObjectNormalizer.php | 102 ++++ .../RunStepObjectLastErrorNormalizer.php | 89 +++ .../Normalizer/RunStepObjectNormalizer.php | 183 ++++++ .../RunToolCallObjectFunctionNormalizer.php | 89 +++ .../RunToolCallObjectNormalizer.php | 95 +++ .../SubmitToolOutputsRunRequestNormalizer.php | 82 +++ ...utsRunRequestToolOutputsItemNormalizer.php | 93 +++ .../Normalizer/ThreadObjectNormalizer.php | 109 ++++ .../Normalizer/ValidationException.php | 2 +- 363 files changed, 27935 insertions(+), 5640 deletions(-) create mode 100644 generated/Authentication/ApiKeyAuthAuthentication.php create mode 100644 generated/Endpoint/CancelFineTuningJob.php create mode 100644 generated/Endpoint/CancelRun.php create mode 100644 generated/Endpoint/CreateAssistant.php create mode 100644 generated/Endpoint/CreateAssistantFile.php create mode 100644 generated/Endpoint/CreateFineTuningJob.php create mode 100644 generated/Endpoint/CreateMessage.php create mode 100644 generated/Endpoint/CreateRun.php create mode 100644 generated/Endpoint/CreateSpeech.php create mode 100644 generated/Endpoint/CreateThread.php create mode 100644 generated/Endpoint/CreateThreadAndRun.php create mode 100644 generated/Endpoint/DeleteAssistant.php create mode 100644 generated/Endpoint/DeleteAssistantFile.php create mode 100644 generated/Endpoint/DeleteThread.php create mode 100644 generated/Endpoint/GetAssistant.php create mode 100644 generated/Endpoint/GetAssistantFile.php create mode 100644 generated/Endpoint/GetMessage.php create mode 100644 generated/Endpoint/GetMessageFile.php create mode 100644 generated/Endpoint/GetRun.php create mode 100644 generated/Endpoint/GetRunStep.php create mode 100644 generated/Endpoint/GetThread.php create mode 100644 generated/Endpoint/ListAssistantFiles.php create mode 100644 generated/Endpoint/ListAssistants.php create mode 100644 generated/Endpoint/ListFineTuningEvents.php create mode 100644 generated/Endpoint/ListMessageFiles.php create mode 100644 generated/Endpoint/ListMessages.php create mode 100644 generated/Endpoint/ListPaginatedFineTuningJobs.php create mode 100644 generated/Endpoint/ListRunSteps.php create mode 100644 generated/Endpoint/ListRuns.php create mode 100644 generated/Endpoint/ModifyAssistant.php create mode 100644 generated/Endpoint/ModifyMessage.php create mode 100644 generated/Endpoint/ModifyRun.php create mode 100644 generated/Endpoint/ModifyThread.php create mode 100644 generated/Endpoint/RetrieveFineTuningJob.php create mode 100644 generated/Endpoint/SubmitToolOuputsToRun.php create mode 100644 generated/Model/AssistantFileObject.php create mode 100644 generated/Model/AssistantObject.php create mode 100644 generated/Model/AssistantToolsCode.php create mode 100644 generated/Model/AssistantToolsFunction.php create mode 100644 generated/Model/AssistantToolsRetrieval.php create mode 100644 generated/Model/ChatCompletionFunctionCallOption.php create mode 100644 generated/Model/ChatCompletionMessageToolCall.php create mode 100644 generated/Model/ChatCompletionMessageToolCallChunk.php create mode 100644 generated/Model/ChatCompletionMessageToolCallChunkFunction.php rename generated/Model/{ChatCompletionRequestMessageFunctionCall.php => ChatCompletionMessageToolCallFunction.php} (97%) create mode 100644 generated/Model/ChatCompletionNamedToolChoice.php create mode 100644 generated/Model/ChatCompletionNamedToolChoiceFunction.php create mode 100644 generated/Model/ChatCompletionRequestAssistantMessage.php create mode 100644 generated/Model/ChatCompletionRequestAssistantMessageFunctionCall.php create mode 100644 generated/Model/ChatCompletionRequestFunctionMessage.php delete mode 100644 generated/Model/ChatCompletionRequestMessage.php create mode 100644 generated/Model/ChatCompletionRequestMessageContentPartImage.php create mode 100644 generated/Model/ChatCompletionRequestMessageContentPartImageImageUrl.php create mode 100644 generated/Model/ChatCompletionRequestMessageContentPartText.php create mode 100644 generated/Model/ChatCompletionRequestSystemMessage.php create mode 100644 generated/Model/ChatCompletionRequestToolMessage.php create mode 100644 generated/Model/ChatCompletionRequestUserMessage.php create mode 100644 generated/Model/ChatCompletionStreamResponseDelta.php create mode 100644 generated/Model/ChatCompletionStreamResponseDeltaFunctionCall.php create mode 100644 generated/Model/ChatCompletionTokenLogprob.php create mode 100644 generated/Model/ChatCompletionTokenLogprobTopLogprobsItem.php create mode 100644 generated/Model/ChatCompletionTool.php rename generated/Model/{CreateEditResponseUsage.php => CompletionUsage.php} (61%) delete mode 100644 generated/Model/CreateAnswerRequest.php delete mode 100644 generated/Model/CreateAnswerResponse.php delete mode 100644 generated/Model/CreateAnswerResponseSelectedDocumentsItem.php create mode 100644 generated/Model/CreateAssistantFileRequest.php create mode 100644 generated/Model/CreateAssistantRequest.php create mode 100644 generated/Model/CreateChatCompletionFunctionResponse.php create mode 100644 generated/Model/CreateChatCompletionFunctionResponseChoicesItem.php create mode 100644 generated/Model/CreateChatCompletionRequestResponseFormat.php create mode 100644 generated/Model/CreateChatCompletionResponseChoicesItemLogprobs.php delete mode 100644 generated/Model/CreateChatCompletionResponseUsage.php create mode 100644 generated/Model/CreateChatCompletionStreamResponse.php create mode 100644 generated/Model/CreateChatCompletionStreamResponseChoicesItem.php create mode 100644 generated/Model/CreateChatCompletionStreamResponseChoicesItemLogprobs.php delete mode 100644 generated/Model/CreateClassificationRequest.php delete mode 100644 generated/Model/CreateClassificationResponse.php delete mode 100644 generated/Model/CreateClassificationResponseSelectedExamplesItem.php delete mode 100644 generated/Model/CreateCompletionResponseUsage.php delete mode 100644 generated/Model/CreateEditResponseChoicesItemLogprobs.php create mode 100644 generated/Model/CreateFineTuneRequestHyperparameters.php create mode 100644 generated/Model/CreateFineTuningJobRequest.php create mode 100644 generated/Model/CreateFineTuningJobRequestHyperparameters.php create mode 100644 generated/Model/CreateMessageRequest.php create mode 100644 generated/Model/CreateRunRequest.php delete mode 100644 generated/Model/CreateSearchRequest.php create mode 100644 generated/Model/CreateSpeechRequest.php create mode 100644 generated/Model/CreateThreadAndRunRequest.php create mode 100644 generated/Model/CreateThreadRequest.php rename generated/Model/{Engine.php => DeleteAssistantFileResponse.php} (56%) rename generated/Model/{CreateSearchResponseDataItem.php => DeleteAssistantResponse.php} (50%) create mode 100644 generated/Model/DeleteMessageResponse.php create mode 100644 generated/Model/DeleteThreadResponse.php rename generated/Model/{CreateEmbeddingResponseDataItem.php => Embedding.php} (51%) create mode 100644 generated/Model/FineTuneHyperparams.php create mode 100644 generated/Model/FineTuningJob.php create mode 100644 generated/Model/FineTuningJobError.php create mode 100644 generated/Model/FineTuningJobEvent.php create mode 100644 generated/Model/FineTuningJobHyperparameters.php create mode 100644 generated/Model/FunctionObject.php create mode 100644 generated/Model/Image.php delete mode 100644 generated/Model/ImagesResponseDataItem.php create mode 100644 generated/Model/ListAssistantFilesResponse.php create mode 100644 generated/Model/ListAssistantsResponse.php rename generated/Model/{ListEnginesResponse.php => ListFineTuningJobEventsResponse.php} (80%) create mode 100644 generated/Model/ListMessageFilesResponse.php create mode 100644 generated/Model/ListMessagesResponse.php rename generated/Model/{CreateSearchResponse.php => ListPaginatedFineTuningJobsResponse.php} (64%) create mode 100644 generated/Model/ListRunStepsResponse.php create mode 100644 generated/Model/ListRunsResponse.php create mode 100644 generated/Model/ListThreadsResponse.php create mode 100644 generated/Model/MessageContentImageFileObject.php create mode 100644 generated/Model/MessageContentImageFileObjectImageFile.php create mode 100644 generated/Model/MessageContentTextAnnotationsFileCitationObject.php create mode 100644 generated/Model/MessageContentTextAnnotationsFileCitationObjectFileCitation.php create mode 100644 generated/Model/MessageContentTextAnnotationsFilePathObject.php create mode 100644 generated/Model/MessageContentTextAnnotationsFilePathObjectFilePath.php create mode 100644 generated/Model/MessageContentTextObject.php create mode 100644 generated/Model/MessageContentTextObjectText.php create mode 100644 generated/Model/MessageFileObject.php create mode 100644 generated/Model/MessageObject.php create mode 100644 generated/Model/ModifyAssistantRequest.php create mode 100644 generated/Model/ModifyMessageRequest.php create mode 100644 generated/Model/ModifyRunRequest.php create mode 100644 generated/Model/ModifyThreadRequest.php create mode 100644 generated/Model/RunObject.php create mode 100644 generated/Model/RunObjectLastError.php create mode 100644 generated/Model/RunObjectRequiredAction.php create mode 100644 generated/Model/RunObjectRequiredActionSubmitToolOutputs.php create mode 100644 generated/Model/RunStepDetailsMessageCreationObject.php create mode 100644 generated/Model/RunStepDetailsMessageCreationObjectMessageCreation.php create mode 100644 generated/Model/RunStepDetailsToolCallsCodeObject.php create mode 100644 generated/Model/RunStepDetailsToolCallsCodeObjectCodeInterpreter.php create mode 100644 generated/Model/RunStepDetailsToolCallsCodeOutputImageObject.php create mode 100644 generated/Model/RunStepDetailsToolCallsCodeOutputImageObjectImage.php create mode 100644 generated/Model/RunStepDetailsToolCallsCodeOutputLogsObject.php create mode 100644 generated/Model/RunStepDetailsToolCallsFunctionObject.php create mode 100644 generated/Model/RunStepDetailsToolCallsFunctionObjectFunction.php create mode 100644 generated/Model/RunStepDetailsToolCallsObject.php create mode 100644 generated/Model/RunStepDetailsToolCallsRetrievalObject.php create mode 100644 generated/Model/RunStepObject.php create mode 100644 generated/Model/RunStepObjectLastError.php create mode 100644 generated/Model/RunToolCallObject.php create mode 100644 generated/Model/RunToolCallObjectFunction.php create mode 100644 generated/Model/SubmitToolOutputsRunRequest.php create mode 100644 generated/Model/SubmitToolOutputsRunRequestToolOutputsItem.php create mode 100644 generated/Model/ThreadObject.php rename generated/Normalizer/{CreateSearchResponseDataItemNormalizer.php => AssistantFileObjectNormalizer.php} (61%) create mode 100644 generated/Normalizer/AssistantObjectNormalizer.php create mode 100644 generated/Normalizer/AssistantToolsCodeNormalizer.php rename generated/Normalizer/{CreateChatCompletionResponseUsageNormalizer.php => AssistantToolsFunctionNormalizer.php} (61%) create mode 100644 generated/Normalizer/AssistantToolsRetrievalNormalizer.php create mode 100644 generated/Normalizer/ChatCompletionFunctionCallOptionNormalizer.php rename generated/Normalizer/{ChatCompletionRequestMessageFunctionCallNormalizer.php => ChatCompletionMessageToolCallChunkFunctionNormalizer.php} (77%) create mode 100644 generated/Normalizer/ChatCompletionMessageToolCallChunkNormalizer.php create mode 100644 generated/Normalizer/ChatCompletionMessageToolCallFunctionNormalizer.php create mode 100644 generated/Normalizer/ChatCompletionMessageToolCallNormalizer.php create mode 100644 generated/Normalizer/ChatCompletionNamedToolChoiceFunctionNormalizer.php rename generated/Normalizer/{CreateCompletionResponseUsageNormalizer.php => ChatCompletionNamedToolChoiceNormalizer.php} (62%) create mode 100644 generated/Normalizer/ChatCompletionRequestAssistantMessageFunctionCallNormalizer.php create mode 100644 generated/Normalizer/ChatCompletionRequestAssistantMessageNormalizer.php create mode 100644 generated/Normalizer/ChatCompletionRequestFunctionMessageNormalizer.php create mode 100644 generated/Normalizer/ChatCompletionRequestMessageContentPartImageImageUrlNormalizer.php rename generated/Normalizer/{CreateClassificationResponseSelectedExamplesItemNormalizer.php => ChatCompletionRequestMessageContentPartImageNormalizer.php} (57%) create mode 100644 generated/Normalizer/ChatCompletionRequestMessageContentPartTextNormalizer.php rename generated/Normalizer/{ChatCompletionRequestMessageNormalizer.php => ChatCompletionRequestSystemMessageNormalizer.php} (70%) create mode 100644 generated/Normalizer/ChatCompletionRequestToolMessageNormalizer.php create mode 100644 generated/Normalizer/ChatCompletionRequestUserMessageNormalizer.php create mode 100644 generated/Normalizer/ChatCompletionStreamResponseDeltaFunctionCallNormalizer.php create mode 100644 generated/Normalizer/ChatCompletionStreamResponseDeltaNormalizer.php create mode 100644 generated/Normalizer/ChatCompletionTokenLogprobNormalizer.php create mode 100644 generated/Normalizer/ChatCompletionTokenLogprobTopLogprobsItemNormalizer.php create mode 100644 generated/Normalizer/ChatCompletionToolNormalizer.php rename generated/Normalizer/{CreateEditResponseUsageNormalizer.php => CompletionUsageNormalizer.php} (80%) delete mode 100644 generated/Normalizer/CreateAnswerRequestNormalizer.php delete mode 100644 generated/Normalizer/CreateAnswerResponseNormalizer.php create mode 100644 generated/Normalizer/CreateAssistantFileRequestNormalizer.php create mode 100644 generated/Normalizer/CreateAssistantRequestNormalizer.php create mode 100644 generated/Normalizer/CreateChatCompletionFunctionResponseChoicesItemNormalizer.php create mode 100644 generated/Normalizer/CreateChatCompletionFunctionResponseNormalizer.php rename generated/Normalizer/{CreateAnswerResponseSelectedDocumentsItemNormalizer.php => CreateChatCompletionRequestResponseFormatNormalizer.php} (67%) create mode 100644 generated/Normalizer/CreateChatCompletionResponseChoicesItemLogprobsNormalizer.php create mode 100644 generated/Normalizer/CreateChatCompletionStreamResponseChoicesItemLogprobsNormalizer.php create mode 100644 generated/Normalizer/CreateChatCompletionStreamResponseChoicesItemNormalizer.php create mode 100644 generated/Normalizer/CreateChatCompletionStreamResponseNormalizer.php delete mode 100644 generated/Normalizer/CreateClassificationRequestNormalizer.php delete mode 100644 generated/Normalizer/CreateClassificationResponseNormalizer.php delete mode 100644 generated/Normalizer/CreateEditResponseChoicesItemLogprobsNormalizer.php create mode 100644 generated/Normalizer/CreateFineTuneRequestHyperparametersNormalizer.php create mode 100644 generated/Normalizer/CreateFineTuningJobRequestHyperparametersNormalizer.php create mode 100644 generated/Normalizer/CreateFineTuningJobRequestNormalizer.php create mode 100644 generated/Normalizer/CreateMessageRequestNormalizer.php create mode 100644 generated/Normalizer/CreateRunRequestNormalizer.php delete mode 100644 generated/Normalizer/CreateSearchRequestNormalizer.php create mode 100644 generated/Normalizer/CreateSpeechRequestNormalizer.php create mode 100644 generated/Normalizer/CreateThreadAndRunRequestNormalizer.php create mode 100644 generated/Normalizer/CreateThreadRequestNormalizer.php rename generated/Normalizer/{EngineNormalizer.php => DeleteAssistantFileResponseNormalizer.php} (71%) create mode 100644 generated/Normalizer/DeleteAssistantResponseNormalizer.php create mode 100644 generated/Normalizer/DeleteMessageResponseNormalizer.php create mode 100644 generated/Normalizer/DeleteThreadResponseNormalizer.php rename generated/Normalizer/{CreateEmbeddingResponseDataItemNormalizer.php => EmbeddingNormalizer.php} (81%) create mode 100644 generated/Normalizer/FineTuneHyperparamsNormalizer.php create mode 100644 generated/Normalizer/FineTuningJobErrorNormalizer.php create mode 100644 generated/Normalizer/FineTuningJobEventNormalizer.php create mode 100644 generated/Normalizer/FineTuningJobHyperparametersNormalizer.php create mode 100644 generated/Normalizer/FineTuningJobNormalizer.php create mode 100644 generated/Normalizer/FunctionObjectNormalizer.php rename generated/Normalizer/{ImagesResponseDataItemNormalizer.php => ImageNormalizer.php} (72%) create mode 100644 generated/Normalizer/ListAssistantFilesResponseNormalizer.php create mode 100644 generated/Normalizer/ListAssistantsResponseNormalizer.php rename generated/Normalizer/{ListEnginesResponseNormalizer.php => ListFineTuningJobEventsResponseNormalizer.php} (75%) create mode 100644 generated/Normalizer/ListMessageFilesResponseNormalizer.php create mode 100644 generated/Normalizer/ListMessagesResponseNormalizer.php rename generated/Normalizer/{CreateSearchResponseNormalizer.php => ListPaginatedFineTuningJobsResponseNormalizer.php} (64%) create mode 100644 generated/Normalizer/ListRunStepsResponseNormalizer.php create mode 100644 generated/Normalizer/ListRunsResponseNormalizer.php create mode 100644 generated/Normalizer/ListThreadsResponseNormalizer.php create mode 100644 generated/Normalizer/MessageContentImageFileObjectImageFileNormalizer.php create mode 100644 generated/Normalizer/MessageContentImageFileObjectNormalizer.php create mode 100644 generated/Normalizer/MessageContentTextAnnotationsFileCitationObjectFileCitationNormalizer.php create mode 100644 generated/Normalizer/MessageContentTextAnnotationsFileCitationObjectNormalizer.php create mode 100644 generated/Normalizer/MessageContentTextAnnotationsFilePathObjectFilePathNormalizer.php create mode 100644 generated/Normalizer/MessageContentTextAnnotationsFilePathObjectNormalizer.php create mode 100644 generated/Normalizer/MessageContentTextObjectNormalizer.php create mode 100644 generated/Normalizer/MessageContentTextObjectTextNormalizer.php create mode 100644 generated/Normalizer/MessageFileObjectNormalizer.php create mode 100644 generated/Normalizer/MessageObjectNormalizer.php create mode 100644 generated/Normalizer/ModifyAssistantRequestNormalizer.php create mode 100644 generated/Normalizer/ModifyMessageRequestNormalizer.php create mode 100644 generated/Normalizer/ModifyRunRequestNormalizer.php create mode 100644 generated/Normalizer/ModifyThreadRequestNormalizer.php create mode 100644 generated/Normalizer/RunObjectLastErrorNormalizer.php create mode 100644 generated/Normalizer/RunObjectNormalizer.php create mode 100644 generated/Normalizer/RunObjectRequiredActionNormalizer.php create mode 100644 generated/Normalizer/RunObjectRequiredActionSubmitToolOutputsNormalizer.php create mode 100644 generated/Normalizer/RunStepDetailsMessageCreationObjectMessageCreationNormalizer.php create mode 100644 generated/Normalizer/RunStepDetailsMessageCreationObjectNormalizer.php create mode 100644 generated/Normalizer/RunStepDetailsToolCallsCodeObjectCodeInterpreterNormalizer.php create mode 100644 generated/Normalizer/RunStepDetailsToolCallsCodeObjectNormalizer.php create mode 100644 generated/Normalizer/RunStepDetailsToolCallsCodeOutputImageObjectImageNormalizer.php create mode 100644 generated/Normalizer/RunStepDetailsToolCallsCodeOutputImageObjectNormalizer.php create mode 100644 generated/Normalizer/RunStepDetailsToolCallsCodeOutputLogsObjectNormalizer.php create mode 100644 generated/Normalizer/RunStepDetailsToolCallsFunctionObjectFunctionNormalizer.php create mode 100644 generated/Normalizer/RunStepDetailsToolCallsFunctionObjectNormalizer.php create mode 100644 generated/Normalizer/RunStepDetailsToolCallsObjectNormalizer.php create mode 100644 generated/Normalizer/RunStepDetailsToolCallsRetrievalObjectNormalizer.php create mode 100644 generated/Normalizer/RunStepObjectLastErrorNormalizer.php create mode 100644 generated/Normalizer/RunStepObjectNormalizer.php create mode 100644 generated/Normalizer/RunToolCallObjectFunctionNormalizer.php create mode 100644 generated/Normalizer/RunToolCallObjectNormalizer.php create mode 100644 generated/Normalizer/SubmitToolOutputsRunRequestNormalizer.php create mode 100644 generated/Normalizer/SubmitToolOutputsRunRequestToolOutputsItemNormalizer.php create mode 100644 generated/Normalizer/ThreadObjectNormalizer.php diff --git a/generated/Authentication/ApiKeyAuthAuthentication.php b/generated/Authentication/ApiKeyAuthAuthentication.php new file mode 100644 index 0000000..6b0d443 --- /dev/null +++ b/generated/Authentication/ApiKeyAuthAuthentication.php @@ -0,0 +1,30 @@ +{'token'} = $token; + } + + public function authentication(RequestInterface $request): RequestInterface + { + $header = sprintf('Bearer %s', $this->{'token'}); + $request = $request->withHeader('Authorization', $header); + return $request; + } + + public function getScope(): string + { + return 'ApiKeyAuth'; + } +} diff --git a/generated/Client.php b/generated/Client.php index 9f2fd63..40b0300 100644 --- a/generated/Client.php +++ b/generated/Client.php @@ -11,28 +11,66 @@ use Http\Discovery\Psr18ClientDiscovery; use Psr\Http\Message\ResponseInterface; use Sourceability\OpenAIClient\Generated\Endpoint\CancelFineTune; +use Sourceability\OpenAIClient\Generated\Endpoint\CancelFineTuningJob; +use Sourceability\OpenAIClient\Generated\Endpoint\CancelRun; +use Sourceability\OpenAIClient\Generated\Endpoint\CreateAssistant; +use Sourceability\OpenAIClient\Generated\Endpoint\CreateAssistantFile; use Sourceability\OpenAIClient\Generated\Endpoint\CreateChatCompletion; use Sourceability\OpenAIClient\Generated\Endpoint\CreateCompletion; use Sourceability\OpenAIClient\Generated\Endpoint\CreateEdit; use Sourceability\OpenAIClient\Generated\Endpoint\CreateEmbedding; use Sourceability\OpenAIClient\Generated\Endpoint\CreateFile; use Sourceability\OpenAIClient\Generated\Endpoint\CreateFineTune; +use Sourceability\OpenAIClient\Generated\Endpoint\CreateFineTuningJob; use Sourceability\OpenAIClient\Generated\Endpoint\CreateImage; use Sourceability\OpenAIClient\Generated\Endpoint\CreateImageEdit; use Sourceability\OpenAIClient\Generated\Endpoint\CreateImageVariation; +use Sourceability\OpenAIClient\Generated\Endpoint\CreateMessage; use Sourceability\OpenAIClient\Generated\Endpoint\CreateModeration; +use Sourceability\OpenAIClient\Generated\Endpoint\CreateRun; +use Sourceability\OpenAIClient\Generated\Endpoint\CreateSpeech; +use Sourceability\OpenAIClient\Generated\Endpoint\CreateThread; +use Sourceability\OpenAIClient\Generated\Endpoint\CreateThreadAndRun; use Sourceability\OpenAIClient\Generated\Endpoint\CreateTranscription; use Sourceability\OpenAIClient\Generated\Endpoint\CreateTranslation; +use Sourceability\OpenAIClient\Generated\Endpoint\DeleteAssistant; +use Sourceability\OpenAIClient\Generated\Endpoint\DeleteAssistantFile; use Sourceability\OpenAIClient\Generated\Endpoint\DeleteFile; use Sourceability\OpenAIClient\Generated\Endpoint\DeleteModel; +use Sourceability\OpenAIClient\Generated\Endpoint\DeleteThread; use Sourceability\OpenAIClient\Generated\Endpoint\DownloadFile; +use Sourceability\OpenAIClient\Generated\Endpoint\GetAssistant; +use Sourceability\OpenAIClient\Generated\Endpoint\GetAssistantFile; +use Sourceability\OpenAIClient\Generated\Endpoint\GetMessage; +use Sourceability\OpenAIClient\Generated\Endpoint\GetMessageFile; +use Sourceability\OpenAIClient\Generated\Endpoint\GetRun; +use Sourceability\OpenAIClient\Generated\Endpoint\GetRunStep; +use Sourceability\OpenAIClient\Generated\Endpoint\GetThread; +use Sourceability\OpenAIClient\Generated\Endpoint\ListAssistantFiles; +use Sourceability\OpenAIClient\Generated\Endpoint\ListAssistants; use Sourceability\OpenAIClient\Generated\Endpoint\ListFiles; use Sourceability\OpenAIClient\Generated\Endpoint\ListFineTuneEvents; use Sourceability\OpenAIClient\Generated\Endpoint\ListFineTunes; +use Sourceability\OpenAIClient\Generated\Endpoint\ListFineTuningEvents; +use Sourceability\OpenAIClient\Generated\Endpoint\ListMessageFiles; +use Sourceability\OpenAIClient\Generated\Endpoint\ListMessages; use Sourceability\OpenAIClient\Generated\Endpoint\ListModels; +use Sourceability\OpenAIClient\Generated\Endpoint\ListPaginatedFineTuningJobs; +use Sourceability\OpenAIClient\Generated\Endpoint\ListRuns; +use Sourceability\OpenAIClient\Generated\Endpoint\ListRunSteps; +use Sourceability\OpenAIClient\Generated\Endpoint\ModifyAssistant; +use Sourceability\OpenAIClient\Generated\Endpoint\ModifyMessage; +use Sourceability\OpenAIClient\Generated\Endpoint\ModifyRun; +use Sourceability\OpenAIClient\Generated\Endpoint\ModifyThread; use Sourceability\OpenAIClient\Generated\Endpoint\RetrieveFile; use Sourceability\OpenAIClient\Generated\Endpoint\RetrieveFineTune; +use Sourceability\OpenAIClient\Generated\Endpoint\RetrieveFineTuningJob; use Sourceability\OpenAIClient\Generated\Endpoint\RetrieveModel; +use Sourceability\OpenAIClient\Generated\Endpoint\SubmitToolOuputsToRun; +use Sourceability\OpenAIClient\Generated\Model\AssistantFileObject; +use Sourceability\OpenAIClient\Generated\Model\AssistantObject; +use Sourceability\OpenAIClient\Generated\Model\CreateAssistantFileRequest; +use Sourceability\OpenAIClient\Generated\Model\CreateAssistantRequest; use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionRequest; use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionResponse; use Sourceability\OpenAIClient\Generated\Model\CreateCompletionRequest; @@ -43,25 +81,53 @@ use Sourceability\OpenAIClient\Generated\Model\CreateEmbeddingResponse; use Sourceability\OpenAIClient\Generated\Model\CreateFileRequest; use Sourceability\OpenAIClient\Generated\Model\CreateFineTuneRequest; +use Sourceability\OpenAIClient\Generated\Model\CreateFineTuningJobRequest; use Sourceability\OpenAIClient\Generated\Model\CreateImageEditRequest; use Sourceability\OpenAIClient\Generated\Model\CreateImageRequest; use Sourceability\OpenAIClient\Generated\Model\CreateImageVariationRequest; +use Sourceability\OpenAIClient\Generated\Model\CreateMessageRequest; use Sourceability\OpenAIClient\Generated\Model\CreateModerationRequest; use Sourceability\OpenAIClient\Generated\Model\CreateModerationResponse; +use Sourceability\OpenAIClient\Generated\Model\CreateRunRequest; +use Sourceability\OpenAIClient\Generated\Model\CreateSpeechRequest; +use Sourceability\OpenAIClient\Generated\Model\CreateThreadAndRunRequest; +use Sourceability\OpenAIClient\Generated\Model\CreateThreadRequest; use Sourceability\OpenAIClient\Generated\Model\CreateTranscriptionRequest; use Sourceability\OpenAIClient\Generated\Model\CreateTranscriptionResponse; use Sourceability\OpenAIClient\Generated\Model\CreateTranslationRequest; use Sourceability\OpenAIClient\Generated\Model\CreateTranslationResponse; +use Sourceability\OpenAIClient\Generated\Model\DeleteAssistantFileResponse; +use Sourceability\OpenAIClient\Generated\Model\DeleteAssistantResponse; use Sourceability\OpenAIClient\Generated\Model\DeleteFileResponse; use Sourceability\OpenAIClient\Generated\Model\DeleteModelResponse; +use Sourceability\OpenAIClient\Generated\Model\DeleteThreadResponse; use Sourceability\OpenAIClient\Generated\Model\FineTune; +use Sourceability\OpenAIClient\Generated\Model\FineTuningJob; use Sourceability\OpenAIClient\Generated\Model\ImagesResponse; +use Sourceability\OpenAIClient\Generated\Model\ListAssistantFilesResponse; +use Sourceability\OpenAIClient\Generated\Model\ListAssistantsResponse; use Sourceability\OpenAIClient\Generated\Model\ListFilesResponse; use Sourceability\OpenAIClient\Generated\Model\ListFineTuneEventsResponse; use Sourceability\OpenAIClient\Generated\Model\ListFineTunesResponse; +use Sourceability\OpenAIClient\Generated\Model\ListFineTuningJobEventsResponse; +use Sourceability\OpenAIClient\Generated\Model\ListMessageFilesResponse; +use Sourceability\OpenAIClient\Generated\Model\ListMessagesResponse; use Sourceability\OpenAIClient\Generated\Model\ListModelsResponse; +use Sourceability\OpenAIClient\Generated\Model\ListPaginatedFineTuningJobsResponse; +use Sourceability\OpenAIClient\Generated\Model\ListRunsResponse; +use Sourceability\OpenAIClient\Generated\Model\ListRunStepsResponse; +use Sourceability\OpenAIClient\Generated\Model\MessageFileObject; +use Sourceability\OpenAIClient\Generated\Model\MessageObject; use Sourceability\OpenAIClient\Generated\Model\Model; +use Sourceability\OpenAIClient\Generated\Model\ModifyAssistantRequest; +use Sourceability\OpenAIClient\Generated\Model\ModifyMessageRequest; +use Sourceability\OpenAIClient\Generated\Model\ModifyRunRequest; +use Sourceability\OpenAIClient\Generated\Model\ModifyThreadRequest; use Sourceability\OpenAIClient\Generated\Model\OpenAIFile; +use Sourceability\OpenAIClient\Generated\Model\RunObject; +use Sourceability\OpenAIClient\Generated\Model\RunStepObject; +use Sourceability\OpenAIClient\Generated\Model\SubmitToolOutputsRunRequest; +use Sourceability\OpenAIClient\Generated\Model\ThreadObject; use Sourceability\OpenAIClient\Generated\Normalizer\JaneObjectNormalizer; use Symfony\Component\Serializer\Encoder\JsonDecode; use Symfony\Component\Serializer\Encoder\JsonEncode; @@ -134,6 +200,15 @@ public function createEmbedding(CreateEmbeddingRequest $requestBody, string $fet return $this->executeEndpoint(new CreateEmbedding($requestBody), $fetch); } + /** + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * @return null|ResponseInterface + */ + public function createSpeech(CreateSpeechRequest $requestBody, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new CreateSpeech($requestBody), $fetch); + } + /** * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @return null|CreateTranscriptionResponse|ResponseInterface @@ -153,13 +228,16 @@ public function createTranslation(CreateTranslationRequest $requestBody, string } /** + * @param array $queryParameters { + * @var string Only return files with the given purpose. + * } * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * * @return null|ListFilesResponse|ResponseInterface */ - public function listFiles(string $fetch = self::FETCH_OBJECT) + public function listFiles(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) { - return $this->executeEndpoint(new ListFiles(), $fetch); + return $this->executeEndpoint(new ListFiles($queryParameters), $fetch); } /** @@ -172,7 +250,7 @@ public function createFile(CreateFileRequest $requestBody, string $fetch = self: } /** - * @param string $fileId The ID of the file to use for this request + * @param string $fileId The ID of the file to use for this request. * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * * @return null|DeleteFileResponse|ResponseInterface @@ -183,7 +261,7 @@ public function deleteFile(string $fileId, string $fetch = self::FETCH_OBJECT) } /** - * @param string $fileId The ID of the file to use for this request + * @param string $fileId The ID of the file to use for this request. * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * * @return null|OpenAIFile|ResponseInterface @@ -194,7 +272,7 @@ public function retrieveFile(string $fileId, string $fetch = self::FETCH_OBJECT) } /** - * @param string $fileId The ID of the file to use for this request + * @param string $fileId The ID of the file to use for this request. * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * * @return null|ResponseInterface @@ -204,6 +282,66 @@ public function downloadFile(string $fileId, string $fetch = self::FETCH_OBJECT) return $this->executeEndpoint(new DownloadFile($fileId), $fetch); } + /** + * @param array $queryParameters { + * @var string Identifier for the last job from the previous pagination request. + * @var int Number of fine-tuning jobs to retrieve. + * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|ListPaginatedFineTuningJobsResponse|ResponseInterface + */ + public function listPaginatedFineTuningJobs(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new ListPaginatedFineTuningJobs($queryParameters), $fetch); + } + + /** + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * @return null|FineTuningJob|ResponseInterface + */ + public function createFineTuningJob(CreateFineTuningJobRequest $requestBody, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new CreateFineTuningJob($requestBody), $fetch); + } + + /** + * @param string $fineTuningJobId The ID of the fine-tuning job. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|FineTuningJob|ResponseInterface + */ + public function retrieveFineTuningJob(string $fineTuningJobId, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new RetrieveFineTuningJob($fineTuningJobId), $fetch); + } + + /** + * @param string $fineTuningJobId The ID of the fine-tuning job to get events for. + * @param array $queryParameters { + * @var string Identifier for the last event from the previous pagination request. + * @var int Number of events to retrieve. + * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|ListFineTuningJobEventsResponse|ResponseInterface + */ + public function listFineTuningEvents(string $fineTuningJobId, array $queryParameters = [], string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new ListFineTuningEvents($fineTuningJobId, $queryParameters), $fetch); + } + + /** + * @param string $fineTuningJobId The ID of the fine-tuning job to cancel. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|FineTuningJob|ResponseInterface + */ + public function cancelFineTuningJob(string $fineTuningJobId, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new CancelFineTuningJob($fineTuningJobId), $fetch); + } + /** * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @@ -250,6 +388,7 @@ public function cancelFineTune(string $fineTuneId, string $fetch = self::FETCH_O * @param array $queryParameters { * @var bool Whether to stream events for the fine-tune job. If set to true, If set to false, only events generated so far will be returned. + * } * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) * @@ -301,12 +440,356 @@ public function createModeration(CreateModerationRequest $requestBody, string $f return $this->executeEndpoint(new CreateModeration($requestBody), $fetch); } + /** + * @param array $queryParameters { + * @var int A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + * @var string Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + * @var string A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + * @var string A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|ListAssistantsResponse|ResponseInterface + */ + public function listAssistants(array $queryParameters = [], string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new ListAssistants($queryParameters), $fetch); + } + + /** + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * @return null|AssistantObject|ResponseInterface + */ + public function createAssistant(CreateAssistantRequest $requestBody, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new CreateAssistant($requestBody), $fetch); + } + + /** + * @param string $assistantId The ID of the assistant to delete. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|DeleteAssistantResponse|ResponseInterface + */ + public function deleteAssistant(string $assistantId, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new DeleteAssistant($assistantId), $fetch); + } + + /** + * @param string $assistantId The ID of the assistant to retrieve. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|AssistantObject|ResponseInterface + */ + public function getAssistant(string $assistantId, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new GetAssistant($assistantId), $fetch); + } + + /** + * @param string $assistantId The ID of the assistant to modify. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * @return null|AssistantObject|ResponseInterface + */ + public function modifyAssistant(string $assistantId, ModifyAssistantRequest $requestBody, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new ModifyAssistant($assistantId, $requestBody), $fetch); + } + + /** + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|ThreadObject|ResponseInterface + */ + public function createThread(?CreateThreadRequest $requestBody = null, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new CreateThread($requestBody), $fetch); + } + + /** + * @param string $threadId The ID of the thread to delete. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|DeleteThreadResponse|ResponseInterface + */ + public function deleteThread(string $threadId, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new DeleteThread($threadId), $fetch); + } + + /** + * @param string $threadId The ID of the thread to retrieve. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|ThreadObject|ResponseInterface + */ + public function getThread(string $threadId, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new GetThread($threadId), $fetch); + } + + /** + * @param string $threadId The ID of the thread to modify. Only the `metadata` can be modified. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * @return null|ThreadObject|ResponseInterface + */ + public function modifyThread(string $threadId, ModifyThreadRequest $requestBody, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new ModifyThread($threadId, $requestBody), $fetch); + } + + /** + * @param string $threadId The ID of the [thread](/docs/api-reference/threads) the messages belong to. + * @param array $queryParameters { + * @var int A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + * @var string Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + * @var string A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + * @var string A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|ListMessagesResponse|ResponseInterface + */ + public function listMessages(string $threadId, array $queryParameters = [], string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new ListMessages($threadId, $queryParameters), $fetch); + } + + /** + * @param string $threadId The ID of the [thread](/docs/api-reference/threads) to create a message for. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * @return null|MessageObject|ResponseInterface + */ + public function createMessage(string $threadId, CreateMessageRequest $requestBody, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new CreateMessage($threadId, $requestBody), $fetch); + } + + /** + * @param string $threadId The ID of the [thread](/docs/api-reference/threads) to which this message belongs. + * @param string $messageId The ID of the message to retrieve. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|MessageObject|ResponseInterface + */ + public function getMessage(string $threadId, string $messageId, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new GetMessage($threadId, $messageId), $fetch); + } + + /** + * @param string $threadId The ID of the thread to which this message belongs. + * @param string $messageId The ID of the message to modify. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * @return null|MessageObject|ResponseInterface + */ + public function modifyMessage(string $threadId, string $messageId, ModifyMessageRequest $requestBody, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new ModifyMessage($threadId, $messageId, $requestBody), $fetch); + } + + /** + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * @return null|RunObject|ResponseInterface + */ + public function createThreadAndRun(CreateThreadAndRunRequest $requestBody, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new CreateThreadAndRun($requestBody), $fetch); + } + + /** + * @param string $threadId The ID of the thread the run belongs to. + * @param array $queryParameters { + * @var int A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + * @var string Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + * @var string A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + * @var string A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|ListRunsResponse|ResponseInterface + */ + public function listRuns(string $threadId, array $queryParameters = [], string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new ListRuns($threadId, $queryParameters), $fetch); + } + + /** + * @param string $threadId The ID of the thread to run. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * @return null|RunObject|ResponseInterface + */ + public function createRun(string $threadId, CreateRunRequest $requestBody, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new CreateRun($threadId, $requestBody), $fetch); + } + + /** + * @param string $threadId The ID of the [thread](/docs/api-reference/threads) that was run. + * @param string $runId The ID of the run to retrieve. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|RunObject|ResponseInterface + */ + public function getRun(string $threadId, string $runId, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new GetRun($threadId, $runId), $fetch); + } + + /** + * @param string $threadId The ID of the [thread](/docs/api-reference/threads) that was run. + * @param string $runId The ID of the run to modify. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * @return null|RunObject|ResponseInterface + */ + public function modifyRun(string $threadId, string $runId, ModifyRunRequest $requestBody, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new ModifyRun($threadId, $runId, $requestBody), $fetch); + } + + /** + * @param string $threadId The ID of the [thread](/docs/api-reference/threads) to which this run belongs. + * @param string $runId The ID of the run that requires the tool output submission. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * @return null|RunObject|ResponseInterface + */ + public function submitToolOuputsToRun(string $threadId, string $runId, SubmitToolOutputsRunRequest $requestBody, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new SubmitToolOuputsToRun($threadId, $runId, $requestBody), $fetch); + } + + /** + * @param string $threadId The ID of the thread to which this run belongs. + * @param string $runId The ID of the run to cancel. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|RunObject|ResponseInterface + */ + public function cancelRun(string $threadId, string $runId, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new CancelRun($threadId, $runId), $fetch); + } + + /** + * @param string $threadId The ID of the thread the run and run steps belong to. + * @param string $runId The ID of the run the run steps belong to. + * @param array $queryParameters { + * @var int A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + * @var string Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + * @var string A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + * @var string A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|ListRunStepsResponse|ResponseInterface + */ + public function listRunSteps(string $threadId, string $runId, array $queryParameters = [], string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new ListRunSteps($threadId, $runId, $queryParameters), $fetch); + } + + /** + * @param string $threadId The ID of the thread to which the run and run step belongs. + * @param string $runId The ID of the run to which the run step belongs. + * @param string $stepId The ID of the run step to retrieve. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|RunStepObject|ResponseInterface + */ + public function getRunStep(string $threadId, string $runId, string $stepId, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new GetRunStep($threadId, $runId, $stepId), $fetch); + } + + /** + * @param string $assistantId The ID of the assistant the file belongs to. + * @param array $queryParameters { + * @var int A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + * @var string Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + * @var string A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + * @var string A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|ListAssistantFilesResponse|ResponseInterface + */ + public function listAssistantFiles(string $assistantId, array $queryParameters = [], string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new ListAssistantFiles($assistantId, $queryParameters), $fetch); + } + + /** + * @param string $assistantId The ID of the assistant for which to create a File. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * @return null|AssistantFileObject|ResponseInterface + */ + public function createAssistantFile(string $assistantId, CreateAssistantFileRequest $requestBody, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new CreateAssistantFile($assistantId, $requestBody), $fetch); + } + + /** + * @param string $assistantId The ID of the assistant that the file belongs to. + * @param string $fileId The ID of the file to delete. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|DeleteAssistantFileResponse|ResponseInterface + */ + public function deleteAssistantFile(string $assistantId, string $fileId, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new DeleteAssistantFile($assistantId, $fileId), $fetch); + } + + /** + * @param string $assistantId The ID of the assistant who the file belongs to. + * @param string $fileId The ID of the file we're getting. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|AssistantFileObject|ResponseInterface + */ + public function getAssistantFile(string $assistantId, string $fileId, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new GetAssistantFile($assistantId, $fileId), $fetch); + } + + /** + * @param string $threadId The ID of the thread that the message and files belong to. + * @param string $messageId The ID of the message that the files belongs to. + * @param array $queryParameters { + * @var int A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20. + * @var string Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and `desc` for descending order. + * @var string A cursor for use in pagination. `after` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list. + * @var string A cursor for use in pagination. `before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list. + * } + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|ListMessageFilesResponse|ResponseInterface + */ + public function listMessageFiles(string $threadId, string $messageId, array $queryParameters = [], string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new ListMessageFiles($threadId, $messageId, $queryParameters), $fetch); + } + + /** + * @param string $threadId The ID of the thread to which the message and File belong. + * @param string $messageId The ID of the message the file belongs to. + * @param string $fileId The ID of the file being retrieved. + * @param string $fetch Fetch mode to use (can be OBJECT or RESPONSE) + * + * @return null|MessageFileObject|ResponseInterface + */ + public function getMessageFile(string $threadId, string $messageId, string $fileId, string $fetch = self::FETCH_OBJECT) + { + return $this->executeEndpoint(new GetMessageFile($threadId, $messageId, $fileId), $fetch); + } + public static function create($httpClient = null, array $additionalPlugins = [], array $additionalNormalizers = []): static { if ($httpClient === null) { $httpClient = Psr18ClientDiscovery::find(); $plugins = []; - $uri = Psr17FactoryDiscovery::findUrlFactory()->createUri('https://api.openai.com/v1'); + $uri = Psr17FactoryDiscovery::findUriFactory()->createUri('https://api.openai.com/v1'); $plugins[] = new AddHostPlugin($uri); $plugins[] = new AddPathPlugin($uri); if (count($additionalPlugins) > 0) { diff --git a/generated/Endpoint/CancelFineTune.php b/generated/Endpoint/CancelFineTune.php index bdeaa6f..650806b 100644 --- a/generated/Endpoint/CancelFineTune.php +++ b/generated/Endpoint/CancelFineTune.php @@ -38,9 +38,6 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -50,7 +47,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/CancelFineTuningJob.php b/generated/Endpoint/CancelFineTuningJob.php new file mode 100644 index 0000000..3a32a43 --- /dev/null +++ b/generated/Endpoint/CancelFineTuningJob.php @@ -0,0 +1,64 @@ +fine_tuning_job_id], '/fine_tuning/jobs/{fine_tuning_job_id}/cancel'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|FineTuningJob + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, FineTuningJob::class, 'json'); + } + } +} diff --git a/generated/Endpoint/CancelRun.php b/generated/Endpoint/CancelRun.php new file mode 100644 index 0000000..1d91278 --- /dev/null +++ b/generated/Endpoint/CancelRun.php @@ -0,0 +1,66 @@ +thread_id, $this->run_id], '/threads/{thread_id}/runs/{run_id}/cancel'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|RunObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, RunObject::class, 'json'); + } + } +} diff --git a/generated/Endpoint/CreateAssistant.php b/generated/Endpoint/CreateAssistant.php new file mode 100644 index 0000000..1b9a7f9 --- /dev/null +++ b/generated/Endpoint/CreateAssistant.php @@ -0,0 +1,67 @@ +body = $requestBody; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function getUri(): string + { + return '/assistants'; + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + if ($this->body instanceof CreateAssistantRequest) { + return [[ + 'Content-Type' => ['application/json'], + ], $serializer->serialize($this->body, 'json')]; + } + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|AssistantObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, AssistantObject::class, 'json'); + } + } +} diff --git a/generated/Endpoint/CreateAssistantFile.php b/generated/Endpoint/CreateAssistantFile.php new file mode 100644 index 0000000..40d2e92 --- /dev/null +++ b/generated/Endpoint/CreateAssistantFile.php @@ -0,0 +1,72 @@ +body = $requestBody; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function getUri(): string + { + return str_replace(['{assistant_id}'], [$this->assistant_id], '/assistants/{assistant_id}/files'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + if ($this->body instanceof CreateAssistantFileRequest) { + return [[ + 'Content-Type' => ['application/json'], + ], $serializer->serialize($this->body, 'json')]; + } + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|AssistantFileObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, AssistantFileObject::class, 'json'); + } + } +} diff --git a/generated/Endpoint/CreateChatCompletion.php b/generated/Endpoint/CreateChatCompletion.php index 9078c44..d0fdb7a 100644 --- a/generated/Endpoint/CreateChatCompletion.php +++ b/generated/Endpoint/CreateChatCompletion.php @@ -41,9 +41,6 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -53,7 +50,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/CreateCompletion.php b/generated/Endpoint/CreateCompletion.php index fe28e37..a323940 100644 --- a/generated/Endpoint/CreateCompletion.php +++ b/generated/Endpoint/CreateCompletion.php @@ -41,9 +41,6 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -53,7 +50,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/CreateEdit.php b/generated/Endpoint/CreateEdit.php index c59ab39..ec4bd04 100644 --- a/generated/Endpoint/CreateEdit.php +++ b/generated/Endpoint/CreateEdit.php @@ -41,9 +41,6 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -53,7 +50,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/CreateEmbedding.php b/generated/Endpoint/CreateEmbedding.php index c4aba68..954880c 100644 --- a/generated/Endpoint/CreateEmbedding.php +++ b/generated/Endpoint/CreateEmbedding.php @@ -41,9 +41,6 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -53,7 +50,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/CreateFile.php b/generated/Endpoint/CreateFile.php index a9059b1..f4b79c3 100644 --- a/generated/Endpoint/CreateFile.php +++ b/generated/Endpoint/CreateFile.php @@ -42,15 +42,12 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): $bodyBuilder->addResource($key, $value); } return [[ - 'Content-Type' => ['multipart/form-data; boundary="' . ($bodyBuilder->getBoundary() . '""')], + 'Content-Type' => ['multipart/form-data; boundary="' . ($bodyBuilder->getBoundary() . '"')], ], $bodyBuilder->build()]; } return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -60,7 +57,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/CreateFineTune.php b/generated/Endpoint/CreateFineTune.php index 375adf6..2cca07a 100644 --- a/generated/Endpoint/CreateFineTune.php +++ b/generated/Endpoint/CreateFineTune.php @@ -41,9 +41,6 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -53,7 +50,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/CreateFineTuningJob.php b/generated/Endpoint/CreateFineTuningJob.php new file mode 100644 index 0000000..8544094 --- /dev/null +++ b/generated/Endpoint/CreateFineTuningJob.php @@ -0,0 +1,67 @@ +body = $requestBody; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function getUri(): string + { + return '/fine_tuning/jobs'; + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + if ($this->body instanceof CreateFineTuningJobRequest) { + return [[ + 'Content-Type' => ['application/json'], + ], $serializer->serialize($this->body, 'json')]; + } + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|FineTuningJob + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, FineTuningJob::class, 'json'); + } + } +} diff --git a/generated/Endpoint/CreateImage.php b/generated/Endpoint/CreateImage.php index 427b6c6..38c1eea 100644 --- a/generated/Endpoint/CreateImage.php +++ b/generated/Endpoint/CreateImage.php @@ -41,9 +41,6 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -53,7 +50,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/CreateImageEdit.php b/generated/Endpoint/CreateImageEdit.php index faaf163..a74d809 100644 --- a/generated/Endpoint/CreateImageEdit.php +++ b/generated/Endpoint/CreateImageEdit.php @@ -42,15 +42,12 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): $bodyBuilder->addResource($key, $value); } return [[ - 'Content-Type' => ['multipart/form-data; boundary="' . ($bodyBuilder->getBoundary() . '""')], + 'Content-Type' => ['multipart/form-data; boundary="' . ($bodyBuilder->getBoundary() . '"')], ], $bodyBuilder->build()]; } return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -60,7 +57,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/CreateImageVariation.php b/generated/Endpoint/CreateImageVariation.php index 9d9cdf7..7d9727d 100644 --- a/generated/Endpoint/CreateImageVariation.php +++ b/generated/Endpoint/CreateImageVariation.php @@ -42,15 +42,12 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): $bodyBuilder->addResource($key, $value); } return [[ - 'Content-Type' => ['multipart/form-data; boundary="' . ($bodyBuilder->getBoundary() . '""')], + 'Content-Type' => ['multipart/form-data; boundary="' . ($bodyBuilder->getBoundary() . '"')], ], $bodyBuilder->build()]; } return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -60,7 +57,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/CreateMessage.php b/generated/Endpoint/CreateMessage.php new file mode 100644 index 0000000..1318e1b --- /dev/null +++ b/generated/Endpoint/CreateMessage.php @@ -0,0 +1,72 @@ +body = $requestBody; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function getUri(): string + { + return str_replace(['{thread_id}'], [$this->thread_id], '/threads/{thread_id}/messages'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + if ($this->body instanceof CreateMessageRequest) { + return [[ + 'Content-Type' => ['application/json'], + ], $serializer->serialize($this->body, 'json')]; + } + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|MessageObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, MessageObject::class, 'json'); + } + } +} diff --git a/generated/Endpoint/CreateModeration.php b/generated/Endpoint/CreateModeration.php index a0514e8..5fadc98 100644 --- a/generated/Endpoint/CreateModeration.php +++ b/generated/Endpoint/CreateModeration.php @@ -41,9 +41,6 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -53,7 +50,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/CreateRun.php b/generated/Endpoint/CreateRun.php new file mode 100644 index 0000000..e47c8dd --- /dev/null +++ b/generated/Endpoint/CreateRun.php @@ -0,0 +1,72 @@ +body = $requestBody; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function getUri(): string + { + return str_replace(['{thread_id}'], [$this->thread_id], '/threads/{thread_id}/runs'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + if ($this->body instanceof CreateRunRequest) { + return [[ + 'Content-Type' => ['application/json'], + ], $serializer->serialize($this->body, 'json')]; + } + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|RunObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, RunObject::class, 'json'); + } + } +} diff --git a/generated/Endpoint/CreateSpeech.php b/generated/Endpoint/CreateSpeech.php new file mode 100644 index 0000000..df3a07f --- /dev/null +++ b/generated/Endpoint/CreateSpeech.php @@ -0,0 +1,62 @@ +body = $requestBody; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function getUri(): string + { + return '/audio/speech'; + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + if ($this->body instanceof CreateSpeechRequest) { + return [[ + 'Content-Type' => ['application/json'], + ], $serializer->serialize($this->body, 'json')]; + } + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/octet-stream'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if ($status === 200) { + } + } +} diff --git a/generated/Endpoint/CreateThread.php b/generated/Endpoint/CreateThread.php new file mode 100644 index 0000000..6ecd3d3 --- /dev/null +++ b/generated/Endpoint/CreateThread.php @@ -0,0 +1,67 @@ +body = $requestBody; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function getUri(): string + { + return '/threads'; + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + if ($this->body instanceof CreateThreadRequest) { + return [[ + 'Content-Type' => ['application/json'], + ], $serializer->serialize($this->body, 'json')]; + } + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|ThreadObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, ThreadObject::class, 'json'); + } + } +} diff --git a/generated/Endpoint/CreateThreadAndRun.php b/generated/Endpoint/CreateThreadAndRun.php new file mode 100644 index 0000000..59cfa93 --- /dev/null +++ b/generated/Endpoint/CreateThreadAndRun.php @@ -0,0 +1,67 @@ +body = $requestBody; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function getUri(): string + { + return '/threads/runs'; + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + if ($this->body instanceof CreateThreadAndRunRequest) { + return [[ + 'Content-Type' => ['application/json'], + ], $serializer->serialize($this->body, 'json')]; + } + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|RunObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, RunObject::class, 'json'); + } + } +} diff --git a/generated/Endpoint/CreateTranscription.php b/generated/Endpoint/CreateTranscription.php index c43fc6e..809818a 100644 --- a/generated/Endpoint/CreateTranscription.php +++ b/generated/Endpoint/CreateTranscription.php @@ -42,15 +42,12 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): $bodyBuilder->addResource($key, $value); } return [[ - 'Content-Type' => ['multipart/form-data; boundary="' . ($bodyBuilder->getBoundary() . '""')], + 'Content-Type' => ['multipart/form-data; boundary="' . ($bodyBuilder->getBoundary() . '"')], ], $bodyBuilder->build()]; } return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -60,7 +57,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/CreateTranslation.php b/generated/Endpoint/CreateTranslation.php index 1160341..82af050 100644 --- a/generated/Endpoint/CreateTranslation.php +++ b/generated/Endpoint/CreateTranslation.php @@ -42,15 +42,12 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): $bodyBuilder->addResource($key, $value); } return [[ - 'Content-Type' => ['multipart/form-data; boundary="' . ($bodyBuilder->getBoundary() . '""')], + 'Content-Type' => ['multipart/form-data; boundary="' . ($bodyBuilder->getBoundary() . '"')], ], $bodyBuilder->build()]; } return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -60,7 +57,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/DeleteAssistant.php b/generated/Endpoint/DeleteAssistant.php new file mode 100644 index 0000000..e584ee7 --- /dev/null +++ b/generated/Endpoint/DeleteAssistant.php @@ -0,0 +1,64 @@ +assistant_id], '/assistants/{assistant_id}'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|DeleteAssistantResponse + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, DeleteAssistantResponse::class, 'json'); + } + } +} diff --git a/generated/Endpoint/DeleteAssistantFile.php b/generated/Endpoint/DeleteAssistantFile.php new file mode 100644 index 0000000..f568b9d --- /dev/null +++ b/generated/Endpoint/DeleteAssistantFile.php @@ -0,0 +1,66 @@ +assistant_id, $this->file_id], '/assistants/{assistant_id}/files/{file_id}'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|DeleteAssistantFileResponse + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, DeleteAssistantFileResponse::class, 'json'); + } + } +} diff --git a/generated/Endpoint/DeleteFile.php b/generated/Endpoint/DeleteFile.php index e5bef07..50428c8 100644 --- a/generated/Endpoint/DeleteFile.php +++ b/generated/Endpoint/DeleteFile.php @@ -16,7 +16,7 @@ class DeleteFile extends BaseEndpoint implements Endpoint use EndpointTrait; /** - * @param string $file_id The ID of the file to use for this request + * @param string $file_id The ID of the file to use for this request. */ public function __construct( protected string $file_id @@ -38,9 +38,6 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -50,7 +47,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/DeleteModel.php b/generated/Endpoint/DeleteModel.php index ad4394a..e487a94 100644 --- a/generated/Endpoint/DeleteModel.php +++ b/generated/Endpoint/DeleteModel.php @@ -38,9 +38,6 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -50,7 +47,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/DeleteThread.php b/generated/Endpoint/DeleteThread.php new file mode 100644 index 0000000..18fb562 --- /dev/null +++ b/generated/Endpoint/DeleteThread.php @@ -0,0 +1,64 @@ +thread_id], '/threads/{thread_id}'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|DeleteThreadResponse + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, DeleteThreadResponse::class, 'json'); + } + } +} diff --git a/generated/Endpoint/DownloadFile.php b/generated/Endpoint/DownloadFile.php index 6632483..235bb53 100644 --- a/generated/Endpoint/DownloadFile.php +++ b/generated/Endpoint/DownloadFile.php @@ -15,7 +15,7 @@ class DownloadFile extends BaseEndpoint implements Endpoint use EndpointTrait; /** - * @param string $file_id The ID of the file to use for this request + * @param string $file_id The ID of the file to use for this request. */ public function __construct( protected string $file_id @@ -37,9 +37,6 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -49,7 +46,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) @@ -57,7 +54,7 @@ protected function transformResponseBody(ResponseInterface $response, Serializer $status = $response->getStatusCode(); $body = (string) $response->getBody(); if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { - return json_decode($body, null, 512, JSON_THROW_ON_ERROR); + return json_decode($body); } } } diff --git a/generated/Endpoint/GetAssistant.php b/generated/Endpoint/GetAssistant.php new file mode 100644 index 0000000..72a6a14 --- /dev/null +++ b/generated/Endpoint/GetAssistant.php @@ -0,0 +1,64 @@ +assistant_id], '/assistants/{assistant_id}'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|AssistantObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, AssistantObject::class, 'json'); + } + } +} diff --git a/generated/Endpoint/GetAssistantFile.php b/generated/Endpoint/GetAssistantFile.php new file mode 100644 index 0000000..a13b00e --- /dev/null +++ b/generated/Endpoint/GetAssistantFile.php @@ -0,0 +1,66 @@ +assistant_id, $this->file_id], '/assistants/{assistant_id}/files/{file_id}'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|AssistantFileObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, AssistantFileObject::class, 'json'); + } + } +} diff --git a/generated/Endpoint/GetMessage.php b/generated/Endpoint/GetMessage.php new file mode 100644 index 0000000..3aa80a0 --- /dev/null +++ b/generated/Endpoint/GetMessage.php @@ -0,0 +1,66 @@ +thread_id, $this->message_id], '/threads/{thread_id}/messages/{message_id}'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|MessageObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, MessageObject::class, 'json'); + } + } +} diff --git a/generated/Endpoint/GetMessageFile.php b/generated/Endpoint/GetMessageFile.php new file mode 100644 index 0000000..55a2287 --- /dev/null +++ b/generated/Endpoint/GetMessageFile.php @@ -0,0 +1,68 @@ +thread_id, $this->message_id, $this->file_id], '/threads/{thread_id}/messages/{message_id}/files/{file_id}'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|MessageFileObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, MessageFileObject::class, 'json'); + } + } +} diff --git a/generated/Endpoint/GetRun.php b/generated/Endpoint/GetRun.php new file mode 100644 index 0000000..c1086b1 --- /dev/null +++ b/generated/Endpoint/GetRun.php @@ -0,0 +1,66 @@ +thread_id, $this->run_id], '/threads/{thread_id}/runs/{run_id}'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|RunObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, RunObject::class, 'json'); + } + } +} diff --git a/generated/Endpoint/GetRunStep.php b/generated/Endpoint/GetRunStep.php new file mode 100644 index 0000000..c47d6f8 --- /dev/null +++ b/generated/Endpoint/GetRunStep.php @@ -0,0 +1,68 @@ +thread_id, $this->run_id, $this->step_id], '/threads/{thread_id}/runs/{run_id}/steps/{step_id}'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|RunStepObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, RunStepObject::class, 'json'); + } + } +} diff --git a/generated/Endpoint/GetThread.php b/generated/Endpoint/GetThread.php new file mode 100644 index 0000000..325a5d0 --- /dev/null +++ b/generated/Endpoint/GetThread.php @@ -0,0 +1,64 @@ +thread_id], '/threads/{thread_id}'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|ThreadObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, ThreadObject::class, 'json'); + } + } +} diff --git a/generated/Endpoint/ListAssistantFiles.php b/generated/Endpoint/ListAssistantFiles.php new file mode 100644 index 0000000..2801239 --- /dev/null +++ b/generated/Endpoint/ListAssistantFiles.php @@ -0,0 +1,89 @@ +queryParameters = $queryParameters; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function getUri(): string + { + return str_replace(['{assistant_id}'], [$this->assistant_id], '/assistants/{assistant_id}/files'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + protected function getQueryOptionsResolver(): OptionsResolver + { + $optionsResolver = parent::getQueryOptionsResolver(); + $optionsResolver->setDefined(['limit', 'order', 'after', 'before']); + $optionsResolver->setRequired([]); + $optionsResolver->setDefaults([ + 'limit' => 20, + 'order' => 'desc', + ]); + $optionsResolver->addAllowedTypes('limit', ['int']); + $optionsResolver->addAllowedTypes('order', ['string']); + $optionsResolver->addAllowedTypes('after', ['string']); + $optionsResolver->addAllowedTypes('before', ['string']); + return $optionsResolver; + } + + /** + * @return null|ListAssistantFilesResponse + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, ListAssistantFilesResponse::class, 'json'); + } + } +} diff --git a/generated/Endpoint/ListAssistants.php b/generated/Endpoint/ListAssistants.php new file mode 100644 index 0000000..c98edd4 --- /dev/null +++ b/generated/Endpoint/ListAssistants.php @@ -0,0 +1,86 @@ +queryParameters = $queryParameters; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function getUri(): string + { + return '/assistants'; + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + protected function getQueryOptionsResolver(): OptionsResolver + { + $optionsResolver = parent::getQueryOptionsResolver(); + $optionsResolver->setDefined(['limit', 'order', 'after', 'before']); + $optionsResolver->setRequired([]); + $optionsResolver->setDefaults([ + 'limit' => 20, + 'order' => 'desc', + ]); + $optionsResolver->addAllowedTypes('limit', ['int']); + $optionsResolver->addAllowedTypes('order', ['string']); + $optionsResolver->addAllowedTypes('after', ['string']); + $optionsResolver->addAllowedTypes('before', ['string']); + return $optionsResolver; + } + + /** + * @return null|ListAssistantsResponse + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, ListAssistantsResponse::class, 'json'); + } + } +} diff --git a/generated/Endpoint/ListFiles.php b/generated/Endpoint/ListFiles.php index 9aa2074..032728e 100644 --- a/generated/Endpoint/ListFiles.php +++ b/generated/Endpoint/ListFiles.php @@ -9,12 +9,23 @@ use Sourceability\OpenAIClient\Generated\Runtime\Client\BaseEndpoint; use Sourceability\OpenAIClient\Generated\Runtime\Client\Endpoint; use Sourceability\OpenAIClient\Generated\Runtime\Client\EndpointTrait; +use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Serializer\SerializerInterface; class ListFiles extends BaseEndpoint implements Endpoint { use EndpointTrait; + /** + * @param array $queryParameters { + * @var string Only return files with the given purpose. + * } + */ + public function __construct(array $queryParameters = []) + { + $this->queryParameters = $queryParameters; + } + public function getMethod(): string { return 'GET'; @@ -30,9 +41,6 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -42,7 +50,17 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; + } + + protected function getQueryOptionsResolver(): OptionsResolver + { + $optionsResolver = parent::getQueryOptionsResolver(); + $optionsResolver->setDefined(['purpose']); + $optionsResolver->setRequired([]); + $optionsResolver->setDefaults([]); + $optionsResolver->addAllowedTypes('purpose', ['string']); + return $optionsResolver; } /** diff --git a/generated/Endpoint/ListFineTuneEvents.php b/generated/Endpoint/ListFineTuneEvents.php index 96ea4b4..4ce2319 100644 --- a/generated/Endpoint/ListFineTuneEvents.php +++ b/generated/Endpoint/ListFineTuneEvents.php @@ -21,6 +21,7 @@ class ListFineTuneEvents extends BaseEndpoint implements Endpoint * @param array $queryParameters { * @var bool Whether to stream events for the fine-tune job. If set to true, If set to false, only events generated so far will be returned. + * } */ public function __construct( @@ -45,9 +46,6 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -57,7 +55,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } protected function getQueryOptionsResolver(): OptionsResolver diff --git a/generated/Endpoint/ListFineTunes.php b/generated/Endpoint/ListFineTunes.php index 7635677..b34db38 100644 --- a/generated/Endpoint/ListFineTunes.php +++ b/generated/Endpoint/ListFineTunes.php @@ -30,9 +30,6 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -42,7 +39,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/ListFineTuningEvents.php b/generated/Endpoint/ListFineTuningEvents.php new file mode 100644 index 0000000..4ea19c7 --- /dev/null +++ b/generated/Endpoint/ListFineTuningEvents.php @@ -0,0 +1,84 @@ +queryParameters = $queryParameters; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function getUri(): string + { + return str_replace(['{fine_tuning_job_id}'], [$this->fine_tuning_job_id], '/fine_tuning/jobs/{fine_tuning_job_id}/events'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + protected function getQueryOptionsResolver(): OptionsResolver + { + $optionsResolver = parent::getQueryOptionsResolver(); + $optionsResolver->setDefined(['after', 'limit']); + $optionsResolver->setRequired([]); + $optionsResolver->setDefaults([ + 'limit' => 20, + ]); + $optionsResolver->addAllowedTypes('after', ['string']); + $optionsResolver->addAllowedTypes('limit', ['int']); + return $optionsResolver; + } + + /** + * @return null|ListFineTuningJobEventsResponse + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, ListFineTuningJobEventsResponse::class, 'json'); + } + } +} diff --git a/generated/Endpoint/ListMessageFiles.php b/generated/Endpoint/ListMessageFiles.php new file mode 100644 index 0000000..e18fb78 --- /dev/null +++ b/generated/Endpoint/ListMessageFiles.php @@ -0,0 +1,91 @@ +queryParameters = $queryParameters; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function getUri(): string + { + return str_replace(['{thread_id}', '{message_id}'], [$this->thread_id, $this->message_id], '/threads/{thread_id}/messages/{message_id}/files'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + protected function getQueryOptionsResolver(): OptionsResolver + { + $optionsResolver = parent::getQueryOptionsResolver(); + $optionsResolver->setDefined(['limit', 'order', 'after', 'before']); + $optionsResolver->setRequired([]); + $optionsResolver->setDefaults([ + 'limit' => 20, + 'order' => 'desc', + ]); + $optionsResolver->addAllowedTypes('limit', ['int']); + $optionsResolver->addAllowedTypes('order', ['string']); + $optionsResolver->addAllowedTypes('after', ['string']); + $optionsResolver->addAllowedTypes('before', ['string']); + return $optionsResolver; + } + + /** + * @return null|ListMessageFilesResponse + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, ListMessageFilesResponse::class, 'json'); + } + } +} diff --git a/generated/Endpoint/ListMessages.php b/generated/Endpoint/ListMessages.php new file mode 100644 index 0000000..bdbb4d1 --- /dev/null +++ b/generated/Endpoint/ListMessages.php @@ -0,0 +1,89 @@ +queryParameters = $queryParameters; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function getUri(): string + { + return str_replace(['{thread_id}'], [$this->thread_id], '/threads/{thread_id}/messages'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + protected function getQueryOptionsResolver(): OptionsResolver + { + $optionsResolver = parent::getQueryOptionsResolver(); + $optionsResolver->setDefined(['limit', 'order', 'after', 'before']); + $optionsResolver->setRequired([]); + $optionsResolver->setDefaults([ + 'limit' => 20, + 'order' => 'desc', + ]); + $optionsResolver->addAllowedTypes('limit', ['int']); + $optionsResolver->addAllowedTypes('order', ['string']); + $optionsResolver->addAllowedTypes('after', ['string']); + $optionsResolver->addAllowedTypes('before', ['string']); + return $optionsResolver; + } + + /** + * @return null|ListMessagesResponse + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, ListMessagesResponse::class, 'json'); + } + } +} diff --git a/generated/Endpoint/ListModels.php b/generated/Endpoint/ListModels.php index 70f3485..017eb38 100644 --- a/generated/Endpoint/ListModels.php +++ b/generated/Endpoint/ListModels.php @@ -30,9 +30,6 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -42,7 +39,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/ListPaginatedFineTuningJobs.php b/generated/Endpoint/ListPaginatedFineTuningJobs.php new file mode 100644 index 0000000..1964f9a --- /dev/null +++ b/generated/Endpoint/ListPaginatedFineTuningJobs.php @@ -0,0 +1,81 @@ +queryParameters = $queryParameters; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function getUri(): string + { + return '/fine_tuning/jobs'; + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + protected function getQueryOptionsResolver(): OptionsResolver + { + $optionsResolver = parent::getQueryOptionsResolver(); + $optionsResolver->setDefined(['after', 'limit']); + $optionsResolver->setRequired([]); + $optionsResolver->setDefaults([ + 'limit' => 20, + ]); + $optionsResolver->addAllowedTypes('after', ['string']); + $optionsResolver->addAllowedTypes('limit', ['int']); + return $optionsResolver; + } + + /** + * @return null|ListPaginatedFineTuningJobsResponse + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, ListPaginatedFineTuningJobsResponse::class, 'json'); + } + } +} diff --git a/generated/Endpoint/ListRunSteps.php b/generated/Endpoint/ListRunSteps.php new file mode 100644 index 0000000..0ebf552 --- /dev/null +++ b/generated/Endpoint/ListRunSteps.php @@ -0,0 +1,91 @@ +queryParameters = $queryParameters; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function getUri(): string + { + return str_replace(['{thread_id}', '{run_id}'], [$this->thread_id, $this->run_id], '/threads/{thread_id}/runs/{run_id}/steps'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + protected function getQueryOptionsResolver(): OptionsResolver + { + $optionsResolver = parent::getQueryOptionsResolver(); + $optionsResolver->setDefined(['limit', 'order', 'after', 'before']); + $optionsResolver->setRequired([]); + $optionsResolver->setDefaults([ + 'limit' => 20, + 'order' => 'desc', + ]); + $optionsResolver->addAllowedTypes('limit', ['int']); + $optionsResolver->addAllowedTypes('order', ['string']); + $optionsResolver->addAllowedTypes('after', ['string']); + $optionsResolver->addAllowedTypes('before', ['string']); + return $optionsResolver; + } + + /** + * @return null|ListRunStepsResponse + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, ListRunStepsResponse::class, 'json'); + } + } +} diff --git a/generated/Endpoint/ListRuns.php b/generated/Endpoint/ListRuns.php new file mode 100644 index 0000000..0cdca48 --- /dev/null +++ b/generated/Endpoint/ListRuns.php @@ -0,0 +1,89 @@ +queryParameters = $queryParameters; + } + + public function getMethod(): string + { + return 'GET'; + } + + public function getUri(): string + { + return str_replace(['{thread_id}'], [$this->thread_id], '/threads/{thread_id}/runs'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + protected function getQueryOptionsResolver(): OptionsResolver + { + $optionsResolver = parent::getQueryOptionsResolver(); + $optionsResolver->setDefined(['limit', 'order', 'after', 'before']); + $optionsResolver->setRequired([]); + $optionsResolver->setDefaults([ + 'limit' => 20, + 'order' => 'desc', + ]); + $optionsResolver->addAllowedTypes('limit', ['int']); + $optionsResolver->addAllowedTypes('order', ['string']); + $optionsResolver->addAllowedTypes('after', ['string']); + $optionsResolver->addAllowedTypes('before', ['string']); + return $optionsResolver; + } + + /** + * @return null|ListRunsResponse + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, ListRunsResponse::class, 'json'); + } + } +} diff --git a/generated/Endpoint/ModifyAssistant.php b/generated/Endpoint/ModifyAssistant.php new file mode 100644 index 0000000..428067e --- /dev/null +++ b/generated/Endpoint/ModifyAssistant.php @@ -0,0 +1,72 @@ +body = $requestBody; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function getUri(): string + { + return str_replace(['{assistant_id}'], [$this->assistant_id], '/assistants/{assistant_id}'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + if ($this->body instanceof ModifyAssistantRequest) { + return [[ + 'Content-Type' => ['application/json'], + ], $serializer->serialize($this->body, 'json')]; + } + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|AssistantObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, AssistantObject::class, 'json'); + } + } +} diff --git a/generated/Endpoint/ModifyMessage.php b/generated/Endpoint/ModifyMessage.php new file mode 100644 index 0000000..043dd70 --- /dev/null +++ b/generated/Endpoint/ModifyMessage.php @@ -0,0 +1,74 @@ +body = $requestBody; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function getUri(): string + { + return str_replace(['{thread_id}', '{message_id}'], [$this->thread_id, $this->message_id], '/threads/{thread_id}/messages/{message_id}'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + if ($this->body instanceof ModifyMessageRequest) { + return [[ + 'Content-Type' => ['application/json'], + ], $serializer->serialize($this->body, 'json')]; + } + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|MessageObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, MessageObject::class, 'json'); + } + } +} diff --git a/generated/Endpoint/ModifyRun.php b/generated/Endpoint/ModifyRun.php new file mode 100644 index 0000000..35f2ab9 --- /dev/null +++ b/generated/Endpoint/ModifyRun.php @@ -0,0 +1,74 @@ +body = $requestBody; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function getUri(): string + { + return str_replace(['{thread_id}', '{run_id}'], [$this->thread_id, $this->run_id], '/threads/{thread_id}/runs/{run_id}'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + if ($this->body instanceof ModifyRunRequest) { + return [[ + 'Content-Type' => ['application/json'], + ], $serializer->serialize($this->body, 'json')]; + } + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|RunObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, RunObject::class, 'json'); + } + } +} diff --git a/generated/Endpoint/ModifyThread.php b/generated/Endpoint/ModifyThread.php new file mode 100644 index 0000000..07470c8 --- /dev/null +++ b/generated/Endpoint/ModifyThread.php @@ -0,0 +1,72 @@ +body = $requestBody; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function getUri(): string + { + return str_replace(['{thread_id}'], [$this->thread_id], '/threads/{thread_id}'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + if ($this->body instanceof ModifyThreadRequest) { + return [[ + 'Content-Type' => ['application/json'], + ], $serializer->serialize($this->body, 'json')]; + } + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|ThreadObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, ThreadObject::class, 'json'); + } + } +} diff --git a/generated/Endpoint/RetrieveFile.php b/generated/Endpoint/RetrieveFile.php index afb0d91..ec217ad 100644 --- a/generated/Endpoint/RetrieveFile.php +++ b/generated/Endpoint/RetrieveFile.php @@ -16,7 +16,7 @@ class RetrieveFile extends BaseEndpoint implements Endpoint use EndpointTrait; /** - * @param string $file_id The ID of the file to use for this request + * @param string $file_id The ID of the file to use for this request. */ public function __construct( protected string $file_id @@ -38,9 +38,6 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -50,7 +47,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/RetrieveFineTune.php b/generated/Endpoint/RetrieveFineTune.php index d7742ee..d33c917 100644 --- a/generated/Endpoint/RetrieveFineTune.php +++ b/generated/Endpoint/RetrieveFineTune.php @@ -38,9 +38,6 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -50,7 +47,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/RetrieveFineTuningJob.php b/generated/Endpoint/RetrieveFineTuningJob.php new file mode 100644 index 0000000..3b570c5 --- /dev/null +++ b/generated/Endpoint/RetrieveFineTuningJob.php @@ -0,0 +1,64 @@ +fine_tuning_job_id], '/fine_tuning/jobs/{fine_tuning_job_id}'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|FineTuningJob + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, FineTuningJob::class, 'json'); + } + } +} diff --git a/generated/Endpoint/RetrieveModel.php b/generated/Endpoint/RetrieveModel.php index 1c4c547..5169dac 100644 --- a/generated/Endpoint/RetrieveModel.php +++ b/generated/Endpoint/RetrieveModel.php @@ -38,9 +38,6 @@ public function getBody(SerializerInterface $serializer, $streamFactory = null): return [[], null]; } - /** - * @return array{Accept: string[]} - */ public function getExtraHeaders(): array { return [ @@ -50,7 +47,7 @@ public function getExtraHeaders(): array public function getAuthenticationScopes(): array { - return []; + return ['ApiKeyAuth']; } /** diff --git a/generated/Endpoint/SubmitToolOuputsToRun.php b/generated/Endpoint/SubmitToolOuputsToRun.php new file mode 100644 index 0000000..7fac1eb --- /dev/null +++ b/generated/Endpoint/SubmitToolOuputsToRun.php @@ -0,0 +1,74 @@ +body = $requestBody; + } + + public function getMethod(): string + { + return 'POST'; + } + + public function getUri(): string + { + return str_replace(['{thread_id}', '{run_id}'], [$this->thread_id, $this->run_id], '/threads/{thread_id}/runs/{run_id}/submit_tool_outputs'); + } + + public function getBody(SerializerInterface $serializer, $streamFactory = null): array + { + if ($this->body instanceof SubmitToolOutputsRunRequest) { + return [[ + 'Content-Type' => ['application/json'], + ], $serializer->serialize($this->body, 'json')]; + } + return [[], null]; + } + + public function getExtraHeaders(): array + { + return [ + 'Accept' => ['application/json'], + ]; + } + + public function getAuthenticationScopes(): array + { + return ['ApiKeyAuth']; + } + + /** + * @return null|RunObject + */ + protected function transformResponseBody(ResponseInterface $response, SerializerInterface $serializer, ?string $contentType = null) + { + $status = $response->getStatusCode(); + $body = (string) $response->getBody(); + if (($contentType === null) === false && ($status === 200 && mb_strpos($contentType, 'application/json') !== false)) { + return $serializer->deserialize($body, RunObject::class, 'json'); + } + } +} diff --git a/generated/Model/AssistantFileObject.php b/generated/Model/AssistantFileObject.php new file mode 100644 index 0000000..bafc93f --- /dev/null +++ b/generated/Model/AssistantFileObject.php @@ -0,0 +1,131 @@ +setId($id); + } + if ($object !== null) { + $this->setObject($object); + } + if ($createdAt !== null) { + $this->setCreatedAt($createdAt); + } + if ($assistantId !== null) { + $this->setAssistantId($assistantId); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The identifier, which can be referenced in API endpoints. + */ + public function getId(): string + { + return $this->id; + } + + /** + * The identifier, which can be referenced in API endpoints. + */ + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + /** + * The object type, which is always `assistant.file`. + */ + public function getObject(): string + { + return $this->object; + } + + /** + * The object type, which is always `assistant.file`. + */ + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * The Unix timestamp (in seconds) for when the assistant file was created. + */ + public function getCreatedAt(): int + { + return $this->createdAt; + } + + /** + * The Unix timestamp (in seconds) for when the assistant file was created. + */ + public function setCreatedAt(int $createdAt): self + { + $this->initialized['createdAt'] = true; + $this->createdAt = $createdAt; + return $this; + } + + /** + * The assistant ID that the file is attached to. + */ + public function getAssistantId(): string + { + return $this->assistantId; + } + + /** + * The assistant ID that the file is attached to. + */ + public function setAssistantId(string $assistantId): self + { + $this->initialized['assistantId'] = true; + $this->assistantId = $assistantId; + return $this; + } +} diff --git a/generated/Model/AssistantObject.php b/generated/Model/AssistantObject.php new file mode 100644 index 0000000..8b43bb2 --- /dev/null +++ b/generated/Model/AssistantObject.php @@ -0,0 +1,311 @@ +|null + */ + protected $metadata = null; + + /** + * @param string $id The identifier, which can be referenced in API endpoints. + * @param string $object The object type, which is always `assistant`. + * @param int $createdAt The Unix timestamp (in seconds) for when the assistant was created. + * @param string|null $name The name of the assistant. The maximum length is 256 characters. + * @param string|null $description The description of the assistant. The maximum length is 512 characters. + * @param string $model ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + * @param string|null $instructions The system instructions that the assistant uses. The maximum length is 32768 characters. + * @param mixed[] $tools A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. + * @param string[] $fileIds A list of [file](/docs/api-reference/files) IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. + * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + */ + public function __construct($id = null, $object = null, $createdAt = null, $name = null, $description = null, $model = null, $instructions = null, $tools = [], $fileIds = [], $metadata = null) + { + if ($id !== null) { + $this->setId($id); + } + if ($object !== null) { + $this->setObject($object); + } + if ($createdAt !== null) { + $this->setCreatedAt($createdAt); + } + if ($name !== null) { + $this->setName($name); + } + if ($description !== null) { + $this->setDescription($description); + } + if ($model !== null) { + $this->setModel($model); + } + if ($instructions !== null) { + $this->setInstructions($instructions); + } + if ($tools !== null) { + $this->setTools($tools); + } + if ($fileIds !== null) { + $this->setFileIds($fileIds); + } + if ($metadata !== null) { + $this->setMetadata($metadata); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The identifier, which can be referenced in API endpoints. + */ + public function getId(): string + { + return $this->id; + } + + /** + * The identifier, which can be referenced in API endpoints. + */ + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + /** + * The object type, which is always `assistant`. + */ + public function getObject(): string + { + return $this->object; + } + + /** + * The object type, which is always `assistant`. + */ + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * The Unix timestamp (in seconds) for when the assistant was created. + */ + public function getCreatedAt(): int + { + return $this->createdAt; + } + + /** + * The Unix timestamp (in seconds) for when the assistant was created. + */ + public function setCreatedAt(int $createdAt): self + { + $this->initialized['createdAt'] = true; + $this->createdAt = $createdAt; + return $this; + } + + /** + * The name of the assistant. The maximum length is 256 characters. + */ + public function getName(): ?string + { + return $this->name; + } + + /** + * The name of the assistant. The maximum length is 256 characters. + */ + public function setName(?string $name): self + { + $this->initialized['name'] = true; + $this->name = $name; + return $this; + } + + /** + * The description of the assistant. The maximum length is 512 characters. + */ + public function getDescription(): ?string + { + return $this->description; + } + + /** + * The description of the assistant. The maximum length is 512 characters. + */ + public function setDescription(?string $description): self + { + $this->initialized['description'] = true; + $this->description = $description; + return $this; + } + + /** + * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + */ + public function getModel(): string + { + return $this->model; + } + + /** + * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + */ + public function setModel(string $model): self + { + $this->initialized['model'] = true; + $this->model = $model; + return $this; + } + + /** + * The system instructions that the assistant uses. The maximum length is 32768 characters. + */ + public function getInstructions(): ?string + { + return $this->instructions; + } + + /** + * The system instructions that the assistant uses. The maximum length is 32768 characters. + */ + public function setInstructions(?string $instructions): self + { + $this->initialized['instructions'] = true; + $this->instructions = $instructions; + return $this; + } + + /** + * A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. + * + * @return mixed[] + */ + public function getTools(): array + { + return $this->tools; + } + + /** + * A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. + * + * @param mixed[] $tools + */ + public function setTools(array $tools): self + { + $this->initialized['tools'] = true; + $this->tools = $tools; + return $this; + } + + /** + * A list of [file](/docs/api-reference/files) IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. + * + * @return string[] + */ + public function getFileIds(): array + { + return $this->fileIds; + } + + /** + * A list of [file](/docs/api-reference/files) IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. + * + * @param string[] $fileIds + */ + public function setFileIds(array $fileIds): self + { + $this->initialized['fileIds'] = true; + $this->fileIds = $fileIds; + return $this; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @return array|null + */ + public function getMetadata(): ?iterable + { + return $this->metadata; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @param array|null $metadata + */ + public function setMetadata(?iterable $metadata): self + { + $this->initialized['metadata'] = true; + $this->metadata = $metadata; + return $this; + } +} diff --git a/generated/Model/AssistantToolsCode.php b/generated/Model/AssistantToolsCode.php new file mode 100644 index 0000000..af22e24 --- /dev/null +++ b/generated/Model/AssistantToolsCode.php @@ -0,0 +1,50 @@ +setType($type); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The type of tool being defined: `code_interpreter` + */ + public function getType(): string + { + return $this->type; + } + + /** + * The type of tool being defined: `code_interpreter` + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } +} diff --git a/generated/Model/AssistantToolsFunction.php b/generated/Model/AssistantToolsFunction.php new file mode 100644 index 0000000..ca98d3e --- /dev/null +++ b/generated/Model/AssistantToolsFunction.php @@ -0,0 +1,68 @@ +setType($type); + } + if ($function !== null) { + $this->setFunction($function); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The type of tool being defined: `function` + */ + public function getType(): string + { + return $this->type; + } + + /** + * The type of tool being defined: `function` + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + public function getFunction(): FunctionObject + { + return $this->function; + } + + public function setFunction(FunctionObject $function): self + { + $this->initialized['function'] = true; + $this->function = $function; + return $this; + } +} diff --git a/generated/Model/AssistantToolsRetrieval.php b/generated/Model/AssistantToolsRetrieval.php new file mode 100644 index 0000000..bc67643 --- /dev/null +++ b/generated/Model/AssistantToolsRetrieval.php @@ -0,0 +1,50 @@ +setType($type); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The type of tool being defined: `retrieval` + */ + public function getType(): string + { + return $this->type; + } + + /** + * The type of tool being defined: `retrieval` + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } +} diff --git a/generated/Model/ChatCompletionFunctionCallOption.php b/generated/Model/ChatCompletionFunctionCallOption.php new file mode 100644 index 0000000..c6958f1 --- /dev/null +++ b/generated/Model/ChatCompletionFunctionCallOption.php @@ -0,0 +1,50 @@ +setName($name); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The name of the function to call. + */ + public function getName(): string + { + return $this->name; + } + + /** + * The name of the function to call. + */ + public function setName(string $name): self + { + $this->initialized['name'] = true; + $this->name = $name; + return $this; + } +} diff --git a/generated/Model/ChatCompletionFunctions.php b/generated/Model/ChatCompletionFunctions.php index 60915ce..60d97a5 100644 --- a/generated/Model/ChatCompletionFunctions.php +++ b/generated/Model/ChatCompletionFunctions.php @@ -6,40 +6,45 @@ use ArrayObject; +/** + * @deprecated + */ class ChatCompletionFunctions extends ArrayObject { protected array $initialized = []; /** - * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + * A description of what the function does, used by the model to choose when and how to call the function. */ - protected ?string $name = null; + protected ?string $description = null; /** - * The description of what the function does. + * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. */ - protected ?string $description = null; + protected ?string $name = null; /** - * The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/gpt/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + * The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/text-generation/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + * - * @var mixed[]|null + * @var array */ protected ?iterable $parameters = null; /** + * @param string $description A description of what the function does, used by the model to choose when and how to call the function. * @param string $name The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. - * @param string $description The description of what the function does. - * @param mixed[] $parameters The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/gpt/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + * @param array $parameters The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/text-generation/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + * Omitting `parameters` defines a function with an empty parameter list. */ - public function __construct($name = null, $description = null, $parameters = null) + public function __construct($description = null, $name = null, $parameters = null) { - if ($name !== null) { - $this->setName($name); - } if ($description !== null) { $this->setDescription($description); } + if ($name !== null) { + $this->setName($name); + } if ($parameters !== null) { $this->setParameters($parameters); } @@ -51,45 +56,46 @@ public function isInitialized($property): bool } /** - * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + * A description of what the function does, used by the model to choose when and how to call the function. */ - public function getName(): string + public function getDescription(): string { - return $this->name; + return $this->description; } /** - * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + * A description of what the function does, used by the model to choose when and how to call the function. */ - public function setName(string $name): self + public function setDescription(string $description): self { - $this->initialized['name'] = true; - $this->name = $name; + $this->initialized['description'] = true; + $this->description = $description; return $this; } /** - * The description of what the function does. + * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. */ - public function getDescription(): string + public function getName(): string { - return $this->description; + return $this->name; } /** - * The description of what the function does. + * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. */ - public function setDescription(string $description): self + public function setName(string $name): self { - $this->initialized['description'] = true; - $this->description = $description; + $this->initialized['name'] = true; + $this->name = $name; return $this; } /** - * The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/gpt/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + * The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/text-generation/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + * - * @return mixed[] + * @return array */ public function getParameters(): iterable { @@ -97,9 +103,10 @@ public function getParameters(): iterable } /** - * The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/gpt/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + * The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/text-generation/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + * - * @param mixed[] $parameters + * @param array $parameters */ public function setParameters(iterable $parameters): self { diff --git a/generated/Model/ChatCompletionMessageToolCall.php b/generated/Model/ChatCompletionMessageToolCall.php new file mode 100644 index 0000000..e74d64f --- /dev/null +++ b/generated/Model/ChatCompletionMessageToolCall.php @@ -0,0 +1,104 @@ +setId($id); + } + if ($type !== null) { + $this->setType($type); + } + if ($function !== null) { + $this->setFunction($function); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The ID of the tool call. + */ + public function getId(): string + { + return $this->id; + } + + /** + * The ID of the tool call. + */ + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + /** + * The type of the tool. Currently, only `function` is supported. + */ + public function getType(): string + { + return $this->type; + } + + /** + * The type of the tool. Currently, only `function` is supported. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + /** + * The function that the model called. + */ + public function getFunction(): ChatCompletionMessageToolCallFunction + { + return $this->function; + } + + /** + * The function that the model called. + */ + public function setFunction(ChatCompletionMessageToolCallFunction $function): self + { + $this->initialized['function'] = true; + $this->function = $function; + return $this; + } +} diff --git a/generated/Model/ChatCompletionMessageToolCallChunk.php b/generated/Model/ChatCompletionMessageToolCallChunk.php new file mode 100644 index 0000000..5af8a47 --- /dev/null +++ b/generated/Model/ChatCompletionMessageToolCallChunk.php @@ -0,0 +1,113 @@ +setIndex($index); + } + if ($id !== null) { + $this->setId($id); + } + if ($type !== null) { + $this->setType($type); + } + if ($function !== null) { + $this->setFunction($function); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + public function getIndex(): int + { + return $this->index; + } + + public function setIndex(int $index): self + { + $this->initialized['index'] = true; + $this->index = $index; + return $this; + } + + /** + * The ID of the tool call. + */ + public function getId(): string + { + return $this->id; + } + + /** + * The ID of the tool call. + */ + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + /** + * The type of the tool. Currently, only `function` is supported. + */ + public function getType(): string + { + return $this->type; + } + + /** + * The type of the tool. Currently, only `function` is supported. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + public function getFunction(): ChatCompletionMessageToolCallChunkFunction + { + return $this->function; + } + + public function setFunction(ChatCompletionMessageToolCallChunkFunction $function): self + { + $this->initialized['function'] = true; + $this->function = $function; + return $this; + } +} diff --git a/generated/Model/ChatCompletionMessageToolCallChunkFunction.php b/generated/Model/ChatCompletionMessageToolCallChunkFunction.php new file mode 100644 index 0000000..ca5cd76 --- /dev/null +++ b/generated/Model/ChatCompletionMessageToolCallChunkFunction.php @@ -0,0 +1,77 @@ +setName($name); + } + if ($arguments !== null) { + $this->setArguments($arguments); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The name of the function to call. + */ + public function getName(): string + { + return $this->name; + } + + /** + * The name of the function to call. + */ + public function setName(string $name): self + { + $this->initialized['name'] = true; + $this->name = $name; + return $this; + } + + /** + * The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + */ + public function getArguments(): string + { + return $this->arguments; + } + + /** + * The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + */ + public function setArguments(string $arguments): self + { + $this->initialized['arguments'] = true; + $this->arguments = $arguments; + return $this; + } +} diff --git a/generated/Model/ChatCompletionRequestMessageFunctionCall.php b/generated/Model/ChatCompletionMessageToolCallFunction.php similarity index 97% rename from generated/Model/ChatCompletionRequestMessageFunctionCall.php rename to generated/Model/ChatCompletionMessageToolCallFunction.php index 7b81281..1f7f090 100644 --- a/generated/Model/ChatCompletionRequestMessageFunctionCall.php +++ b/generated/Model/ChatCompletionMessageToolCallFunction.php @@ -6,7 +6,7 @@ use ArrayObject; -class ChatCompletionRequestMessageFunctionCall extends ArrayObject +class ChatCompletionMessageToolCallFunction extends ArrayObject { protected array $initialized = []; diff --git a/generated/Model/ChatCompletionNamedToolChoice.php b/generated/Model/ChatCompletionNamedToolChoice.php new file mode 100644 index 0000000..ca55eb0 --- /dev/null +++ b/generated/Model/ChatCompletionNamedToolChoice.php @@ -0,0 +1,68 @@ +setType($type); + } + if ($function !== null) { + $this->setFunction($function); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The type of the tool. Currently, only `function` is supported. + */ + public function getType(): string + { + return $this->type; + } + + /** + * The type of the tool. Currently, only `function` is supported. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + public function getFunction(): ChatCompletionNamedToolChoiceFunction + { + return $this->function; + } + + public function setFunction(ChatCompletionNamedToolChoiceFunction $function): self + { + $this->initialized['function'] = true; + $this->function = $function; + return $this; + } +} diff --git a/generated/Model/ChatCompletionNamedToolChoiceFunction.php b/generated/Model/ChatCompletionNamedToolChoiceFunction.php new file mode 100644 index 0000000..d6c3ccc --- /dev/null +++ b/generated/Model/ChatCompletionNamedToolChoiceFunction.php @@ -0,0 +1,50 @@ +setName($name); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The name of the function to call. + */ + public function getName(): string + { + return $this->name; + } + + /** + * The name of the function to call. + */ + public function setName(string $name): self + { + $this->initialized['name'] = true; + $this->name = $name; + return $this; + } +} diff --git a/generated/Model/ChatCompletionRequestAssistantMessage.php b/generated/Model/ChatCompletionRequestAssistantMessage.php new file mode 100644 index 0000000..03e721a --- /dev/null +++ b/generated/Model/ChatCompletionRequestAssistantMessage.php @@ -0,0 +1,170 @@ +setContent($content); + } + if ($role !== null) { + $this->setRole($role); + } + if ($name !== null) { + $this->setName($name); + } + if ($toolCalls !== null) { + $this->setToolCalls($toolCalls); + } + if ($functionCall !== null) { + $this->setFunctionCall($functionCall); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified. + */ + public function getContent(): ?string + { + return $this->content; + } + + /** + * The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified. + */ + public function setContent(?string $content): self + { + $this->initialized['content'] = true; + $this->content = $content; + return $this; + } + + /** + * The role of the messages author, in this case `assistant`. + */ + public function getRole(): string + { + return $this->role; + } + + /** + * The role of the messages author, in this case `assistant`. + */ + public function setRole(string $role): self + { + $this->initialized['role'] = true; + $this->role = $role; + return $this; + } + + /** + * An optional name for the participant. Provides the model information to differentiate between participants of the same role. + */ + public function getName(): string + { + return $this->name; + } + + /** + * An optional name for the participant. Provides the model information to differentiate between participants of the same role. + */ + public function setName(string $name): self + { + $this->initialized['name'] = true; + $this->name = $name; + return $this; + } + + /** + * The tool calls generated by the model, such as function calls. + * + * @return ChatCompletionMessageToolCall[] + */ + public function getToolCalls(): array + { + return $this->toolCalls; + } + + /** + * The tool calls generated by the model, such as function calls. + * + * @param ChatCompletionMessageToolCall[] $toolCalls + */ + public function setToolCalls(array $toolCalls): self + { + $this->initialized['toolCalls'] = true; + $this->toolCalls = $toolCalls; + return $this; + } + + /** + * Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + * + * @deprecated + */ + public function getFunctionCall(): ChatCompletionRequestAssistantMessageFunctionCall + { + return $this->functionCall; + } + + /** + * Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + * + * @deprecated + */ + public function setFunctionCall(ChatCompletionRequestAssistantMessageFunctionCall $functionCall): self + { + $this->initialized['functionCall'] = true; + $this->functionCall = $functionCall; + return $this; + } +} diff --git a/generated/Model/ChatCompletionRequestAssistantMessageFunctionCall.php b/generated/Model/ChatCompletionRequestAssistantMessageFunctionCall.php new file mode 100644 index 0000000..d19a900 --- /dev/null +++ b/generated/Model/ChatCompletionRequestAssistantMessageFunctionCall.php @@ -0,0 +1,80 @@ +setArguments($arguments); + } + if ($name !== null) { + $this->setName($name); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + */ + public function getArguments(): string + { + return $this->arguments; + } + + /** + * The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + */ + public function setArguments(string $arguments): self + { + $this->initialized['arguments'] = true; + $this->arguments = $arguments; + return $this; + } + + /** + * The name of the function to call. + */ + public function getName(): string + { + return $this->name; + } + + /** + * The name of the function to call. + */ + public function setName(string $name): self + { + $this->initialized['name'] = true; + $this->name = $name; + return $this; + } +} diff --git a/generated/Model/ChatCompletionRequestFunctionMessage.php b/generated/Model/ChatCompletionRequestFunctionMessage.php new file mode 100644 index 0000000..7774b69 --- /dev/null +++ b/generated/Model/ChatCompletionRequestFunctionMessage.php @@ -0,0 +1,107 @@ +setRole($role); + } + if ($content !== null) { + $this->setContent($content); + } + if ($name !== null) { + $this->setName($name); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The role of the messages author, in this case `function`. + */ + public function getRole(): string + { + return $this->role; + } + + /** + * The role of the messages author, in this case `function`. + */ + public function setRole(string $role): self + { + $this->initialized['role'] = true; + $this->role = $role; + return $this; + } + + /** + * The contents of the function message. + */ + public function getContent(): ?string + { + return $this->content; + } + + /** + * The contents of the function message. + */ + public function setContent(?string $content): self + { + $this->initialized['content'] = true; + $this->content = $content; + return $this; + } + + /** + * The name of the function to call. + */ + public function getName(): string + { + return $this->name; + } + + /** + * The name of the function to call. + */ + public function setName(string $name): self + { + $this->initialized['name'] = true; + $this->name = $name; + return $this; + } +} diff --git a/generated/Model/ChatCompletionRequestMessage.php b/generated/Model/ChatCompletionRequestMessage.php deleted file mode 100644 index 6371398..0000000 --- a/generated/Model/ChatCompletionRequestMessage.php +++ /dev/null @@ -1,131 +0,0 @@ -setRole($role); - } - if ($content !== null) { - $this->setContent($content); - } - if ($name !== null) { - $this->setName($name); - } - if ($functionCall !== null) { - $this->setFunctionCall($functionCall); - } - } - - public function isInitialized($property): bool - { - return array_key_exists($property, $this->initialized); - } - - /** - * The role of the messages author. One of `system`, `user`, `assistant`, or `function`. - */ - public function getRole(): string - { - return $this->role; - } - - /** - * The role of the messages author. One of `system`, `user`, `assistant`, or `function`. - */ - public function setRole(string $role): self - { - $this->initialized['role'] = true; - $this->role = $role; - return $this; - } - - /** - * The contents of the message. `content` is required for all messages except assistant messages with function calls. - */ - public function getContent(): string - { - return $this->content; - } - - /** - * The contents of the message. `content` is required for all messages except assistant messages with function calls. - */ - public function setContent(string $content): self - { - $this->initialized['content'] = true; - $this->content = $content; - return $this; - } - - /** - * The name of the author of this message. `name` is required if role is `function`, and it should be the name of the function whose response is in the `content`. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters. - */ - public function getName(): string - { - return $this->name; - } - - /** - * The name of the author of this message. `name` is required if role is `function`, and it should be the name of the function whose response is in the `content`. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters. - */ - public function setName(string $name): self - { - $this->initialized['name'] = true; - $this->name = $name; - return $this; - } - - /** - * The name and arguments of a function that should be called, as generated by the model. - */ - public function getFunctionCall(): ChatCompletionRequestMessageFunctionCall - { - return $this->functionCall; - } - - /** - * The name and arguments of a function that should be called, as generated by the model. - */ - public function setFunctionCall(ChatCompletionRequestMessageFunctionCall $functionCall): self - { - $this->initialized['functionCall'] = true; - $this->functionCall = $functionCall; - return $this; - } -} diff --git a/generated/Model/ChatCompletionRequestMessageContentPartImage.php b/generated/Model/ChatCompletionRequestMessageContentPartImage.php new file mode 100644 index 0000000..2433a0b --- /dev/null +++ b/generated/Model/ChatCompletionRequestMessageContentPartImage.php @@ -0,0 +1,68 @@ +setType($type); + } + if ($imageUrl !== null) { + $this->setImageUrl($imageUrl); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The type of the content part. + */ + public function getType(): string + { + return $this->type; + } + + /** + * The type of the content part. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + public function getImageUrl(): ChatCompletionRequestMessageContentPartImageImageUrl + { + return $this->imageUrl; + } + + public function setImageUrl(ChatCompletionRequestMessageContentPartImageImageUrl $imageUrl): self + { + $this->initialized['imageUrl'] = true; + $this->imageUrl = $imageUrl; + return $this; + } +} diff --git a/generated/Model/ChatCompletionRequestMessageContentPartImageImageUrl.php b/generated/Model/ChatCompletionRequestMessageContentPartImageImageUrl.php new file mode 100644 index 0000000..88b8436 --- /dev/null +++ b/generated/Model/ChatCompletionRequestMessageContentPartImageImageUrl.php @@ -0,0 +1,77 @@ +setUrl($url); + } + if ($detail !== null) { + $this->setDetail($detail); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * Either a URL of the image or the base64 encoded image data. + */ + public function getUrl(): string + { + return $this->url; + } + + /** + * Either a URL of the image or the base64 encoded image data. + */ + public function setUrl(string $url): self + { + $this->initialized['url'] = true; + $this->url = $url; + return $this; + } + + /** + * Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision/low-or-high-fidelity-image-understanding). + */ + public function getDetail(): string + { + return $this->detail; + } + + /** + * Specifies the detail level of the image. Learn more in the [Vision guide](/docs/guides/vision/low-or-high-fidelity-image-understanding). + */ + public function setDetail(string $detail): self + { + $this->initialized['detail'] = true; + $this->detail = $detail; + return $this; + } +} diff --git a/generated/Model/ChatCompletionRequestMessageContentPartText.php b/generated/Model/ChatCompletionRequestMessageContentPartText.php new file mode 100644 index 0000000..a1a60ef --- /dev/null +++ b/generated/Model/ChatCompletionRequestMessageContentPartText.php @@ -0,0 +1,77 @@ +setType($type); + } + if ($text !== null) { + $this->setText($text); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The type of the content part. + */ + public function getType(): string + { + return $this->type; + } + + /** + * The type of the content part. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + /** + * The text content. + */ + public function getText(): string + { + return $this->text; + } + + /** + * The text content. + */ + public function setText(string $text): self + { + $this->initialized['text'] = true; + $this->text = $text; + return $this; + } +} diff --git a/generated/Model/ChatCompletionRequestSystemMessage.php b/generated/Model/ChatCompletionRequestSystemMessage.php new file mode 100644 index 0000000..daaf28d --- /dev/null +++ b/generated/Model/ChatCompletionRequestSystemMessage.php @@ -0,0 +1,104 @@ +setContent($content); + } + if ($role !== null) { + $this->setRole($role); + } + if ($name !== null) { + $this->setName($name); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The contents of the system message. + */ + public function getContent(): string + { + return $this->content; + } + + /** + * The contents of the system message. + */ + public function setContent(string $content): self + { + $this->initialized['content'] = true; + $this->content = $content; + return $this; + } + + /** + * The role of the messages author, in this case `system`. + */ + public function getRole(): string + { + return $this->role; + } + + /** + * The role of the messages author, in this case `system`. + */ + public function setRole(string $role): self + { + $this->initialized['role'] = true; + $this->role = $role; + return $this; + } + + /** + * An optional name for the participant. Provides the model information to differentiate between participants of the same role. + */ + public function getName(): string + { + return $this->name; + } + + /** + * An optional name for the participant. Provides the model information to differentiate between participants of the same role. + */ + public function setName(string $name): self + { + $this->initialized['name'] = true; + $this->name = $name; + return $this; + } +} diff --git a/generated/Model/ChatCompletionRequestToolMessage.php b/generated/Model/ChatCompletionRequestToolMessage.php new file mode 100644 index 0000000..276d2a3 --- /dev/null +++ b/generated/Model/ChatCompletionRequestToolMessage.php @@ -0,0 +1,104 @@ +setRole($role); + } + if ($content !== null) { + $this->setContent($content); + } + if ($toolCallId !== null) { + $this->setToolCallId($toolCallId); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The role of the messages author, in this case `tool`. + */ + public function getRole(): string + { + return $this->role; + } + + /** + * The role of the messages author, in this case `tool`. + */ + public function setRole(string $role): self + { + $this->initialized['role'] = true; + $this->role = $role; + return $this; + } + + /** + * The contents of the tool message. + */ + public function getContent(): string + { + return $this->content; + } + + /** + * The contents of the tool message. + */ + public function setContent(string $content): self + { + $this->initialized['content'] = true; + $this->content = $content; + return $this; + } + + /** + * Tool call that this message is responding to. + */ + public function getToolCallId(): string + { + return $this->toolCallId; + } + + /** + * Tool call that this message is responding to. + */ + public function setToolCallId(string $toolCallId): self + { + $this->initialized['toolCallId'] = true; + $this->toolCallId = $toolCallId; + return $this; + } +} diff --git a/generated/Model/ChatCompletionRequestUserMessage.php b/generated/Model/ChatCompletionRequestUserMessage.php new file mode 100644 index 0000000..ce00d53 --- /dev/null +++ b/generated/Model/ChatCompletionRequestUserMessage.php @@ -0,0 +1,108 @@ +setContent($content); + } + if ($role !== null) { + $this->setRole($role); + } + if ($name !== null) { + $this->setName($name); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The contents of the user message. + * + * @return mixed + */ + public function getContent() + { + return $this->content; + } + + /** + * The contents of the user message. + */ + public function setContent(mixed $content): self + { + $this->initialized['content'] = true; + $this->content = $content; + return $this; + } + + /** + * The role of the messages author, in this case `user`. + */ + public function getRole(): string + { + return $this->role; + } + + /** + * The role of the messages author, in this case `user`. + */ + public function setRole(string $role): self + { + $this->initialized['role'] = true; + $this->role = $role; + return $this; + } + + /** + * An optional name for the participant. Provides the model information to differentiate between participants of the same role. + */ + public function getName(): string + { + return $this->name; + } + + /** + * An optional name for the participant. Provides the model information to differentiate between participants of the same role. + */ + public function setName(string $name): self + { + $this->initialized['name'] = true; + $this->name = $name; + return $this; + } +} diff --git a/generated/Model/ChatCompletionResponseMessage.php b/generated/Model/ChatCompletionResponseMessage.php index a537efb..f84fbe7 100644 --- a/generated/Model/ChatCompletionResponseMessage.php +++ b/generated/Model/ChatCompletionResponseMessage.php @@ -11,33 +11,46 @@ class ChatCompletionResponseMessage extends ArrayObject protected array $initialized = []; /** - * The role of the author of this message. + * The contents of the message. */ - protected ?string $role = null; + protected ?string $content = null; /** - * The contents of the message. + * The tool calls generated by the model, such as function calls. + * + * @var ChatCompletionMessageToolCall[] */ - protected ?string $content = null; + protected ?array $toolCalls = null; /** - * The name and arguments of a function that should be called, as generated by the model. + * The role of the author of this message. + */ + protected ?string $role = null; + + /** + * Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + * + * @deprecated */ protected ?ChatCompletionResponseMessageFunctionCall $functionCall = null; /** - * @param string $role The role of the author of this message. * @param string|null $content The contents of the message. - * @param ChatCompletionResponseMessageFunctionCall|null $functionCall The name and arguments of a function that should be called, as generated by the model. + * @param ChatCompletionMessageToolCall[] $toolCalls The tool calls generated by the model, such as function calls. + * @param string $role The role of the author of this message. + * @param ChatCompletionResponseMessageFunctionCall $functionCall Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. */ - public function __construct($role = null, $content = null, $functionCall = null) + public function __construct($content = null, $toolCalls = null, $role = null, $functionCall = null) { - if ($role !== null) { - $this->setRole($role); - } if ($content !== null) { $this->setContent($content); } + if ($toolCalls !== null) { + $this->setToolCalls($toolCalls); + } + if ($role !== null) { + $this->setRole($role); + } if ($functionCall !== null) { $this->setFunctionCall($functionCall); } @@ -49,53 +62,79 @@ public function isInitialized($property): bool } /** - * The role of the author of this message. + * The contents of the message. */ - public function getRole(): string + public function getContent(): ?string { - return $this->role; + return $this->content; } /** - * The role of the author of this message. + * The contents of the message. */ - public function setRole(string $role): self + public function setContent(?string $content): self { - $this->initialized['role'] = true; - $this->role = $role; + $this->initialized['content'] = true; + $this->content = $content; return $this; } /** - * The contents of the message. + * The tool calls generated by the model, such as function calls. + * + * @return ChatCompletionMessageToolCall[] */ - public function getContent(): ?string + public function getToolCalls(): array { - return $this->content; + return $this->toolCalls; } /** - * The contents of the message. + * The tool calls generated by the model, such as function calls. + * + * @param ChatCompletionMessageToolCall[] $toolCalls */ - public function setContent(?string $content): self + public function setToolCalls(array $toolCalls): self { - $this->initialized['content'] = true; - $this->content = $content; + $this->initialized['toolCalls'] = true; + $this->toolCalls = $toolCalls; + return $this; + } + + /** + * The role of the author of this message. + */ + public function getRole(): string + { + return $this->role; + } + + /** + * The role of the author of this message. + */ + public function setRole(string $role): self + { + $this->initialized['role'] = true; + $this->role = $role; return $this; } /** - * The name and arguments of a function that should be called, as generated by the model. + * Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + * + * @deprecated */ - public function getFunctionCall(): ?ChatCompletionResponseMessageFunctionCall + public function getFunctionCall(): ChatCompletionResponseMessageFunctionCall { return $this->functionCall; } /** - * The name and arguments of a function that should be called, as generated by the model. + * Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + * + * @deprecated */ - public function setFunctionCall(?ChatCompletionResponseMessageFunctionCall $functionCall): self + public function setFunctionCall(ChatCompletionResponseMessageFunctionCall $functionCall): self { $this->initialized['functionCall'] = true; $this->functionCall = $functionCall; diff --git a/generated/Model/ChatCompletionResponseMessageFunctionCall.php b/generated/Model/ChatCompletionResponseMessageFunctionCall.php index 4e3333c..a199bac 100644 --- a/generated/Model/ChatCompletionResponseMessageFunctionCall.php +++ b/generated/Model/ChatCompletionResponseMessageFunctionCall.php @@ -6,32 +6,35 @@ use ArrayObject; +/** + * @deprecated + */ class ChatCompletionResponseMessageFunctionCall extends ArrayObject { protected array $initialized = []; /** - * The name of the function to call. + * The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. */ - protected ?string $name = null; + protected ?string $arguments = null; /** - * The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + * The name of the function to call. */ - protected ?string $arguments = null; + protected ?string $name = null; /** - * @param string $name The name of the function to call. * @param string $arguments The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + * @param string $name The name of the function to call. */ - public function __construct($name = null, $arguments = null) + public function __construct($arguments = null, $name = null) { - if ($name !== null) { - $this->setName($name); - } if ($arguments !== null) { $this->setArguments($arguments); } + if ($name !== null) { + $this->setName($name); + } } public function isInitialized($property): bool @@ -40,38 +43,38 @@ public function isInitialized($property): bool } /** - * The name of the function to call. + * The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. */ - public function getName(): string + public function getArguments(): string { - return $this->name; + return $this->arguments; } /** - * The name of the function to call. + * The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. */ - public function setName(string $name): self + public function setArguments(string $arguments): self { - $this->initialized['name'] = true; - $this->name = $name; + $this->initialized['arguments'] = true; + $this->arguments = $arguments; return $this; } /** - * The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + * The name of the function to call. */ - public function getArguments(): string + public function getName(): string { - return $this->arguments; + return $this->name; } /** - * The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + * The name of the function to call. */ - public function setArguments(string $arguments): self + public function setName(string $name): self { - $this->initialized['arguments'] = true; - $this->arguments = $arguments; + $this->initialized['name'] = true; + $this->name = $name; return $this; } } diff --git a/generated/Model/ChatCompletionStreamResponseDelta.php b/generated/Model/ChatCompletionStreamResponseDelta.php new file mode 100644 index 0000000..1192c1a --- /dev/null +++ b/generated/Model/ChatCompletionStreamResponseDelta.php @@ -0,0 +1,137 @@ +setContent($content); + } + if ($functionCall !== null) { + $this->setFunctionCall($functionCall); + } + if ($toolCalls !== null) { + $this->setToolCalls($toolCalls); + } + if ($role !== null) { + $this->setRole($role); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The contents of the chunk message. + */ + public function getContent(): ?string + { + return $this->content; + } + + /** + * The contents of the chunk message. + */ + public function setContent(?string $content): self + { + $this->initialized['content'] = true; + $this->content = $content; + return $this; + } + + /** + * Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + * + * @deprecated + */ + public function getFunctionCall(): ChatCompletionStreamResponseDeltaFunctionCall + { + return $this->functionCall; + } + + /** + * Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + * + * @deprecated + */ + public function setFunctionCall(ChatCompletionStreamResponseDeltaFunctionCall $functionCall): self + { + $this->initialized['functionCall'] = true; + $this->functionCall = $functionCall; + return $this; + } + + /** + * @return ChatCompletionMessageToolCallChunk[] + */ + public function getToolCalls(): array + { + return $this->toolCalls; + } + + /** + * @param ChatCompletionMessageToolCallChunk[] $toolCalls + */ + public function setToolCalls(array $toolCalls): self + { + $this->initialized['toolCalls'] = true; + $this->toolCalls = $toolCalls; + return $this; + } + + /** + * The role of the author of this message. + */ + public function getRole(): string + { + return $this->role; + } + + /** + * The role of the author of this message. + */ + public function setRole(string $role): self + { + $this->initialized['role'] = true; + $this->role = $role; + return $this; + } +} diff --git a/generated/Model/ChatCompletionStreamResponseDeltaFunctionCall.php b/generated/Model/ChatCompletionStreamResponseDeltaFunctionCall.php new file mode 100644 index 0000000..31f5574 --- /dev/null +++ b/generated/Model/ChatCompletionStreamResponseDeltaFunctionCall.php @@ -0,0 +1,80 @@ +setArguments($arguments); + } + if ($name !== null) { + $this->setName($name); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + */ + public function getArguments(): string + { + return $this->arguments; + } + + /** + * The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. + */ + public function setArguments(string $arguments): self + { + $this->initialized['arguments'] = true; + $this->arguments = $arguments; + return $this; + } + + /** + * The name of the function to call. + */ + public function getName(): string + { + return $this->name; + } + + /** + * The name of the function to call. + */ + public function setName(string $name): self + { + $this->initialized['name'] = true; + $this->name = $name; + return $this; + } +} diff --git a/generated/Model/ChatCompletionTokenLogprob.php b/generated/Model/ChatCompletionTokenLogprob.php new file mode 100644 index 0000000..3f2bc90 --- /dev/null +++ b/generated/Model/ChatCompletionTokenLogprob.php @@ -0,0 +1,143 @@ +setToken($token); + } + if ($logprob !== null) { + $this->setLogprob($logprob); + } + if ($bytes !== null) { + $this->setBytes($bytes); + } + if ($topLogprobs !== null) { + $this->setTopLogprobs($topLogprobs); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The token. + */ + public function getToken(): string + { + return $this->token; + } + + /** + * The token. + */ + public function setToken(string $token): self + { + $this->initialized['token'] = true; + $this->token = $token; + return $this; + } + + /** + * The log probability of this token. + */ + public function getLogprob(): float + { + return $this->logprob; + } + + /** + * The log probability of this token. + */ + public function setLogprob(float $logprob): self + { + $this->initialized['logprob'] = true; + $this->logprob = $logprob; + return $this; + } + + /** + * A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. + * + * @return int[]|null + */ + public function getBytes(): ?array + { + return $this->bytes; + } + + /** + * A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. + * + * @param int[]|null $bytes + */ + public function setBytes(?array $bytes): self + { + $this->initialized['bytes'] = true; + $this->bytes = $bytes; + return $this; + } + + /** + * List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned. + * + * @return ChatCompletionTokenLogprobTopLogprobsItem[] + */ + public function getTopLogprobs(): array + { + return $this->topLogprobs; + } + + /** + * List of the most likely tokens and their log probability, at this token position. In rare cases, there may be fewer than the number of requested `top_logprobs` returned. + * + * @param ChatCompletionTokenLogprobTopLogprobsItem[] $topLogprobs + */ + public function setTopLogprobs(array $topLogprobs): self + { + $this->initialized['topLogprobs'] = true; + $this->topLogprobs = $topLogprobs; + return $this; + } +} diff --git a/generated/Model/ChatCompletionTokenLogprobTopLogprobsItem.php b/generated/Model/ChatCompletionTokenLogprobTopLogprobsItem.php new file mode 100644 index 0000000..ccd6188 --- /dev/null +++ b/generated/Model/ChatCompletionTokenLogprobTopLogprobsItem.php @@ -0,0 +1,110 @@ +setToken($token); + } + if ($logprob !== null) { + $this->setLogprob($logprob); + } + if ($bytes !== null) { + $this->setBytes($bytes); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The token. + */ + public function getToken(): string + { + return $this->token; + } + + /** + * The token. + */ + public function setToken(string $token): self + { + $this->initialized['token'] = true; + $this->token = $token; + return $this; + } + + /** + * The log probability of this token. + */ + public function getLogprob(): float + { + return $this->logprob; + } + + /** + * The log probability of this token. + */ + public function setLogprob(float $logprob): self + { + $this->initialized['logprob'] = true; + $this->logprob = $logprob; + return $this; + } + + /** + * A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. + * + * @return int[]|null + */ + public function getBytes(): ?array + { + return $this->bytes; + } + + /** + * A list of integers representing the UTF-8 bytes representation of the token. Useful in instances where characters are represented by multiple tokens and their byte representations must be combined to generate the correct text representation. Can be `null` if there is no bytes representation for the token. + * + * @param int[]|null $bytes + */ + public function setBytes(?array $bytes): self + { + $this->initialized['bytes'] = true; + $this->bytes = $bytes; + return $this; + } +} diff --git a/generated/Model/ChatCompletionTool.php b/generated/Model/ChatCompletionTool.php new file mode 100644 index 0000000..6ab0157 --- /dev/null +++ b/generated/Model/ChatCompletionTool.php @@ -0,0 +1,68 @@ +setType($type); + } + if ($function !== null) { + $this->setFunction($function); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The type of the tool. Currently, only `function` is supported. + */ + public function getType(): string + { + return $this->type; + } + + /** + * The type of the tool. Currently, only `function` is supported. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + public function getFunction(): FunctionObject + { + return $this->function; + } + + public function setFunction(FunctionObject $function): self + { + $this->initialized['function'] = true; + $this->function = $function; + return $this; + } +} diff --git a/generated/Model/CreateEditResponseUsage.php b/generated/Model/CompletionUsage.php similarity index 61% rename from generated/Model/CreateEditResponseUsage.php rename to generated/Model/CompletionUsage.php index c6aecb1..fa69650 100644 --- a/generated/Model/CreateEditResponseUsage.php +++ b/generated/Model/CompletionUsage.php @@ -6,29 +6,38 @@ use ArrayObject; -class CreateEditResponseUsage extends ArrayObject +class CompletionUsage extends ArrayObject { protected array $initialized = []; - protected ?int $promptTokens = null; - + /** + * Number of tokens in the generated completion. + */ protected ?int $completionTokens = null; + /** + * Number of tokens in the prompt. + */ + protected ?int $promptTokens = null; + + /** + * Total number of tokens used in the request (prompt + completion). + */ protected ?int $totalTokens = null; /** - * @param int $promptTokens - * @param int $completionTokens - * @param int $totalTokens + * @param int $completionTokens Number of tokens in the generated completion. + * @param int $promptTokens Number of tokens in the prompt. + * @param int $totalTokens Total number of tokens used in the request (prompt + completion). */ - public function __construct($promptTokens = null, $completionTokens = null, $totalTokens = null) + public function __construct($completionTokens = null, $promptTokens = null, $totalTokens = null) { - if ($promptTokens !== null) { - $this->setPromptTokens($promptTokens); - } if ($completionTokens !== null) { $this->setCompletionTokens($completionTokens); } + if ($promptTokens !== null) { + $this->setPromptTokens($promptTokens); + } if ($totalTokens !== null) { $this->setTotalTokens($totalTokens); } @@ -39,35 +48,53 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } - public function getPromptTokens(): int + /** + * Number of tokens in the generated completion. + */ + public function getCompletionTokens(): int { - return $this->promptTokens; + return $this->completionTokens; } - public function setPromptTokens(int $promptTokens): self + /** + * Number of tokens in the generated completion. + */ + public function setCompletionTokens(int $completionTokens): self { - $this->initialized['promptTokens'] = true; - $this->promptTokens = $promptTokens; + $this->initialized['completionTokens'] = true; + $this->completionTokens = $completionTokens; return $this; } - public function getCompletionTokens(): int + /** + * Number of tokens in the prompt. + */ + public function getPromptTokens(): int { - return $this->completionTokens; + return $this->promptTokens; } - public function setCompletionTokens(int $completionTokens): self + /** + * Number of tokens in the prompt. + */ + public function setPromptTokens(int $promptTokens): self { - $this->initialized['completionTokens'] = true; - $this->completionTokens = $completionTokens; + $this->initialized['promptTokens'] = true; + $this->promptTokens = $promptTokens; return $this; } + /** + * Total number of tokens used in the request (prompt + completion). + */ public function getTotalTokens(): int { return $this->totalTokens; } + /** + * Total number of tokens used in the request (prompt + completion). + */ public function setTotalTokens(int $totalTokens): self { $this->initialized['totalTokens'] = true; diff --git a/generated/Model/CreateAnswerRequest.php b/generated/Model/CreateAnswerRequest.php deleted file mode 100644 index b3b5695..0000000 --- a/generated/Model/CreateAnswerRequest.php +++ /dev/null @@ -1,557 +0,0 @@ - token from being generated. - * @param bool|null $returnMetadata A special boolean flag for showing metadata. If set to `true`, each document entry in the returned JSON will contain a "metadata" field. - * This flag only takes effect when `file` is set. - * @param bool|null $returnPrompt If set to `true`, the returned JSON will include a "prompt" field containing the final prompt that was used to request a completion. This is mainly useful for debugging purposes. - * @param mixed[]|null $expand If an object name is in the list, we provide the full information of the object; otherwise, we only provide the object ID. Currently we support `completion` and `file` objects for expansion. - * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - */ - public function __construct($model = null, $question = null, $examples = null, $examplesContext = null, $documents = null, $file = null, $searchModel = 'ada', $maxRerank = 200, $temperature = 0, $logprobs = null, $maxTokens = 16, $stop = null, $n = 1, $logitBias = null, $returnMetadata = false, $returnPrompt = false, $expand = [], $user = null) - { - if ($model !== null) { - $this->setModel($model); - } - if ($question !== null) { - $this->setQuestion($question); - } - if ($examples !== null) { - $this->setExamples($examples); - } - if ($examplesContext !== null) { - $this->setExamplesContext($examplesContext); - } - if ($documents !== null) { - $this->setDocuments($documents); - } - if ($file !== null) { - $this->setFile($file); - } - if ($searchModel !== null) { - $this->setSearchModel($searchModel); - } - if ($maxRerank !== null) { - $this->setMaxRerank($maxRerank); - } - if ($temperature !== null) { - $this->setTemperature($temperature); - } - if ($logprobs !== null) { - $this->setLogprobs($logprobs); - } - if ($maxTokens !== null) { - $this->setMaxTokens($maxTokens); - } - if ($stop !== null) { - $this->setStop($stop); - } - if ($n !== null) { - $this->setN($n); - } - if ($logitBias !== null) { - $this->setLogitBias($logitBias); - } - if ($returnMetadata !== null) { - $this->setReturnMetadata($returnMetadata); - } - if ($returnPrompt !== null) { - $this->setReturnPrompt($returnPrompt); - } - if ($expand !== null) { - $this->setExpand($expand); - } - if ($user !== null) { - $this->setUser($user); - } - } - - public function isInitialized($property): bool - { - return array_key_exists($property, $this->initialized); - } - - /** - * ID of the model to use for completion. You can select one of `ada`, `babbage`, `curie`, or `davinci`. - */ - public function getModel(): string - { - return $this->model; - } - - /** - * ID of the model to use for completion. You can select one of `ada`, `babbage`, `curie`, or `davinci`. - */ - public function setModel(string $model): self - { - $this->initialized['model'] = true; - $this->model = $model; - return $this; - } - - /** - * Question to get answered. - */ - public function getQuestion(): string - { - return $this->question; - } - - /** - * Question to get answered. - */ - public function setQuestion(string $question): self - { - $this->initialized['question'] = true; - $this->question = $question; - return $this; - } - - /** - * List of (question, answer) pairs that will help steer the model towards the tone and answer format you'd like. We recommend adding 2 to 3 examples. - * - * @return string[][] - */ - public function getExamples(): array - { - return $this->examples; - } - - /** - * List of (question, answer) pairs that will help steer the model towards the tone and answer format you'd like. We recommend adding 2 to 3 examples. - * - * @param string[][] $examples - */ - public function setExamples(array $examples): self - { - $this->initialized['examples'] = true; - $this->examples = $examples; - return $this; - } - - /** - * A text snippet containing the contextual information used to generate the answers for the `examples` you provide. - */ - public function getExamplesContext(): string - { - return $this->examplesContext; - } - - /** - * A text snippet containing the contextual information used to generate the answers for the `examples` you provide. - */ - public function setExamplesContext(string $examplesContext): self - { - $this->initialized['examplesContext'] = true; - $this->examplesContext = $examplesContext; - return $this; - } - - /** - * List of documents from which the answer for the input `question` should be derived. If this is an empty list, the question will be answered based on the question-answer examples. - - * - * @return string[]|null - */ - public function getDocuments(): ?array - { - return $this->documents; - } - - /** - * List of documents from which the answer for the input `question` should be derived. If this is an empty list, the question will be answered based on the question-answer examples. - * - * @param string[]|null $documents - */ - public function setDocuments(?array $documents): self - { - $this->initialized['documents'] = true; - $this->documents = $documents; - return $this; - } - - /** - * The ID of an uploaded file that contains documents to search over. See [upload file](/docs/api-reference/files/upload) for how to upload a file of the desired format and purpose. - You should specify either `documents` or a `file`, but not both. - */ - public function getFile(): ?string - { - return $this->file; - } - - /** - * The ID of an uploaded file that contains documents to search over. See [upload file](/docs/api-reference/files/upload) for how to upload a file of the desired format and purpose. - You should specify either `documents` or a `file`, but not both. - */ - public function setFile(?string $file): self - { - $this->initialized['file'] = true; - $this->file = $file; - return $this; - } - - /** - * ID of the model to use for [Search](/docs/api-reference/searches/create). You can select one of `ada`, `babbage`, `curie`, or `davinci`. - */ - public function getSearchModel(): ?string - { - return $this->searchModel; - } - - /** - * ID of the model to use for [Search](/docs/api-reference/searches/create). You can select one of `ada`, `babbage`, `curie`, or `davinci`. - */ - public function setSearchModel(?string $searchModel): self - { - $this->initialized['searchModel'] = true; - $this->searchModel = $searchModel; - return $this; - } - - /** - * The maximum number of documents to be ranked by [Search](/docs/api-reference/searches/create) when using `file`. Setting it to a higher value leads to improved accuracy but with increased latency and cost. - */ - public function getMaxRerank(): ?int - { - return $this->maxRerank; - } - - /** - * The maximum number of documents to be ranked by [Search](/docs/api-reference/searches/create) when using `file`. Setting it to a higher value leads to improved accuracy but with increased latency and cost. - */ - public function setMaxRerank(?int $maxRerank): self - { - $this->initialized['maxRerank'] = true; - $this->maxRerank = $maxRerank; - return $this; - } - - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - */ - public function getTemperature(): ?float - { - return $this->temperature; - } - - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - */ - public function setTemperature(?float $temperature): self - { - $this->initialized['temperature'] = true; - $this->temperature = $temperature; - return $this; - } - - /** - * Include the log probabilities on the `logprobs` most likely tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. - When `logprobs` is set, `completion` will be automatically added into `expand` to get the logprobs. - */ - public function getLogprobs(): ?int - { - return $this->logprobs; - } - - /** - * Include the log probabilities on the `logprobs` most likely tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. - When `logprobs` is set, `completion` will be automatically added into `expand` to get the logprobs. - */ - public function setLogprobs(?int $logprobs): self - { - $this->initialized['logprobs'] = true; - $this->logprobs = $logprobs; - return $this; - } - - /** - * The maximum number of tokens allowed for the generated answer - */ - public function getMaxTokens(): ?int - { - return $this->maxTokens; - } - - /** - * The maximum number of tokens allowed for the generated answer - */ - public function setMaxTokens(?int $maxTokens): self - { - $this->initialized['maxTokens'] = true; - $this->maxTokens = $maxTokens; - return $this; - } - - /** - * Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence. - * - * @return mixed - */ - public function getStop() - { - return $this->stop; - } - - /** - * Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence. - */ - public function setStop(mixed $stop): self - { - $this->initialized['stop'] = true; - $this->stop = $stop; - return $this; - } - - /** - * How many answers to generate for each question. - */ - public function getN(): ?int - { - return $this->n; - } - - /** - * How many answers to generate for each question. - */ - public function setN(?int $n): self - { - $this->initialized['n'] = true; - $this->n = $n; - return $this; - } - - /** - * Modify the likelihood of specified tokens appearing in the completion. - - * - * @return mixed[]|null - */ - public function getLogitBias(): ?iterable - { - return $this->logitBias; - } - - /** - * Modify the likelihood of specified tokens appearing in the completion. - * - * @param mixed[]|null $logitBias - */ - public function setLogitBias(?iterable $logitBias): self - { - $this->initialized['logitBias'] = true; - $this->logitBias = $logitBias; - return $this; - } - - /** - * A special boolean flag for showing metadata. If set to `true`, each document entry in the returned JSON will contain a "metadata" field. - This flag only takes effect when `file` is set. - */ - public function getReturnMetadata(): ?bool - { - return $this->returnMetadata; - } - - /** - * A special boolean flag for showing metadata. If set to `true`, each document entry in the returned JSON will contain a "metadata" field. - This flag only takes effect when `file` is set. - */ - public function setReturnMetadata(?bool $returnMetadata): self - { - $this->initialized['returnMetadata'] = true; - $this->returnMetadata = $returnMetadata; - return $this; - } - - /** - * If set to `true`, the returned JSON will include a "prompt" field containing the final prompt that was used to request a completion. This is mainly useful for debugging purposes. - */ - public function getReturnPrompt(): ?bool - { - return $this->returnPrompt; - } - - /** - * If set to `true`, the returned JSON will include a "prompt" field containing the final prompt that was used to request a completion. This is mainly useful for debugging purposes. - */ - public function setReturnPrompt(?bool $returnPrompt): self - { - $this->initialized['returnPrompt'] = true; - $this->returnPrompt = $returnPrompt; - return $this; - } - - /** - * If an object name is in the list, we provide the full information of the object; otherwise, we only provide the object ID. Currently we support `completion` and `file` objects for expansion. - * - * @return mixed[]|null - */ - public function getExpand(): ?array - { - return $this->expand; - } - - /** - * If an object name is in the list, we provide the full information of the object; otherwise, we only provide the object ID. Currently we support `completion` and `file` objects for expansion. - * - * @param mixed[]|null $expand - */ - public function setExpand(?array $expand): self - { - $this->initialized['expand'] = true; - $this->expand = $expand; - return $this; - } - - /** - * A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - */ - public function getUser(): string - { - return $this->user; - } - - /** - * A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - */ - public function setUser(string $user): self - { - $this->initialized['user'] = true; - $this->user = $user; - return $this; - } -} diff --git a/generated/Model/CreateAnswerResponse.php b/generated/Model/CreateAnswerResponse.php deleted file mode 100644 index 1d6a0b9..0000000 --- a/generated/Model/CreateAnswerResponse.php +++ /dev/null @@ -1,149 +0,0 @@ -setObject($object); - } - if ($model !== null) { - $this->setModel($model); - } - if ($searchModel !== null) { - $this->setSearchModel($searchModel); - } - if ($completion !== null) { - $this->setCompletion($completion); - } - if ($answers !== null) { - $this->setAnswers($answers); - } - if ($selectedDocuments !== null) { - $this->setSelectedDocuments($selectedDocuments); - } - } - - public function isInitialized($property): bool - { - return array_key_exists($property, $this->initialized); - } - - public function getObject(): string - { - return $this->object; - } - - public function setObject(string $object): self - { - $this->initialized['object'] = true; - $this->object = $object; - return $this; - } - - public function getModel(): string - { - return $this->model; - } - - public function setModel(string $model): self - { - $this->initialized['model'] = true; - $this->model = $model; - return $this; - } - - public function getSearchModel(): string - { - return $this->searchModel; - } - - public function setSearchModel(string $searchModel): self - { - $this->initialized['searchModel'] = true; - $this->searchModel = $searchModel; - return $this; - } - - public function getCompletion(): string - { - return $this->completion; - } - - public function setCompletion(string $completion): self - { - $this->initialized['completion'] = true; - $this->completion = $completion; - return $this; - } - - /** - * @return string[] - */ - public function getAnswers(): array - { - return $this->answers; - } - - /** - * @param string[] $answers - */ - public function setAnswers(array $answers): self - { - $this->initialized['answers'] = true; - $this->answers = $answers; - return $this; - } - - /** - * @return CreateAnswerResponseSelectedDocumentsItem[] - */ - public function getSelectedDocuments(): array - { - return $this->selectedDocuments; - } - - /** - * @param CreateAnswerResponseSelectedDocumentsItem[] $selectedDocuments - */ - public function setSelectedDocuments(array $selectedDocuments): self - { - $this->initialized['selectedDocuments'] = true; - $this->selectedDocuments = $selectedDocuments; - return $this; - } -} diff --git a/generated/Model/CreateAnswerResponseSelectedDocumentsItem.php b/generated/Model/CreateAnswerResponseSelectedDocumentsItem.php deleted file mode 100644 index df8f806..0000000 --- a/generated/Model/CreateAnswerResponseSelectedDocumentsItem.php +++ /dev/null @@ -1,59 +0,0 @@ -setDocument($document); - } - if ($text !== null) { - $this->setText($text); - } - } - - public function isInitialized($property): bool - { - return array_key_exists($property, $this->initialized); - } - - public function getDocument(): int - { - return $this->document; - } - - public function setDocument(int $document): self - { - $this->initialized['document'] = true; - $this->document = $document; - return $this; - } - - public function getText(): string - { - return $this->text; - } - - public function setText(string $text): self - { - $this->initialized['text'] = true; - $this->text = $text; - return $this; - } -} diff --git a/generated/Model/CreateAssistantFileRequest.php b/generated/Model/CreateAssistantFileRequest.php new file mode 100644 index 0000000..15bf93c --- /dev/null +++ b/generated/Model/CreateAssistantFileRequest.php @@ -0,0 +1,48 @@ +setFileId($fileId); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * A [File](/docs/api-reference/files) ID (with `purpose="assistants"`) that the assistant should use. Useful for tools like `retrieval` and `code_interpreter` that can access files. + */ + public function getFileId(): string + { + return $this->fileId; + } + + /** + * A [File](/docs/api-reference/files) ID (with `purpose="assistants"`) that the assistant should use. Useful for tools like `retrieval` and `code_interpreter` that can access files. + */ + public function setFileId(string $fileId): self + { + $this->initialized['fileId'] = true; + $this->fileId = $fileId; + return $this; + } +} diff --git a/generated/Model/CreateAssistantRequest.php b/generated/Model/CreateAssistantRequest.php new file mode 100644 index 0000000..7af68c6 --- /dev/null +++ b/generated/Model/CreateAssistantRequest.php @@ -0,0 +1,232 @@ +|null + */ + protected $metadata = null; + + /** + * @param mixed $model ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + * @param string|null $name The name of the assistant. The maximum length is 256 characters. + * @param string|null $description The description of the assistant. The maximum length is 512 characters. + * @param string|null $instructions The system instructions that the assistant uses. The maximum length is 32768 characters. + * @param mixed[] $tools A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. + * @param string[] $fileIds A list of [file](/docs/api-reference/files) IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. + * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + */ + public function __construct(mixed $model = null, $name = null, $description = null, $instructions = null, $tools = [], $fileIds = [], $metadata = null) + { + if ($model !== null) { + $this->setModel($model); + } + if ($name !== null) { + $this->setName($name); + } + if ($description !== null) { + $this->setDescription($description); + } + if ($instructions !== null) { + $this->setInstructions($instructions); + } + if ($tools !== null) { + $this->setTools($tools); + } + if ($fileIds !== null) { + $this->setFileIds($fileIds); + } + if ($metadata !== null) { + $this->setMetadata($metadata); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + * + * @return mixed + */ + public function getModel() + { + return $this->model; + } + + /** + * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + */ + public function setModel(mixed $model): self + { + $this->initialized['model'] = true; + $this->model = $model; + return $this; + } + + /** + * The name of the assistant. The maximum length is 256 characters. + */ + public function getName(): ?string + { + return $this->name; + } + + /** + * The name of the assistant. The maximum length is 256 characters. + */ + public function setName(?string $name): self + { + $this->initialized['name'] = true; + $this->name = $name; + return $this; + } + + /** + * The description of the assistant. The maximum length is 512 characters. + */ + public function getDescription(): ?string + { + return $this->description; + } + + /** + * The description of the assistant. The maximum length is 512 characters. + */ + public function setDescription(?string $description): self + { + $this->initialized['description'] = true; + $this->description = $description; + return $this; + } + + /** + * The system instructions that the assistant uses. The maximum length is 32768 characters. + */ + public function getInstructions(): ?string + { + return $this->instructions; + } + + /** + * The system instructions that the assistant uses. The maximum length is 32768 characters. + */ + public function setInstructions(?string $instructions): self + { + $this->initialized['instructions'] = true; + $this->instructions = $instructions; + return $this; + } + + /** + * A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. + * + * @return mixed[] + */ + public function getTools(): array + { + return $this->tools; + } + + /** + * A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. + * + * @param mixed[] $tools + */ + public function setTools(array $tools): self + { + $this->initialized['tools'] = true; + $this->tools = $tools; + return $this; + } + + /** + * A list of [file](/docs/api-reference/files) IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. + * + * @return string[] + */ + public function getFileIds(): array + { + return $this->fileIds; + } + + /** + * A list of [file](/docs/api-reference/files) IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. + * + * @param string[] $fileIds + */ + public function setFileIds(array $fileIds): self + { + $this->initialized['fileIds'] = true; + $this->fileIds = $fileIds; + return $this; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @return array|null + */ + public function getMetadata(): ?iterable + { + return $this->metadata; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @param array|null $metadata + */ + public function setMetadata(?iterable $metadata): self + { + $this->initialized['metadata'] = true; + $this->metadata = $metadata; + return $this; + } +} diff --git a/generated/Model/CreateChatCompletionFunctionResponse.php b/generated/Model/CreateChatCompletionFunctionResponse.php new file mode 100644 index 0000000..6f1020a --- /dev/null +++ b/generated/Model/CreateChatCompletionFunctionResponse.php @@ -0,0 +1,225 @@ +setId($id); + } + if ($choices !== null) { + $this->setChoices($choices); + } + if ($created !== null) { + $this->setCreated($created); + } + if ($model !== null) { + $this->setModel($model); + } + if ($systemFingerprint !== null) { + $this->setSystemFingerprint($systemFingerprint); + } + if ($object !== null) { + $this->setObject($object); + } + if ($usage !== null) { + $this->setUsage($usage); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * A unique identifier for the chat completion. + */ + public function getId(): string + { + return $this->id; + } + + /** + * A unique identifier for the chat completion. + */ + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + /** + * A list of chat completion choices. Can be more than one if `n` is greater than 1. + * + * @return CreateChatCompletionFunctionResponseChoicesItem[] + */ + public function getChoices(): array + { + return $this->choices; + } + + /** + * A list of chat completion choices. Can be more than one if `n` is greater than 1. + * + * @param CreateChatCompletionFunctionResponseChoicesItem[] $choices + */ + public function setChoices(array $choices): self + { + $this->initialized['choices'] = true; + $this->choices = $choices; + return $this; + } + + /** + * The Unix timestamp (in seconds) of when the chat completion was created. + */ + public function getCreated(): int + { + return $this->created; + } + + /** + * The Unix timestamp (in seconds) of when the chat completion was created. + */ + public function setCreated(int $created): self + { + $this->initialized['created'] = true; + $this->created = $created; + return $this; + } + + /** + * The model used for the chat completion. + */ + public function getModel(): string + { + return $this->model; + } + + /** + * The model used for the chat completion. + */ + public function setModel(string $model): self + { + $this->initialized['model'] = true; + $this->model = $model; + return $this; + } + + /** + * This fingerprint represents the backend configuration that the model runs with. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + */ + public function getSystemFingerprint(): string + { + return $this->systemFingerprint; + } + + /** + * This fingerprint represents the backend configuration that the model runs with. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + */ + public function setSystemFingerprint(string $systemFingerprint): self + { + $this->initialized['systemFingerprint'] = true; + $this->systemFingerprint = $systemFingerprint; + return $this; + } + + /** + * The object type, which is always `chat.completion`. + */ + public function getObject(): string + { + return $this->object; + } + + /** + * The object type, which is always `chat.completion`. + */ + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * Usage statistics for the completion request. + */ + public function getUsage(): CompletionUsage + { + return $this->usage; + } + + /** + * Usage statistics for the completion request. + */ + public function setUsage(CompletionUsage $usage): self + { + $this->initialized['usage'] = true; + $this->usage = $usage; + return $this; + } +} diff --git a/generated/Model/CreateChatCompletionFunctionResponseChoicesItem.php b/generated/Model/CreateChatCompletionFunctionResponseChoicesItem.php new file mode 100644 index 0000000..b1e6ab4 --- /dev/null +++ b/generated/Model/CreateChatCompletionFunctionResponseChoicesItem.php @@ -0,0 +1,104 @@ +setFinishReason($finishReason); + } + if ($index !== null) { + $this->setIndex($index); + } + if ($message !== null) { + $this->setMessage($message); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * &chat_completion_function_finish_reason_description | The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, `content_filter` if content was omitted due to a flag from our content filters, or `function_call` if the model called a function. + */ + public function getFinishReason(): string + { + return $this->finishReason; + } + + /** + * &chat_completion_function_finish_reason_description | The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, `length` if the maximum number of tokens specified in the request was reached, `content_filter` if content was omitted due to a flag from our content filters, or `function_call` if the model called a function. + */ + public function setFinishReason(string $finishReason): self + { + $this->initialized['finishReason'] = true; + $this->finishReason = $finishReason; + return $this; + } + + /** + * The index of the choice in the list of choices. + */ + public function getIndex(): int + { + return $this->index; + } + + /** + * The index of the choice in the list of choices. + */ + public function setIndex(int $index): self + { + $this->initialized['index'] = true; + $this->index = $index; + return $this; + } + + /** + * A chat completion message generated by the model. + */ + public function getMessage(): ChatCompletionResponseMessage + { + return $this->message; + } + + /** + * A chat completion message generated by the model. + */ + public function setMessage(ChatCompletionResponseMessage $message): self + { + $this->initialized['message'] = true; + $this->message = $message; + return $this; + } +} diff --git a/generated/Model/CreateChatCompletionRequest.php b/generated/Model/CreateChatCompletionRequest.php index 1f82a42..35117ae 100644 --- a/generated/Model/CreateChatCompletionRequest.php +++ b/generated/Model/CreateChatCompletionRequest.php @@ -11,56 +11,79 @@ class CreateChatCompletionRequest extends ArrayObject protected array $initialized = []; /** - * ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API. + * A list of messages comprising the conversation so far. [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models). + * + * @var mixed[] */ - protected ?string $model = null; + protected ?array $messages = null; /** - * A list of messages comprising the conversation so far. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_format_inputs_to_ChatGPT_models.ipynb). + * ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API. * - * @var ChatCompletionRequestMessage[]|null + * @var mixed */ - protected ?array $messages = null; + protected $model = null; /** - * A list of functions the model may generate JSON inputs for. + * Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. + * - * @var ChatCompletionFunctions[]|null + * @var float|null */ - protected ?array $functions = null; + protected $frequencyPenalty = 0; /** - * Controls how the model responds to function calls. "none" means the model does not call a function, and responds to the end-user. "auto" means the model can pick between an end-user or calling a function. Specifying a particular function via `{"name":\ "my_function"}` forces the model to call that function. "none" is the default when no functions are present. "auto" is the default if functions are present. + * Modify the likelihood of specified tokens appearing in the completion. + * - * @var mixed + * @var array|null */ - protected $functionCall = null; + protected $logitBias = null; /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + * Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`. This option is currently not available on the `gpt-4-vision-preview` model. + */ + protected ?bool $logprobs = false; - * - * @var float|null + /** + * An integer between 0 and 5 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used. */ - protected $temperature = 1; + protected ?int $topLogprobs = null; /** - * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * The maximum number of [tokens](/tokenizer) that can be generated in the chat completion. + + The total length of input tokens and generated tokens is limited by the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. + */ + protected ?int $maxTokens = null; + + /** + * How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. + */ + protected ?int $n = 1; + + /** + * Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. * * @var float|null */ - protected $topP = 1; + protected $presencePenalty = 0; /** - * How many chat completion choices to generate for each input message. + * An object specifying the format that the model must output. Compatible with `gpt-4-1106-preview` and `gpt-3.5-turbo-1106`. + + Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the message the model generates is valid JSON. + + **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. */ - protected ?int $n = 1; + protected ?CreateChatCompletionRequestResponseFormat $responseFormat = null; /** - * If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_stream_completions.ipynb). + * This feature is in Beta. + Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. */ - protected ?bool $stream = false; + protected ?int $seed = null; /** * Up to 4 sequences where the API will stop generating further tokens. @@ -70,34 +93,39 @@ class CreateChatCompletionRequest extends ArrayObject protected $stop = null; /** - * The maximum number of [tokens](/tokenizer) to generate in the chat completion. - The total length of input tokens and generated tokens is limited by the model's context length. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb) for counting tokens. + * If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). */ - protected ?int $maxTokens = null; + protected ?bool $stream = false; /** - * Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. * * @var float|null */ - protected $presencePenalty = 0; + protected $temperature = 1; /** - * Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. + * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. * * @var float|null */ - protected $frequencyPenalty = 0; + protected $topP = 1; /** - * Modify the likelihood of specified tokens appearing in the completion. + * A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. + * + * @var ChatCompletionTool[] + */ + protected ?array $tools = null; + /** + * Controls which (if any) function is called by the model. * - * @var mixed[]|null + * @var mixed */ - protected ?iterable $logitBias = null; + protected $toolChoice = null; /** * A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). @@ -105,71 +133,129 @@ class CreateChatCompletionRequest extends ArrayObject protected ?string $user = null; /** - * @param string $model ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API. - * @param ChatCompletionRequestMessage[] $messages A list of messages comprising the conversation so far. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_format_inputs_to_ChatGPT_models.ipynb). - * @param ChatCompletionFunctions[] $functions A list of functions the model may generate JSON inputs for. - * @param mixed $functionCall Controls how the model responds to function calls. "none" means the model does not call a function, and responds to the end-user. "auto" means the model can pick between an end-user or calling a function. Specifying a particular function via `{"name":\ "my_function"}` forces the model to call that function. "none" is the default when no functions are present. "auto" is the default if functions are present. + * Deprecated in favor of `tool_choice`. + + * + * @deprecated + * + * @var mixed + */ + protected $functionCall = null; + + /** + * Deprecated in favor of `tools`. + + * + * @deprecated + * + * @var ChatCompletionFunctions[] + */ + protected ?array $functions = null; + + /** + * @param mixed[] $messages A list of messages comprising the conversation so far. [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models). + * @param mixed $model ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API. + * @param float|null $frequencyPenalty Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. + * [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) + * @param array|null $logitBias Modify the likelihood of specified tokens appearing in the completion. + * Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. + * @param bool|null $logprobs Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`. This option is currently not available on the `gpt-4-vision-preview` model. + * @param int|null $topLogprobs An integer between 0 and 5 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used. + * @param int|null $maxTokens The maximum number of [tokens](/tokenizer) that can be generated in the chat completion. + * The total length of input tokens and generated tokens is limited by the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. + * @param int|null $n How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. + * @param float|null $presencePenalty Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. + * [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) + * @param CreateChatCompletionRequestResponseFormat $responseFormat An object specifying the format that the model must output. Compatible with `gpt-4-1106-preview` and `gpt-3.5-turbo-1106`. + * Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the message the model generates is valid JSON. + * **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. + * @param int|null $seed This feature is in Beta. + * If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. + * Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. + * @param mixed $stop Up to 4 sequences where the API will stop generating further tokens. + * @param bool|null $stream If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). * @param float|null $temperature What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. * We generally recommend altering this or `top_p` but not both. * @param float|null $topP An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. * We generally recommend altering this or `temperature` but not both. - * @param int|null $n How many chat completion choices to generate for each input message. - * @param bool|null $stream If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_stream_completions.ipynb). - * @param mixed $stop Up to 4 sequences where the API will stop generating further tokens. - * @param int|null $maxTokens The maximum number of [tokens](/tokenizer) to generate in the chat completion. - * The total length of input tokens and generated tokens is limited by the model's context length. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb) for counting tokens. - * @param float|null $presencePenalty Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. - * [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details) - * @param float|null $frequencyPenalty Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - * [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details) - * @param mixed[]|null $logitBias Modify the likelihood of specified tokens appearing in the completion. - * Accepts a json object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. + * @param ChatCompletionTool[] $tools A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. + * @param mixed $toolChoice Controls which (if any) function is called by the model. + * `none` means the model will not call a function and instead generates a message. + * `auto` means the model can pick between generating a message or calling a function. + * Specifying a particular function via `{"type: "function", "function": {"name": "my_function"}}` forces the model to call that function. + * `none` is the default when no functions are present. `auto` is the default if functions are present. * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - */ - public function __construct($model = null, $messages = null, $functions = null, mixed $functionCall = null, $temperature = 1, $topP = 1, $n = 1, $stream = false, mixed $stop = null, $maxTokens = null, $presencePenalty = 0, $frequencyPenalty = 0, $logitBias = null, $user = null) + * @param mixed $functionCall Deprecated in favor of `tool_choice`. + * Controls which (if any) function is called by the model. + * `none` means the model will not call a function and instead generates a message. + * `auto` means the model can pick between generating a message or calling a function. + * Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. + * `none` is the default when no functions are present. `auto` is the default if functions are present. + * @param ChatCompletionFunctions[] $functions Deprecated in favor of `tools`. + * A list of functions the model may generate JSON inputs for. + */ + public function __construct($messages = null, mixed $model = null, $frequencyPenalty = 0, $logitBias = null, $logprobs = false, $topLogprobs = null, $maxTokens = null, $n = 1, $presencePenalty = 0, $responseFormat = null, $seed = null, mixed $stop = null, $stream = false, $temperature = 1, $topP = 1, $tools = null, mixed $toolChoice = null, $user = null, mixed $functionCall = null, $functions = null) { + if ($messages !== null) { + $this->setMessages($messages); + } if ($model !== null) { $this->setModel($model); } - if ($messages !== null) { - $this->setMessages($messages); + if ($frequencyPenalty !== null) { + $this->setFrequencyPenalty($frequencyPenalty); } - if ($functions !== null) { - $this->setFunctions($functions); + if ($logitBias !== null) { + $this->setLogitBias($logitBias); } - if ($functionCall !== null) { - $this->setFunctionCall($functionCall); + if ($logprobs !== null) { + $this->setLogprobs($logprobs); } - if ($temperature !== null) { - $this->setTemperature($temperature); + if ($topLogprobs !== null) { + $this->setTopLogprobs($topLogprobs); } - if ($topP !== null) { - $this->setTopP($topP); + if ($maxTokens !== null) { + $this->setMaxTokens($maxTokens); } if ($n !== null) { $this->setN($n); } - if ($stream !== null) { - $this->setStream($stream); + if ($presencePenalty !== null) { + $this->setPresencePenalty($presencePenalty); + } + if ($responseFormat !== null) { + $this->setResponseFormat($responseFormat); + } + if ($seed !== null) { + $this->setSeed($seed); } if ($stop !== null) { $this->setStop($stop); } - if ($maxTokens !== null) { - $this->setMaxTokens($maxTokens); + if ($stream !== null) { + $this->setStream($stream); } - if ($presencePenalty !== null) { - $this->setPresencePenalty($presencePenalty); + if ($temperature !== null) { + $this->setTemperature($temperature); } - if ($frequencyPenalty !== null) { - $this->setFrequencyPenalty($frequencyPenalty); + if ($topP !== null) { + $this->setTopP($topP); } - if ($logitBias !== null) { - $this->setLogitBias($logitBias); + if ($tools !== null) { + $this->setTools($tools); + } + if ($toolChoice !== null) { + $this->setToolChoice($toolChoice); } if ($user !== null) { $this->setUser($user); } + if ($functionCall !== null) { + $this->setFunctionCall($functionCall); + } + if ($functions !== null) { + $this->setFunctions($functions); + } } public function isInitialized($property): bool @@ -177,10 +263,34 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } + /** + * A list of messages comprising the conversation so far. [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models). + * + * @return mixed[] + */ + public function getMessages(): array + { + return $this->messages; + } + + /** + * A list of messages comprising the conversation so far. [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models). + * + * @param mixed[] $messages + */ + public function setMessages(array $messages): self + { + $this->initialized['messages'] = true; + $this->messages = $messages; + return $this; + } + /** * ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API. + * + * @return mixed */ - public function getModel(): string + public function getModel() { return $this->model; } @@ -188,7 +298,7 @@ public function getModel(): string /** * ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API. */ - public function setModel(string $model): self + public function setModel(mixed $model): self { $this->initialized['model'] = true; $this->model = $model; @@ -196,111 +306,111 @@ public function setModel(string $model): self } /** - * A list of messages comprising the conversation so far. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_format_inputs_to_ChatGPT_models.ipynb). - * - * @return ChatCompletionRequestMessage[] + * Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. + + [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) */ - public function getMessages(): array + public function getFrequencyPenalty(): ?float { - return $this->messages; + return $this->frequencyPenalty; } /** - * A list of messages comprising the conversation so far. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_format_inputs_to_ChatGPT_models.ipynb). - * - * @param ChatCompletionRequestMessage[] $messages + * Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. + + [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) */ - public function setMessages(array $messages): self + public function setFrequencyPenalty(?float $frequencyPenalty): self { - $this->initialized['messages'] = true; - $this->messages = $messages; + $this->initialized['frequencyPenalty'] = true; + $this->frequencyPenalty = $frequencyPenalty; return $this; } /** - * A list of functions the model may generate JSON inputs for. + * Modify the likelihood of specified tokens appearing in the completion. + * - * @return ChatCompletionFunctions[] + * @return array|null */ - public function getFunctions(): array + public function getLogitBias(): ?iterable { - return $this->functions; + return $this->logitBias; } /** - * A list of functions the model may generate JSON inputs for. + * Modify the likelihood of specified tokens appearing in the completion. + * - * @param ChatCompletionFunctions[] $functions + * @param array|null $logitBias */ - public function setFunctions(array $functions): self + public function setLogitBias(?iterable $logitBias): self { - $this->initialized['functions'] = true; - $this->functions = $functions; + $this->initialized['logitBias'] = true; + $this->logitBias = $logitBias; return $this; } /** - * Controls how the model responds to function calls. "none" means the model does not call a function, and responds to the end-user. "auto" means the model can pick between an end-user or calling a function. Specifying a particular function via `{"name":\ "my_function"}` forces the model to call that function. "none" is the default when no functions are present. "auto" is the default if functions are present. - * - * @return mixed + * Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`. This option is currently not available on the `gpt-4-vision-preview` model. */ - public function getFunctionCall() + public function getLogprobs(): ?bool { - return $this->functionCall; + return $this->logprobs; } /** - * Controls how the model responds to function calls. "none" means the model does not call a function, and responds to the end-user. "auto" means the model can pick between an end-user or calling a function. Specifying a particular function via `{"name":\ "my_function"}` forces the model to call that function. "none" is the default when no functions are present. "auto" is the default if functions are present. + * Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`. This option is currently not available on the `gpt-4-vision-preview` model. */ - public function setFunctionCall(mixed $functionCall): self + public function setLogprobs(?bool $logprobs): self { - $this->initialized['functionCall'] = true; - $this->functionCall = $functionCall; + $this->initialized['logprobs'] = true; + $this->logprobs = $logprobs; return $this; } /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - We generally recommend altering this or `top_p` but not both. + * An integer between 0 and 5 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used. */ - public function getTemperature(): ?float + public function getTopLogprobs(): ?int { - return $this->temperature; + return $this->topLogprobs; } /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - We generally recommend altering this or `top_p` but not both. + * An integer between 0 and 5 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used. */ - public function setTemperature(?float $temperature): self + public function setTopLogprobs(?int $topLogprobs): self { - $this->initialized['temperature'] = true; - $this->temperature = $temperature; + $this->initialized['topLogprobs'] = true; + $this->topLogprobs = $topLogprobs; return $this; } /** - * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - We generally recommend altering this or `temperature` but not both. + * The maximum number of [tokens](/tokenizer) that can be generated in the chat completion. + + The total length of input tokens and generated tokens is limited by the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. */ - public function getTopP(): ?float + public function getMaxTokens(): ?int { - return $this->topP; + return $this->maxTokens; } /** - * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - We generally recommend altering this or `temperature` but not both. + * The maximum number of [tokens](/tokenizer) that can be generated in the chat completion. + + The total length of input tokens and generated tokens is limited by the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. */ - public function setTopP(?float $topP): self + public function setMaxTokens(?int $maxTokens): self { - $this->initialized['topP'] = true; - $this->topP = $topP; + $this->initialized['maxTokens'] = true; + $this->maxTokens = $maxTokens; return $this; } /** - * How many chat completion choices to generate for each input message. + * How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. */ public function getN(): ?int { @@ -308,7 +418,7 @@ public function getN(): ?int } /** - * How many chat completion choices to generate for each input message. + * How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. */ public function setN(?int $n): self { @@ -318,20 +428,70 @@ public function setN(?int $n): self } /** - * If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_stream_completions.ipynb). + * Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. + + [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) */ - public function getStream(): ?bool + public function getPresencePenalty(): ?float { - return $this->stream; + return $this->presencePenalty; } /** - * If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_stream_completions.ipynb). + * Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. + + [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) */ - public function setStream(?bool $stream): self + public function setPresencePenalty(?float $presencePenalty): self { - $this->initialized['stream'] = true; - $this->stream = $stream; + $this->initialized['presencePenalty'] = true; + $this->presencePenalty = $presencePenalty; + return $this; + } + + /** + * An object specifying the format that the model must output. Compatible with `gpt-4-1106-preview` and `gpt-3.5-turbo-1106`. + + Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the message the model generates is valid JSON. + + **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. + */ + public function getResponseFormat(): CreateChatCompletionRequestResponseFormat + { + return $this->responseFormat; + } + + /** + * An object specifying the format that the model must output. Compatible with `gpt-4-1106-preview` and `gpt-3.5-turbo-1106`. + + Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the message the model generates is valid JSON. + + **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. + */ + public function setResponseFormat(CreateChatCompletionRequestResponseFormat $responseFormat): self + { + $this->initialized['responseFormat'] = true; + $this->responseFormat = $responseFormat; + return $this; + } + + /** + * This feature is in Beta. + Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. + */ + public function getSeed(): ?int + { + return $this->seed; + } + + /** + * This feature is in Beta. + Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. + */ + public function setSeed(?int $seed): self + { + $this->initialized['seed'] = true; + $this->seed = $seed; return $this; } @@ -356,85 +516,107 @@ public function setStop(mixed $stop): self } /** - * The maximum number of [tokens](/tokenizer) to generate in the chat completion. - The total length of input tokens and generated tokens is limited by the model's context length. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb) for counting tokens. + * If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). */ - public function getMaxTokens(): ?int + public function getStream(): ?bool { - return $this->maxTokens; + return $this->stream; } /** - * The maximum number of [tokens](/tokenizer) to generate in the chat completion. - The total length of input tokens and generated tokens is limited by the model's context length. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb) for counting tokens. + * If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). */ - public function setMaxTokens(?int $maxTokens): self + public function setStream(?bool $stream): self { - $this->initialized['maxTokens'] = true; - $this->maxTokens = $maxTokens; + $this->initialized['stream'] = true; + $this->stream = $stream; return $this; } /** - * Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. - [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details) + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + + We generally recommend altering this or `top_p` but not both. */ - public function getPresencePenalty(): ?float + public function getTemperature(): ?float { - return $this->presencePenalty; + return $this->temperature; } /** - * Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. - [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details) + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + + We generally recommend altering this or `top_p` but not both. */ - public function setPresencePenalty(?float $presencePenalty): self + public function setTemperature(?float $temperature): self { - $this->initialized['presencePenalty'] = true; - $this->presencePenalty = $presencePenalty; + $this->initialized['temperature'] = true; + $this->temperature = $temperature; return $this; } /** - * Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details) + * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. + + We generally recommend altering this or `temperature` but not both. */ - public function getFrequencyPenalty(): ?float + public function getTopP(): ?float { - return $this->frequencyPenalty; + return $this->topP; } /** - * Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details) + * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. + + We generally recommend altering this or `temperature` but not both. */ - public function setFrequencyPenalty(?float $frequencyPenalty): self + public function setTopP(?float $topP): self { - $this->initialized['frequencyPenalty'] = true; - $this->frequencyPenalty = $frequencyPenalty; + $this->initialized['topP'] = true; + $this->topP = $topP; return $this; } /** - * Modify the likelihood of specified tokens appearing in the completion. + * A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. + * + * @return ChatCompletionTool[] + */ + public function getTools(): array + { + return $this->tools; + } + /** + * A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. * - * @return mixed[]|null + * @param ChatCompletionTool[] $tools */ - public function getLogitBias(): ?iterable + public function setTools(array $tools): self { - return $this->logitBias; + $this->initialized['tools'] = true; + $this->tools = $tools; + return $this; } /** - * Modify the likelihood of specified tokens appearing in the completion. + * Controls which (if any) function is called by the model. * - * @param mixed[]|null $logitBias + * @return mixed */ - public function setLogitBias(?iterable $logitBias): self + public function getToolChoice() { - $this->initialized['logitBias'] = true; - $this->logitBias = $logitBias; + return $this->toolChoice; + } + + /** + * Controls which (if any) function is called by the model. + `none` is the default when no functions are present. `auto` is the default if functions are present. + */ + public function setToolChoice(mixed $toolChoice): self + { + $this->initialized['toolChoice'] = true; + $this->toolChoice = $toolChoice; return $this; } @@ -455,4 +637,58 @@ public function setUser(string $user): self $this->user = $user; return $this; } + + /** + * Deprecated in favor of `tool_choice`. + + * + * @deprecated + * + * @return mixed + */ + public function getFunctionCall() + { + return $this->functionCall; + } + + /** + * Deprecated in favor of `tool_choice`. + + * + * @deprecated + */ + public function setFunctionCall(mixed $functionCall): self + { + $this->initialized['functionCall'] = true; + $this->functionCall = $functionCall; + return $this; + } + + /** + * Deprecated in favor of `tools`. + + * + * @deprecated + * + * @return ChatCompletionFunctions[] + */ + public function getFunctions(): array + { + return $this->functions; + } + + /** + * Deprecated in favor of `tools`. + + * + * @param ChatCompletionFunctions[] $functions + * + * @deprecated + */ + public function setFunctions(array $functions): self + { + $this->initialized['functions'] = true; + $this->functions = $functions; + return $this; + } } diff --git a/generated/Model/CreateChatCompletionRequestResponseFormat.php b/generated/Model/CreateChatCompletionRequestResponseFormat.php new file mode 100644 index 0000000..afe6e83 --- /dev/null +++ b/generated/Model/CreateChatCompletionRequestResponseFormat.php @@ -0,0 +1,50 @@ +setType($type); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * Must be one of `text` or `json_object`. + */ + public function getType(): string + { + return $this->type; + } + + /** + * Must be one of `text` or `json_object`. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } +} diff --git a/generated/Model/CreateChatCompletionResponse.php b/generated/Model/CreateChatCompletionResponse.php index 634a43a..a0fc878 100644 --- a/generated/Model/CreateChatCompletionResponse.php +++ b/generated/Model/CreateChatCompletionResponse.php @@ -10,36 +10,62 @@ class CreateChatCompletionResponse extends ArrayObject { protected array $initialized = []; + /** + * A unique identifier for the chat completion. + */ protected ?string $id = null; - protected ?string $object = null; + /** + * A list of chat completion choices. Can be more than one if `n` is greater than 1. + * + * @var CreateChatCompletionResponseChoicesItem[] + */ + protected ?array $choices = null; + /** + * The Unix timestamp (in seconds) of when the chat completion was created. + */ protected ?int $created = null; + /** + * The model used for the chat completion. + */ protected ?string $model = null; /** - * @var CreateChatCompletionResponseChoicesItem[]|null + * This fingerprint represents the backend configuration that the model runs with. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + */ + protected ?string $systemFingerprint = null; + + /** + * The object type, which is always `chat.completion`. */ - protected ?array $choices = null; + protected ?string $object = null; - protected ?CreateChatCompletionResponseUsage $usage = null; + /** + * Usage statistics for the completion request. + */ + protected ?CompletionUsage $usage = null; /** - * @param string $id - * @param string $object - * @param int $created - * @param string $model - * @param CreateChatCompletionResponseChoicesItem[] $choices - * @param CreateChatCompletionResponseUsage $usage + * @param string $id A unique identifier for the chat completion. + * @param CreateChatCompletionResponseChoicesItem[] $choices A list of chat completion choices. Can be more than one if `n` is greater than 1. + * @param int $created The Unix timestamp (in seconds) of when the chat completion was created. + * @param string $model The model used for the chat completion. + * @param string $systemFingerprint This fingerprint represents the backend configuration that the model runs with. + * Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + * @param string $object The object type, which is always `chat.completion`. + * @param CompletionUsage $usage Usage statistics for the completion request. */ - public function __construct($id = null, $object = null, $created = null, $model = null, $choices = null, $usage = null) + public function __construct($id = null, $choices = null, $created = null, $model = null, $systemFingerprint = null, $object = null, $usage = null) { if ($id !== null) { $this->setId($id); } - if ($object !== null) { - $this->setObject($object); + if ($choices !== null) { + $this->setChoices($choices); } if ($created !== null) { $this->setCreated($created); @@ -47,8 +73,11 @@ public function __construct($id = null, $object = null, $created = null, $model if ($model !== null) { $this->setModel($model); } - if ($choices !== null) { - $this->setChoices($choices); + if ($systemFingerprint !== null) { + $this->setSystemFingerprint($systemFingerprint); + } + if ($object !== null) { + $this->setObject($object); } if ($usage !== null) { $this->setUsage($usage); @@ -60,11 +89,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } + /** + * A unique identifier for the chat completion. + */ public function getId(): string { return $this->id; } + /** + * A unique identifier for the chat completion. + */ public function setId(string $id): self { $this->initialized['id'] = true; @@ -72,23 +107,39 @@ public function setId(string $id): self return $this; } - public function getObject(): string + /** + * A list of chat completion choices. Can be more than one if `n` is greater than 1. + * + * @return CreateChatCompletionResponseChoicesItem[] + */ + public function getChoices(): array { - return $this->object; + return $this->choices; } - public function setObject(string $object): self + /** + * A list of chat completion choices. Can be more than one if `n` is greater than 1. + * + * @param CreateChatCompletionResponseChoicesItem[] $choices + */ + public function setChoices(array $choices): self { - $this->initialized['object'] = true; - $this->object = $object; + $this->initialized['choices'] = true; + $this->choices = $choices; return $this; } + /** + * The Unix timestamp (in seconds) of when the chat completion was created. + */ public function getCreated(): int { return $this->created; } + /** + * The Unix timestamp (in seconds) of when the chat completion was created. + */ public function setCreated(int $created): self { $this->initialized['created'] = true; @@ -96,11 +147,17 @@ public function setCreated(int $created): self return $this; } + /** + * The model used for the chat completion. + */ public function getModel(): string { return $this->model; } + /** + * The model used for the chat completion. + */ public function setModel(string $model): self { $this->initialized['model'] = true; @@ -109,29 +166,57 @@ public function setModel(string $model): self } /** - * @return CreateChatCompletionResponseChoicesItem[] + * This fingerprint represents the backend configuration that the model runs with. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. */ - public function getChoices(): array + public function getSystemFingerprint(): string { - return $this->choices; + return $this->systemFingerprint; } /** - * @param CreateChatCompletionResponseChoicesItem[] $choices + * This fingerprint represents the backend configuration that the model runs with. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. */ - public function setChoices(array $choices): self + public function setSystemFingerprint(string $systemFingerprint): self { - $this->initialized['choices'] = true; - $this->choices = $choices; + $this->initialized['systemFingerprint'] = true; + $this->systemFingerprint = $systemFingerprint; return $this; } - public function getUsage(): CreateChatCompletionResponseUsage + /** + * The object type, which is always `chat.completion`. + */ + public function getObject(): string + { + return $this->object; + } + + /** + * The object type, which is always `chat.completion`. + */ + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * Usage statistics for the completion request. + */ + public function getUsage(): CompletionUsage { return $this->usage; } - public function setUsage(CreateChatCompletionResponseUsage $usage): self + /** + * Usage statistics for the completion request. + */ + public function setUsage(CompletionUsage $usage): self { $this->initialized['usage'] = true; $this->usage = $usage; diff --git a/generated/Model/CreateChatCompletionResponseChoicesItem.php b/generated/Model/CreateChatCompletionResponseChoicesItem.php index 515bceb..e1554be 100644 --- a/generated/Model/CreateChatCompletionResponseChoicesItem.php +++ b/generated/Model/CreateChatCompletionResponseChoicesItem.php @@ -10,27 +10,49 @@ class CreateChatCompletionResponseChoicesItem extends ArrayObject { protected array $initialized = []; + /** + * The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. + */ + protected ?string $finishReason = null; + + /** + * The index of the choice in the list of choices. + */ protected ?int $index = null; + /** + * A chat completion message generated by the model. + */ protected ?ChatCompletionResponseMessage $message = null; - protected ?string $finishReason = null; + /** + * Log probability information for the choice. + */ + protected ?CreateChatCompletionResponseChoicesItemLogprobs $logprobs = null; /** - * @param int $index - * @param ChatCompletionResponseMessage $message - * @param string|null $finishReason + * @param string $finishReason The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + * `length` if the maximum number of tokens specified in the request was reached, + * `content_filter` if content was omitted due to a flag from our content filters, + * `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. + * @param int $index The index of the choice in the list of choices. + * @param ChatCompletionResponseMessage $message A chat completion message generated by the model. + * @param CreateChatCompletionResponseChoicesItemLogprobs|null $logprobs Log probability information for the choice. */ - public function __construct($index = null, $message = null, $finishReason = null) + public function __construct($finishReason = null, $index = null, $message = null, $logprobs = null) { + if ($finishReason !== null) { + $this->setFinishReason($finishReason); + } if ($index !== null) { $this->setIndex($index); } if ($message !== null) { $this->setMessage($message); } - if ($finishReason !== null) { - $this->setFinishReason($finishReason); + if ($logprobs !== null) { + $this->setLogprobs($logprobs); } } @@ -39,11 +61,37 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } + /** + * The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. + */ + public function getFinishReason(): string + { + return $this->finishReason; + } + + /** + * The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. + */ + public function setFinishReason(string $finishReason): self + { + $this->initialized['finishReason'] = true; + $this->finishReason = $finishReason; + return $this; + } + + /** + * The index of the choice in the list of choices. + */ public function getIndex(): int { return $this->index; } + /** + * The index of the choice in the list of choices. + */ public function setIndex(int $index): self { $this->initialized['index'] = true; @@ -51,11 +99,17 @@ public function setIndex(int $index): self return $this; } + /** + * A chat completion message generated by the model. + */ public function getMessage(): ChatCompletionResponseMessage { return $this->message; } + /** + * A chat completion message generated by the model. + */ public function setMessage(ChatCompletionResponseMessage $message): self { $this->initialized['message'] = true; @@ -63,15 +117,21 @@ public function setMessage(ChatCompletionResponseMessage $message): self return $this; } - public function getFinishReason(): ?string + /** + * Log probability information for the choice. + */ + public function getLogprobs(): ?CreateChatCompletionResponseChoicesItemLogprobs { - return $this->finishReason; + return $this->logprobs; } - public function setFinishReason(?string $finishReason): self + /** + * Log probability information for the choice. + */ + public function setLogprobs(?CreateChatCompletionResponseChoicesItemLogprobs $logprobs): self { - $this->initialized['finishReason'] = true; - $this->finishReason = $finishReason; + $this->initialized['logprobs'] = true; + $this->logprobs = $logprobs; return $this; } } diff --git a/generated/Model/CreateChatCompletionResponseChoicesItemLogprobs.php b/generated/Model/CreateChatCompletionResponseChoicesItemLogprobs.php new file mode 100644 index 0000000..2af7628 --- /dev/null +++ b/generated/Model/CreateChatCompletionResponseChoicesItemLogprobs.php @@ -0,0 +1,56 @@ +setContent($content); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * A list of message content tokens with log probability information. + * + * @return ChatCompletionTokenLogprob[]|null + */ + public function getContent(): ?array + { + return $this->content; + } + + /** + * A list of message content tokens with log probability information. + * + * @param ChatCompletionTokenLogprob[]|null $content + */ + public function setContent(?array $content): self + { + $this->initialized['content'] = true; + $this->content = $content; + return $this; + } +} diff --git a/generated/Model/CreateChatCompletionResponseUsage.php b/generated/Model/CreateChatCompletionResponseUsage.php deleted file mode 100644 index dcd15b0..0000000 --- a/generated/Model/CreateChatCompletionResponseUsage.php +++ /dev/null @@ -1,77 +0,0 @@ -setPromptTokens($promptTokens); - } - if ($completionTokens !== null) { - $this->setCompletionTokens($completionTokens); - } - if ($totalTokens !== null) { - $this->setTotalTokens($totalTokens); - } - } - - public function isInitialized($property): bool - { - return array_key_exists($property, $this->initialized); - } - - public function getPromptTokens(): int - { - return $this->promptTokens; - } - - public function setPromptTokens(int $promptTokens): self - { - $this->initialized['promptTokens'] = true; - $this->promptTokens = $promptTokens; - return $this; - } - - public function getCompletionTokens(): int - { - return $this->completionTokens; - } - - public function setCompletionTokens(int $completionTokens): self - { - $this->initialized['completionTokens'] = true; - $this->completionTokens = $completionTokens; - return $this; - } - - public function getTotalTokens(): int - { - return $this->totalTokens; - } - - public function setTotalTokens(int $totalTokens): self - { - $this->initialized['totalTokens'] = true; - $this->totalTokens = $totalTokens; - return $this; - } -} diff --git a/generated/Model/CreateChatCompletionStreamResponse.php b/generated/Model/CreateChatCompletionStreamResponse.php new file mode 100644 index 0000000..4e45ff2 --- /dev/null +++ b/generated/Model/CreateChatCompletionStreamResponse.php @@ -0,0 +1,195 @@ +setId($id); + } + if ($choices !== null) { + $this->setChoices($choices); + } + if ($created !== null) { + $this->setCreated($created); + } + if ($model !== null) { + $this->setModel($model); + } + if ($systemFingerprint !== null) { + $this->setSystemFingerprint($systemFingerprint); + } + if ($object !== null) { + $this->setObject($object); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * A unique identifier for the chat completion. Each chunk has the same ID. + */ + public function getId(): string + { + return $this->id; + } + + /** + * A unique identifier for the chat completion. Each chunk has the same ID. + */ + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + /** + * A list of chat completion choices. Can be more than one if `n` is greater than 1. + * + * @return CreateChatCompletionStreamResponseChoicesItem[] + */ + public function getChoices(): array + { + return $this->choices; + } + + /** + * A list of chat completion choices. Can be more than one if `n` is greater than 1. + * + * @param CreateChatCompletionStreamResponseChoicesItem[] $choices + */ + public function setChoices(array $choices): self + { + $this->initialized['choices'] = true; + $this->choices = $choices; + return $this; + } + + /** + * The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp. + */ + public function getCreated(): int + { + return $this->created; + } + + /** + * The Unix timestamp (in seconds) of when the chat completion was created. Each chunk has the same timestamp. + */ + public function setCreated(int $created): self + { + $this->initialized['created'] = true; + $this->created = $created; + return $this; + } + + /** + * The model to generate the completion. + */ + public function getModel(): string + { + return $this->model; + } + + /** + * The model to generate the completion. + */ + public function setModel(string $model): self + { + $this->initialized['model'] = true; + $this->model = $model; + return $this; + } + + /** + * This fingerprint represents the backend configuration that the model runs with. + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + */ + public function getSystemFingerprint(): string + { + return $this->systemFingerprint; + } + + /** + * This fingerprint represents the backend configuration that the model runs with. + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + */ + public function setSystemFingerprint(string $systemFingerprint): self + { + $this->initialized['systemFingerprint'] = true; + $this->systemFingerprint = $systemFingerprint; + return $this; + } + + /** + * The object type, which is always `chat.completion.chunk`. + */ + public function getObject(): string + { + return $this->object; + } + + /** + * The object type, which is always `chat.completion.chunk`. + */ + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } +} diff --git a/generated/Model/CreateChatCompletionStreamResponseChoicesItem.php b/generated/Model/CreateChatCompletionStreamResponseChoicesItem.php new file mode 100644 index 0000000..dd92de4 --- /dev/null +++ b/generated/Model/CreateChatCompletionStreamResponseChoicesItem.php @@ -0,0 +1,137 @@ +setDelta($delta); + } + if ($logprobs !== null) { + $this->setLogprobs($logprobs); + } + if ($finishReason !== null) { + $this->setFinishReason($finishReason); + } + if ($index !== null) { + $this->setIndex($index); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * A chat completion delta generated by streamed model responses. + */ + public function getDelta(): ChatCompletionStreamResponseDelta + { + return $this->delta; + } + + /** + * A chat completion delta generated by streamed model responses. + */ + public function setDelta(ChatCompletionStreamResponseDelta $delta): self + { + $this->initialized['delta'] = true; + $this->delta = $delta; + return $this; + } + + /** + * Log probability information for the choice. + */ + public function getLogprobs(): ?CreateChatCompletionStreamResponseChoicesItemLogprobs + { + return $this->logprobs; + } + + /** + * Log probability information for the choice. + */ + public function setLogprobs(?CreateChatCompletionStreamResponseChoicesItemLogprobs $logprobs): self + { + $this->initialized['logprobs'] = true; + $this->logprobs = $logprobs; + return $this; + } + + /** + * The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. + */ + public function getFinishReason(): ?string + { + return $this->finishReason; + } + + /** + * The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + `tool_calls` if the model called a tool, or `function_call` (deprecated) if the model called a function. + */ + public function setFinishReason(?string $finishReason): self + { + $this->initialized['finishReason'] = true; + $this->finishReason = $finishReason; + return $this; + } + + /** + * The index of the choice in the list of choices. + */ + public function getIndex(): int + { + return $this->index; + } + + /** + * The index of the choice in the list of choices. + */ + public function setIndex(int $index): self + { + $this->initialized['index'] = true; + $this->index = $index; + return $this; + } +} diff --git a/generated/Model/CreateChatCompletionStreamResponseChoicesItemLogprobs.php b/generated/Model/CreateChatCompletionStreamResponseChoicesItemLogprobs.php new file mode 100644 index 0000000..61bf72d --- /dev/null +++ b/generated/Model/CreateChatCompletionStreamResponseChoicesItemLogprobs.php @@ -0,0 +1,56 @@ +setContent($content); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * A list of message content tokens with log probability information. + * + * @return ChatCompletionTokenLogprob[]|null + */ + public function getContent(): ?array + { + return $this->content; + } + + /** + * A list of message content tokens with log probability information. + * + * @param ChatCompletionTokenLogprob[]|null $content + */ + public function setContent(?array $content): self + { + $this->initialized['content'] = true; + $this->content = $content; + return $this; + } +} diff --git a/generated/Model/CreateClassificationRequest.php b/generated/Model/CreateClassificationRequest.php deleted file mode 100644 index 600b0d5..0000000 --- a/generated/Model/CreateClassificationRequest.php +++ /dev/null @@ -1,447 +0,0 @@ - token from being generated. - * @param bool|null $returnPrompt If set to `true`, the returned JSON will include a "prompt" field containing the final prompt that was used to request a completion. This is mainly useful for debugging purposes. - * @param bool|null $returnMetadata A special boolean flag for showing metadata. If set to `true`, each document entry in the returned JSON will contain a "metadata" field. - * This flag only takes effect when `file` is set. - * @param mixed[]|null $expand If an object name is in the list, we provide the full information of the object; otherwise, we only provide the object ID. Currently we support `completion` and `file` objects for expansion. - * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - */ - public function __construct($model = null, $query = null, $examples = null, $file = null, $labels = null, $searchModel = 'ada', $temperature = 0, $logprobs = null, $maxExamples = 200, $logitBias = null, $returnPrompt = false, $returnMetadata = false, $expand = [], $user = null) - { - if ($model !== null) { - $this->setModel($model); - } - if ($query !== null) { - $this->setQuery($query); - } - if ($examples !== null) { - $this->setExamples($examples); - } - if ($file !== null) { - $this->setFile($file); - } - if ($labels !== null) { - $this->setLabels($labels); - } - if ($searchModel !== null) { - $this->setSearchModel($searchModel); - } - if ($temperature !== null) { - $this->setTemperature($temperature); - } - if ($logprobs !== null) { - $this->setLogprobs($logprobs); - } - if ($maxExamples !== null) { - $this->setMaxExamples($maxExamples); - } - if ($logitBias !== null) { - $this->setLogitBias($logitBias); - } - if ($returnPrompt !== null) { - $this->setReturnPrompt($returnPrompt); - } - if ($returnMetadata !== null) { - $this->setReturnMetadata($returnMetadata); - } - if ($expand !== null) { - $this->setExpand($expand); - } - if ($user !== null) { - $this->setUser($user); - } - } - - public function isInitialized($property): bool - { - return array_key_exists($property, $this->initialized); - } - - /** - * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. - */ - public function getModel(): string - { - return $this->model; - } - - /** - * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. - */ - public function setModel(string $model): self - { - $this->initialized['model'] = true; - $this->model = $model; - return $this; - } - - /** - * Query to be classified. - */ - public function getQuery(): string - { - return $this->query; - } - - /** - * Query to be classified. - */ - public function setQuery(string $query): self - { - $this->initialized['query'] = true; - $this->query = $query; - return $this; - } - - /** - * A list of examples with labels, in the following format: - - * - * @return string[][]|null - */ - public function getExamples(): ?array - { - return $this->examples; - } - - /** - * A list of examples with labels, in the following format: - * - * @param string[][]|null $examples - */ - public function setExamples(?array $examples): self - { - $this->initialized['examples'] = true; - $this->examples = $examples; - return $this; - } - - /** - * The ID of the uploaded file that contains training examples. See [upload file](/docs/api-reference/files/upload) for how to upload a file of the desired format and purpose. - You should specify either `examples` or `file`, but not both. - */ - public function getFile(): ?string - { - return $this->file; - } - - /** - * The ID of the uploaded file that contains training examples. See [upload file](/docs/api-reference/files/upload) for how to upload a file of the desired format and purpose. - You should specify either `examples` or `file`, but not both. - */ - public function setFile(?string $file): self - { - $this->initialized['file'] = true; - $this->file = $file; - return $this; - } - - /** - * The set of categories being classified. If not specified, candidate labels will be automatically collected from the examples you provide. All the label strings will be normalized to be capitalized. - * - * @return string[]|null - */ - public function getLabels(): ?array - { - return $this->labels; - } - - /** - * The set of categories being classified. If not specified, candidate labels will be automatically collected from the examples you provide. All the label strings will be normalized to be capitalized. - * - * @param string[]|null $labels - */ - public function setLabels(?array $labels): self - { - $this->initialized['labels'] = true; - $this->labels = $labels; - return $this; - } - - /** - * ID of the model to use for [Search](/docs/api-reference/searches/create). You can select one of `ada`, `babbage`, `curie`, or `davinci`. - */ - public function getSearchModel(): ?string - { - return $this->searchModel; - } - - /** - * ID of the model to use for [Search](/docs/api-reference/searches/create). You can select one of `ada`, `babbage`, `curie`, or `davinci`. - */ - public function setSearchModel(?string $searchModel): self - { - $this->initialized['searchModel'] = true; - $this->searchModel = $searchModel; - return $this; - } - - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - */ - public function getTemperature(): ?float - { - return $this->temperature; - } - - /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - */ - public function setTemperature(?float $temperature): self - { - $this->initialized['temperature'] = true; - $this->temperature = $temperature; - return $this; - } - - /** - * Include the log probabilities on the `logprobs` most likely tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. - When `logprobs` is set, `completion` will be automatically added into `expand` to get the logprobs. - */ - public function getLogprobs(): ?int - { - return $this->logprobs; - } - - /** - * Include the log probabilities on the `logprobs` most likely tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. - When `logprobs` is set, `completion` will be automatically added into `expand` to get the logprobs. - */ - public function setLogprobs(?int $logprobs): self - { - $this->initialized['logprobs'] = true; - $this->logprobs = $logprobs; - return $this; - } - - /** - * The maximum number of examples to be ranked by [Search](/docs/api-reference/searches/create) when using `file`. Setting it to a higher value leads to improved accuracy but with increased latency and cost. - */ - public function getMaxExamples(): ?int - { - return $this->maxExamples; - } - - /** - * The maximum number of examples to be ranked by [Search](/docs/api-reference/searches/create) when using `file`. Setting it to a higher value leads to improved accuracy but with increased latency and cost. - */ - public function setMaxExamples(?int $maxExamples): self - { - $this->initialized['maxExamples'] = true; - $this->maxExamples = $maxExamples; - return $this; - } - - /** - * Modify the likelihood of specified tokens appearing in the completion. - - * - * @return mixed[]|null - */ - public function getLogitBias(): ?iterable - { - return $this->logitBias; - } - - /** - * Modify the likelihood of specified tokens appearing in the completion. - * - * @param mixed[]|null $logitBias - */ - public function setLogitBias(?iterable $logitBias): self - { - $this->initialized['logitBias'] = true; - $this->logitBias = $logitBias; - return $this; - } - - /** - * If set to `true`, the returned JSON will include a "prompt" field containing the final prompt that was used to request a completion. This is mainly useful for debugging purposes. - */ - public function getReturnPrompt(): ?bool - { - return $this->returnPrompt; - } - - /** - * If set to `true`, the returned JSON will include a "prompt" field containing the final prompt that was used to request a completion. This is mainly useful for debugging purposes. - */ - public function setReturnPrompt(?bool $returnPrompt): self - { - $this->initialized['returnPrompt'] = true; - $this->returnPrompt = $returnPrompt; - return $this; - } - - /** - * A special boolean flag for showing metadata. If set to `true`, each document entry in the returned JSON will contain a "metadata" field. - This flag only takes effect when `file` is set. - */ - public function getReturnMetadata(): ?bool - { - return $this->returnMetadata; - } - - /** - * A special boolean flag for showing metadata. If set to `true`, each document entry in the returned JSON will contain a "metadata" field. - This flag only takes effect when `file` is set. - */ - public function setReturnMetadata(?bool $returnMetadata): self - { - $this->initialized['returnMetadata'] = true; - $this->returnMetadata = $returnMetadata; - return $this; - } - - /** - * If an object name is in the list, we provide the full information of the object; otherwise, we only provide the object ID. Currently we support `completion` and `file` objects for expansion. - * - * @return mixed[]|null - */ - public function getExpand(): ?array - { - return $this->expand; - } - - /** - * If an object name is in the list, we provide the full information of the object; otherwise, we only provide the object ID. Currently we support `completion` and `file` objects for expansion. - * - * @param mixed[]|null $expand - */ - public function setExpand(?array $expand): self - { - $this->initialized['expand'] = true; - $this->expand = $expand; - return $this; - } - - /** - * A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - */ - public function getUser(): string - { - return $this->user; - } - - /** - * A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - */ - public function setUser(string $user): self - { - $this->initialized['user'] = true; - $this->user = $user; - return $this; - } -} diff --git a/generated/Model/CreateClassificationResponse.php b/generated/Model/CreateClassificationResponse.php deleted file mode 100644 index 40a10fe..0000000 --- a/generated/Model/CreateClassificationResponse.php +++ /dev/null @@ -1,140 +0,0 @@ -setObject($object); - } - if ($model !== null) { - $this->setModel($model); - } - if ($searchModel !== null) { - $this->setSearchModel($searchModel); - } - if ($completion !== null) { - $this->setCompletion($completion); - } - if ($label !== null) { - $this->setLabel($label); - } - if ($selectedExamples !== null) { - $this->setSelectedExamples($selectedExamples); - } - } - - public function isInitialized($property): bool - { - return array_key_exists($property, $this->initialized); - } - - public function getObject(): string - { - return $this->object; - } - - public function setObject(string $object): self - { - $this->initialized['object'] = true; - $this->object = $object; - return $this; - } - - public function getModel(): string - { - return $this->model; - } - - public function setModel(string $model): self - { - $this->initialized['model'] = true; - $this->model = $model; - return $this; - } - - public function getSearchModel(): string - { - return $this->searchModel; - } - - public function setSearchModel(string $searchModel): self - { - $this->initialized['searchModel'] = true; - $this->searchModel = $searchModel; - return $this; - } - - public function getCompletion(): string - { - return $this->completion; - } - - public function setCompletion(string $completion): self - { - $this->initialized['completion'] = true; - $this->completion = $completion; - return $this; - } - - public function getLabel(): string - { - return $this->label; - } - - public function setLabel(string $label): self - { - $this->initialized['label'] = true; - $this->label = $label; - return $this; - } - - /** - * @return CreateClassificationResponseSelectedExamplesItem[] - */ - public function getSelectedExamples(): array - { - return $this->selectedExamples; - } - - /** - * @param CreateClassificationResponseSelectedExamplesItem[] $selectedExamples - */ - public function setSelectedExamples(array $selectedExamples): self - { - $this->initialized['selectedExamples'] = true; - $this->selectedExamples = $selectedExamples; - return $this; - } -} diff --git a/generated/Model/CreateClassificationResponseSelectedExamplesItem.php b/generated/Model/CreateClassificationResponseSelectedExamplesItem.php deleted file mode 100644 index ae36add..0000000 --- a/generated/Model/CreateClassificationResponseSelectedExamplesItem.php +++ /dev/null @@ -1,77 +0,0 @@ -setDocument($document); - } - if ($text !== null) { - $this->setText($text); - } - if ($label !== null) { - $this->setLabel($label); - } - } - - public function isInitialized($property): bool - { - return array_key_exists($property, $this->initialized); - } - - public function getDocument(): int - { - return $this->document; - } - - public function setDocument(int $document): self - { - $this->initialized['document'] = true; - $this->document = $document; - return $this; - } - - public function getText(): string - { - return $this->text; - } - - public function setText(string $text): self - { - $this->initialized['text'] = true; - $this->text = $text; - return $this; - } - - public function getLabel(): string - { - return $this->label; - } - - public function setLabel(string $label): self - { - $this->initialized['label'] = true; - $this->label = $label; - return $this; - } -} diff --git a/generated/Model/CreateCompletionRequest.php b/generated/Model/CreateCompletionRequest.php index 47f3435..22c3457 100644 --- a/generated/Model/CreateCompletionRequest.php +++ b/generated/Model/CreateCompletionRequest.php @@ -12,42 +12,62 @@ class CreateCompletionRequest extends ArrayObject /** * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + * + * @var mixed */ - protected ?string $model = null; + protected $model = null; /** * The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays. + * - * @var mixed + * @var mixed|null */ protected string $prompt = '<|endoftext|>'; /** - * The suffix that comes after a completion of inserted text. + * Generates `best_of` completions server-side and returns the "best" (the one with the highest log probability per token). Results cannot be streamed. + + When used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`. + + **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. */ - protected ?string $suffix = null; + protected ?int $bestOf = 1; /** - * The maximum number of [tokens](/tokenizer) to generate in the completion. - The token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb) for counting tokens. + * Echo back the prompt in addition to the completion */ - protected ?int $maxTokens = 16; + protected ?bool $echo = false; /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + * Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. * * @var float|null */ - protected $temperature = 1; + protected $frequencyPenalty = 0; /** - * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. + * Modify the likelihood of specified tokens appearing in the completion. * - * @var float|null + * @var array|null */ - protected $topP = 1; + protected $logitBias = null; + + /** + * Include the log probabilities on the `logprobs` most likely output tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. + + The maximum value for `logprobs` is 5. + */ + protected ?int $logprobs = null; + + /** + * The maximum number of [tokens](/tokenizer) that can be generated in the completion. + + The token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. + */ + protected ?int $maxTokens = 16; /** * How many completions to generate for each prompt. @@ -56,20 +76,19 @@ class CreateCompletionRequest extends ArrayObject protected ?int $n = 1; /** - * Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_stream_completions.ipynb). - */ - protected ?bool $stream = false; + * Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. - /** - * Include the log probabilities on the `logprobs` most likely tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. - The maximum value for `logprobs` is 5. + * + * @var float|null */ - protected ?int $logprobs = null; + protected $presencePenalty = 0; /** - * Echo back the prompt in addition to the completion + * If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. + + Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. */ - protected ?bool $echo = false; + protected ?int $seed = null; /** * Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence. @@ -79,35 +98,30 @@ class CreateCompletionRequest extends ArrayObject protected $stop = null; /** - * Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. + * Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). + */ + protected ?bool $stream = false; - * - * @var float|null + /** + * The suffix that comes after a completion of inserted text. */ - protected $presencePenalty = 0; + protected ?string $suffix = null; /** - * Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. * * @var float|null */ - protected $frequencyPenalty = 0; - - /** - * Generates `best_of` completions server-side and returns the "best" (the one with the highest log probability per token). Results cannot be streamed. - When used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`. - **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. - */ - protected ?int $bestOf = 1; + protected $temperature = 1; /** - * Modify the likelihood of specified tokens appearing in the completion. + * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. * - * @var mixed[]|null + * @var float|null */ - protected ?iterable $logitBias = null; + protected $topP = 1; /** * A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). @@ -115,36 +129,38 @@ class CreateCompletionRequest extends ArrayObject protected ?string $user = null; /** - * @param string $model ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + * @param mixed $model ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. * @param mixed|null $prompt The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays. * Note that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document. + * @param int|null $bestOf Generates `best_of` completions server-side and returns the "best" (the one with the highest log probability per token). Results cannot be streamed. + * When used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`. + * **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. + * @param bool|null $echo Echo back the prompt in addition to the completion + * @param float|null $frequencyPenalty Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. + * [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) + * @param array|null $logitBias Modify the likelihood of specified tokens appearing in the completion. + * Accepts a JSON object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](/tokenizer?view=bpe) (which works for both GPT-2 and GPT-3) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. + * As an example, you can pass `{"50256": -100}` to prevent the <|endoftext|> token from being generated. + * @param int|null $logprobs Include the log probabilities on the `logprobs` most likely output tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. + * The maximum value for `logprobs` is 5. + * @param int|null $maxTokens The maximum number of [tokens](/tokenizer) that can be generated in the completion. + * The token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. + * @param int|null $n How many completions to generate for each prompt. + * **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. + * @param float|null $presencePenalty Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. + * [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) + * @param int|null $seed If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. + * Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. + * @param mixed|null $stop Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence. + * @param bool|null $stream Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). * @param string|null $suffix The suffix that comes after a completion of inserted text. - * @param int|null $maxTokens The maximum number of [tokens](/tokenizer) to generate in the completion. - * The token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb) for counting tokens. * @param float|null $temperature What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. * We generally recommend altering this or `top_p` but not both. * @param float|null $topP An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. * We generally recommend altering this or `temperature` but not both. - * @param int|null $n How many completions to generate for each prompt. - * **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. - * @param bool|null $stream Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_stream_completions.ipynb). - * @param int|null $logprobs Include the log probabilities on the `logprobs` most likely tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. - * The maximum value for `logprobs` is 5. - * @param bool|null $echo Echo back the prompt in addition to the completion - * @param mixed|null $stop Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence. - * @param float|null $presencePenalty Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. - * [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details) - * @param float|null $frequencyPenalty Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - * [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details) - * @param int|null $bestOf Generates `best_of` completions server-side and returns the "best" (the one with the highest log probability per token). Results cannot be streamed. - * When used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`. - * **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. - * @param mixed[]|null $logitBias Modify the likelihood of specified tokens appearing in the completion. - * Accepts a json object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](/tokenizer?view=bpe) (which works for both GPT-2 and GPT-3) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. - * As an example, you can pass `{"50256": -100}` to prevent the <|endoftext|> token from being generated. * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). */ - public function __construct($model = null, $prompt = '<|endoftext|>', $suffix = null, $maxTokens = 16, $temperature = 1, $topP = 1, $n = 1, $stream = false, $logprobs = null, $echo = false, $stop = null, $presencePenalty = 0, $frequencyPenalty = 0, $bestOf = 1, $logitBias = null, $user = null) + public function __construct(mixed $model = null, $prompt = '<|endoftext|>', $bestOf = 1, $echo = false, $frequencyPenalty = 0, $logitBias = null, $logprobs = null, $maxTokens = 16, $n = 1, $presencePenalty = 0, $seed = null, $stop = null, $stream = false, $suffix = null, $temperature = 1, $topP = 1, $user = null) { if ($model !== null) { $this->setModel($model); @@ -152,44 +168,47 @@ public function __construct($model = null, $prompt = '<|endoftext|>', $suffix = if ($prompt !== null) { $this->setPrompt($prompt); } - if ($suffix !== null) { - $this->setSuffix($suffix); + if ($bestOf !== null) { + $this->setBestOf($bestOf); } - if ($maxTokens !== null) { - $this->setMaxTokens($maxTokens); + if ($echo !== null) { + $this->setEcho($echo); } - if ($temperature !== null) { - $this->setTemperature($temperature); + if ($frequencyPenalty !== null) { + $this->setFrequencyPenalty($frequencyPenalty); } - if ($topP !== null) { - $this->setTopP($topP); + if ($logitBias !== null) { + $this->setLogitBias($logitBias); + } + if ($logprobs !== null) { + $this->setLogprobs($logprobs); + } + if ($maxTokens !== null) { + $this->setMaxTokens($maxTokens); } if ($n !== null) { $this->setN($n); } - if ($stream !== null) { - $this->setStream($stream); - } - if ($logprobs !== null) { - $this->setLogprobs($logprobs); + if ($presencePenalty !== null) { + $this->setPresencePenalty($presencePenalty); } - if ($echo !== null) { - $this->setEcho($echo); + if ($seed !== null) { + $this->setSeed($seed); } if ($stop !== null) { $this->setStop($stop); } - if ($presencePenalty !== null) { - $this->setPresencePenalty($presencePenalty); + if ($stream !== null) { + $this->setStream($stream); } - if ($frequencyPenalty !== null) { - $this->setFrequencyPenalty($frequencyPenalty); + if ($suffix !== null) { + $this->setSuffix($suffix); } - if ($bestOf !== null) { - $this->setBestOf($bestOf); + if ($temperature !== null) { + $this->setTemperature($temperature); } - if ($logitBias !== null) { - $this->setLogitBias($logitBias); + if ($topP !== null) { + $this->setTopP($topP); } if ($user !== null) { $this->setUser($user); @@ -203,8 +222,10 @@ public function isInitialized($property): bool /** * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + * + * @return mixed */ - public function getModel(): string + public function getModel() { return $this->model; } @@ -212,7 +233,7 @@ public function getModel(): string /** * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. */ - public function setModel(string $model): self + public function setModel(mixed $model): self { $this->initialized['model'] = true; $this->model = $model; @@ -232,6 +253,7 @@ public function getPrompt(): string /** * The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays. + Note that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document. */ public function setPrompt(mixed $prompt): self @@ -242,156 +264,200 @@ public function setPrompt(mixed $prompt): self } /** - * The suffix that comes after a completion of inserted text. + * Generates `best_of` completions server-side and returns the "best" (the one with the highest log probability per token). Results cannot be streamed. + + When used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`. + + **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. */ - public function getSuffix(): ?string + public function getBestOf(): ?int { - return $this->suffix; + return $this->bestOf; } /** - * The suffix that comes after a completion of inserted text. + * Generates `best_of` completions server-side and returns the "best" (the one with the highest log probability per token). Results cannot be streamed. + + When used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`. + + **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. */ - public function setSuffix(?string $suffix): self + public function setBestOf(?int $bestOf): self { - $this->initialized['suffix'] = true; - $this->suffix = $suffix; + $this->initialized['bestOf'] = true; + $this->bestOf = $bestOf; return $this; } /** - * The maximum number of [tokens](/tokenizer) to generate in the completion. - The token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb) for counting tokens. + * Echo back the prompt in addition to the completion */ - public function getMaxTokens(): ?int + public function getEcho(): ?bool { - return $this->maxTokens; + return $this->echo; } /** - * The maximum number of [tokens](/tokenizer) to generate in the completion. - The token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb) for counting tokens. + * Echo back the prompt in addition to the completion */ - public function setMaxTokens(?int $maxTokens): self + public function setEcho(?bool $echo): self { - $this->initialized['maxTokens'] = true; - $this->maxTokens = $maxTokens; + $this->initialized['echo'] = true; + $this->echo = $echo; return $this; } /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - We generally recommend altering this or `top_p` but not both. + * Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. + + [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) */ - public function getTemperature(): ?float + public function getFrequencyPenalty(): ?float { - return $this->temperature; + return $this->frequencyPenalty; } /** - * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. - We generally recommend altering this or `top_p` but not both. + * Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. + + [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) */ - public function setTemperature(?float $temperature): self + public function setFrequencyPenalty(?float $frequencyPenalty): self { - $this->initialized['temperature'] = true; - $this->temperature = $temperature; + $this->initialized['frequencyPenalty'] = true; + $this->frequencyPenalty = $frequencyPenalty; return $this; } /** - * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - We generally recommend altering this or `temperature` but not both. + * Modify the likelihood of specified tokens appearing in the completion. + + * + * @return array|null */ - public function getTopP(): ?float + public function getLogitBias(): ?iterable { - return $this->topP; + return $this->logitBias; } /** - * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - We generally recommend altering this or `temperature` but not both. + * Modify the likelihood of specified tokens appearing in the completion. + + * + * @param array|null $logitBias */ - public function setTopP(?float $topP): self + public function setLogitBias(?iterable $logitBias): self { - $this->initialized['topP'] = true; - $this->topP = $topP; + $this->initialized['logitBias'] = true; + $this->logitBias = $logitBias; return $this; } /** - * How many completions to generate for each prompt. - **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. + * Include the log probabilities on the `logprobs` most likely output tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. + + The maximum value for `logprobs` is 5. */ - public function getN(): ?int + public function getLogprobs(): ?int { - return $this->n; + return $this->logprobs; } /** - * How many completions to generate for each prompt. - **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. + * Include the log probabilities on the `logprobs` most likely output tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. + + The maximum value for `logprobs` is 5. */ - public function setN(?int $n): self + public function setLogprobs(?int $logprobs): self { - $this->initialized['n'] = true; - $this->n = $n; + $this->initialized['logprobs'] = true; + $this->logprobs = $logprobs; return $this; } /** - * Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_stream_completions.ipynb). + * The maximum number of [tokens](/tokenizer) that can be generated in the completion. + + The token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. */ - public function getStream(): ?bool + public function getMaxTokens(): ?int { - return $this->stream; + return $this->maxTokens; } /** - * Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_stream_completions.ipynb). + * The maximum number of [tokens](/tokenizer) that can be generated in the completion. + + The token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. */ - public function setStream(?bool $stream): self + public function setMaxTokens(?int $maxTokens): self { - $this->initialized['stream'] = true; - $this->stream = $stream; + $this->initialized['maxTokens'] = true; + $this->maxTokens = $maxTokens; return $this; } /** - * Include the log probabilities on the `logprobs` most likely tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. - The maximum value for `logprobs` is 5. + * How many completions to generate for each prompt. + **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. */ - public function getLogprobs(): ?int + public function getN(): ?int { - return $this->logprobs; + return $this->n; } /** - * Include the log probabilities on the `logprobs` most likely tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. - The maximum value for `logprobs` is 5. + * How many completions to generate for each prompt. + **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. */ - public function setLogprobs(?int $logprobs): self + public function setN(?int $n): self { - $this->initialized['logprobs'] = true; - $this->logprobs = $logprobs; + $this->initialized['n'] = true; + $this->n = $n; return $this; } /** - * Echo back the prompt in addition to the completion + * Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. + + [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) */ - public function getEcho(): ?bool + public function getPresencePenalty(): ?float { - return $this->echo; + return $this->presencePenalty; } /** - * Echo back the prompt in addition to the completion + * Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. + + [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) */ - public function setEcho(?bool $echo): self + public function setPresencePenalty(?float $presencePenalty): self { - $this->initialized['echo'] = true; - $this->echo = $echo; + $this->initialized['presencePenalty'] = true; + $this->presencePenalty = $presencePenalty; + return $this; + } + + /** + * If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. + + Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. + */ + public function getSeed(): ?int + { + return $this->seed; + } + + /** + * If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. + + Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. + */ + public function setSeed(?int $seed): self + { + $this->initialized['seed'] = true; + $this->seed = $seed; return $this; } @@ -416,87 +482,82 @@ public function setStop(mixed $stop): self } /** - * Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. - [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details) + * Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). */ - public function getPresencePenalty(): ?float + public function getStream(): ?bool { - return $this->presencePenalty; + return $this->stream; } /** - * Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. - [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details) + * Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). */ - public function setPresencePenalty(?float $presencePenalty): self + public function setStream(?bool $stream): self { - $this->initialized['presencePenalty'] = true; - $this->presencePenalty = $presencePenalty; + $this->initialized['stream'] = true; + $this->stream = $stream; return $this; } /** - * Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details) + * The suffix that comes after a completion of inserted text. */ - public function getFrequencyPenalty(): ?float + public function getSuffix(): ?string { - return $this->frequencyPenalty; + return $this->suffix; } /** - * Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - [See more information about frequency and presence penalties.](/docs/api-reference/parameter-details) + * The suffix that comes after a completion of inserted text. */ - public function setFrequencyPenalty(?float $frequencyPenalty): self + public function setSuffix(?string $suffix): self { - $this->initialized['frequencyPenalty'] = true; - $this->frequencyPenalty = $frequencyPenalty; + $this->initialized['suffix'] = true; + $this->suffix = $suffix; return $this; } /** - * Generates `best_of` completions server-side and returns the "best" (the one with the highest log probability per token). Results cannot be streamed. - When used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`. - **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + + We generally recommend altering this or `top_p` but not both. */ - public function getBestOf(): ?int + public function getTemperature(): ?float { - return $this->bestOf; + return $this->temperature; } /** - * Generates `best_of` completions server-side and returns the "best" (the one with the highest log probability per token). Results cannot be streamed. - When used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`. - **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. + * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + + We generally recommend altering this or `top_p` but not both. */ - public function setBestOf(?int $bestOf): self + public function setTemperature(?float $temperature): self { - $this->initialized['bestOf'] = true; - $this->bestOf = $bestOf; + $this->initialized['temperature'] = true; + $this->temperature = $temperature; return $this; } /** - * Modify the likelihood of specified tokens appearing in the completion. + * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. - * - * @return mixed[]|null + We generally recommend altering this or `temperature` but not both. */ - public function getLogitBias(): ?iterable + public function getTopP(): ?float { - return $this->logitBias; + return $this->topP; } /** - * Modify the likelihood of specified tokens appearing in the completion. - * - * @param mixed[]|null $logitBias + * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. + + We generally recommend altering this or `temperature` but not both. */ - public function setLogitBias(?iterable $logitBias): self + public function setTopP(?float $topP): self { - $this->initialized['logitBias'] = true; - $this->logitBias = $logitBias; + $this->initialized['topP'] = true; + $this->topP = $topP; return $this; } diff --git a/generated/Model/CreateCompletionResponse.php b/generated/Model/CreateCompletionResponse.php index ff6c5ca..319b011 100644 --- a/generated/Model/CreateCompletionResponse.php +++ b/generated/Model/CreateCompletionResponse.php @@ -10,36 +10,62 @@ class CreateCompletionResponse extends ArrayObject { protected array $initialized = []; + /** + * A unique identifier for the completion. + */ protected ?string $id = null; - protected ?string $object = null; + /** + * The list of completion choices the model generated for the input prompt. + * + * @var CreateCompletionResponseChoicesItem[] + */ + protected ?array $choices = null; + /** + * The Unix timestamp (in seconds) of when the completion was created. + */ protected ?int $created = null; + /** + * The model used for completion. + */ protected ?string $model = null; /** - * @var CreateCompletionResponseChoicesItem[]|null + * This fingerprint represents the backend configuration that the model runs with. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + */ + protected ?string $systemFingerprint = null; + + /** + * The object type, which is always "text_completion" */ - protected ?array $choices = null; + protected ?string $object = null; - protected ?CreateCompletionResponseUsage $usage = null; + /** + * Usage statistics for the completion request. + */ + protected ?CompletionUsage $usage = null; /** - * @param string $id - * @param string $object - * @param int $created - * @param string $model - * @param CreateCompletionResponseChoicesItem[] $choices - * @param CreateCompletionResponseUsage $usage + * @param string $id A unique identifier for the completion. + * @param CreateCompletionResponseChoicesItem[] $choices The list of completion choices the model generated for the input prompt. + * @param int $created The Unix timestamp (in seconds) of when the completion was created. + * @param string $model The model used for completion. + * @param string $systemFingerprint This fingerprint represents the backend configuration that the model runs with. + * Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. + * @param string $object The object type, which is always "text_completion" + * @param CompletionUsage $usage Usage statistics for the completion request. */ - public function __construct($id = null, $object = null, $created = null, $model = null, $choices = null, $usage = null) + public function __construct($id = null, $choices = null, $created = null, $model = null, $systemFingerprint = null, $object = null, $usage = null) { if ($id !== null) { $this->setId($id); } - if ($object !== null) { - $this->setObject($object); + if ($choices !== null) { + $this->setChoices($choices); } if ($created !== null) { $this->setCreated($created); @@ -47,8 +73,11 @@ public function __construct($id = null, $object = null, $created = null, $model if ($model !== null) { $this->setModel($model); } - if ($choices !== null) { - $this->setChoices($choices); + if ($systemFingerprint !== null) { + $this->setSystemFingerprint($systemFingerprint); + } + if ($object !== null) { + $this->setObject($object); } if ($usage !== null) { $this->setUsage($usage); @@ -60,11 +89,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } + /** + * A unique identifier for the completion. + */ public function getId(): string { return $this->id; } + /** + * A unique identifier for the completion. + */ public function setId(string $id): self { $this->initialized['id'] = true; @@ -72,23 +107,39 @@ public function setId(string $id): self return $this; } - public function getObject(): string + /** + * The list of completion choices the model generated for the input prompt. + * + * @return CreateCompletionResponseChoicesItem[] + */ + public function getChoices(): array { - return $this->object; + return $this->choices; } - public function setObject(string $object): self + /** + * The list of completion choices the model generated for the input prompt. + * + * @param CreateCompletionResponseChoicesItem[] $choices + */ + public function setChoices(array $choices): self { - $this->initialized['object'] = true; - $this->object = $object; + $this->initialized['choices'] = true; + $this->choices = $choices; return $this; } + /** + * The Unix timestamp (in seconds) of when the completion was created. + */ public function getCreated(): int { return $this->created; } + /** + * The Unix timestamp (in seconds) of when the completion was created. + */ public function setCreated(int $created): self { $this->initialized['created'] = true; @@ -96,11 +147,17 @@ public function setCreated(int $created): self return $this; } + /** + * The model used for completion. + */ public function getModel(): string { return $this->model; } + /** + * The model used for completion. + */ public function setModel(string $model): self { $this->initialized['model'] = true; @@ -109,29 +166,57 @@ public function setModel(string $model): self } /** - * @return CreateCompletionResponseChoicesItem[] + * This fingerprint represents the backend configuration that the model runs with. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. */ - public function getChoices(): array + public function getSystemFingerprint(): string { - return $this->choices; + return $this->systemFingerprint; } /** - * @param CreateCompletionResponseChoicesItem[] $choices + * This fingerprint represents the backend configuration that the model runs with. + + Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. */ - public function setChoices(array $choices): self + public function setSystemFingerprint(string $systemFingerprint): self { - $this->initialized['choices'] = true; - $this->choices = $choices; + $this->initialized['systemFingerprint'] = true; + $this->systemFingerprint = $systemFingerprint; return $this; } - public function getUsage(): CreateCompletionResponseUsage + /** + * The object type, which is always "text_completion" + */ + public function getObject(): string + { + return $this->object; + } + + /** + * The object type, which is always "text_completion" + */ + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * Usage statistics for the completion request. + */ + public function getUsage(): CompletionUsage { return $this->usage; } - public function setUsage(CreateCompletionResponseUsage $usage): self + /** + * Usage statistics for the completion request. + */ + public function setUsage(CompletionUsage $usage): self { $this->initialized['usage'] = true; $this->usage = $usage; diff --git a/generated/Model/CreateCompletionResponseChoicesItem.php b/generated/Model/CreateCompletionResponseChoicesItem.php index df06bec..9d1fc6a 100644 --- a/generated/Model/CreateCompletionResponseChoicesItem.php +++ b/generated/Model/CreateCompletionResponseChoicesItem.php @@ -10,24 +10,30 @@ class CreateCompletionResponseChoicesItem extends ArrayObject { protected array $initialized = []; - protected ?string $text = null; + /** + * The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + or `content_filter` if content was omitted due to a flag from our content filters. + */ + protected ?string $finishReason = null; protected ?int $index = null; protected ?CreateCompletionResponseChoicesItemLogprobs $logprobs = null; - protected ?string $finishReason = null; + protected ?string $text = null; /** - * @param string $text + * @param string $finishReason The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + * `length` if the maximum number of tokens specified in the request was reached, + * or `content_filter` if content was omitted due to a flag from our content filters. * @param int $index * @param CreateCompletionResponseChoicesItemLogprobs|null $logprobs - * @param string|null $finishReason + * @param string $text */ - public function __construct($text = null, $index = null, $logprobs = null, $finishReason = null) + public function __construct($finishReason = null, $index = null, $logprobs = null, $text = null) { - if ($text !== null) { - $this->setText($text); + if ($finishReason !== null) { + $this->setFinishReason($finishReason); } if ($index !== null) { $this->setIndex($index); @@ -35,8 +41,8 @@ public function __construct($text = null, $index = null, $logprobs = null, $fini if ($logprobs !== null) { $this->setLogprobs($logprobs); } - if ($finishReason !== null) { - $this->setFinishReason($finishReason); + if ($text !== null) { + $this->setText($text); } } @@ -45,15 +51,23 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } - public function getText(): string + /** + * The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + or `content_filter` if content was omitted due to a flag from our content filters. + */ + public function getFinishReason(): string { - return $this->text; + return $this->finishReason; } - public function setText(string $text): self + /** + * The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + or `content_filter` if content was omitted due to a flag from our content filters. + */ + public function setFinishReason(string $finishReason): self { - $this->initialized['text'] = true; - $this->text = $text; + $this->initialized['finishReason'] = true; + $this->finishReason = $finishReason; return $this; } @@ -81,15 +95,15 @@ public function setLogprobs(?CreateCompletionResponseChoicesItemLogprobs $logpro return $this; } - public function getFinishReason(): ?string + public function getText(): string { - return $this->finishReason; + return $this->text; } - public function setFinishReason(?string $finishReason): self + public function setText(string $text): self { - $this->initialized['finishReason'] = true; - $this->finishReason = $finishReason; + $this->initialized['text'] = true; + $this->text = $text; return $this; } } diff --git a/generated/Model/CreateCompletionResponseChoicesItemLogprobs.php b/generated/Model/CreateCompletionResponseChoicesItemLogprobs.php index cfde4b3..7f06edd 100644 --- a/generated/Model/CreateCompletionResponseChoicesItemLogprobs.php +++ b/generated/Model/CreateCompletionResponseChoicesItemLogprobs.php @@ -11,45 +11,45 @@ class CreateCompletionResponseChoicesItemLogprobs extends ArrayObject protected array $initialized = []; /** - * @var string[]|null + * @var int[] */ - protected ?array $tokens = null; + protected ?array $textOffset = null; /** - * @var float[]|null + * @var float[] */ protected ?array $tokenLogprobs = null; /** - * @var mixed[][]|null + * @var string[] */ - protected ?array $topLogprobs = null; + protected ?array $tokens = null; /** - * @var int[]|null + * @var array[] */ - protected ?array $textOffset = null; + protected ?array $topLogprobs = null; /** - * @param string[] $tokens - * @param float[] $tokenLogprobs - * @param mixed[][] $topLogprobs * @param int[] $textOffset + * @param float[] $tokenLogprobs + * @param string[] $tokens + * @param array[] $topLogprobs */ - public function __construct($tokens = null, $tokenLogprobs = null, $topLogprobs = null, $textOffset = null) + public function __construct($textOffset = null, $tokenLogprobs = null, $tokens = null, $topLogprobs = null) { - if ($tokens !== null) { - $this->setTokens($tokens); + if ($textOffset !== null) { + $this->setTextOffset($textOffset); } if ($tokenLogprobs !== null) { $this->setTokenLogprobs($tokenLogprobs); } + if ($tokens !== null) { + $this->setTokens($tokens); + } if ($topLogprobs !== null) { $this->setTopLogprobs($topLogprobs); } - if ($textOffset !== null) { - $this->setTextOffset($textOffset); - } } public function isInitialized($property): bool @@ -58,20 +58,20 @@ public function isInitialized($property): bool } /** - * @return string[] + * @return int[] */ - public function getTokens(): array + public function getTextOffset(): array { - return $this->tokens; + return $this->textOffset; } /** - * @param string[] $tokens + * @param int[] $textOffset */ - public function setTokens(array $tokens): self + public function setTextOffset(array $textOffset): self { - $this->initialized['tokens'] = true; - $this->tokens = $tokens; + $this->initialized['textOffset'] = true; + $this->textOffset = $textOffset; return $this; } @@ -94,38 +94,38 @@ public function setTokenLogprobs(array $tokenLogprobs): self } /** - * @return mixed[][] + * @return string[] */ - public function getTopLogprobs(): array + public function getTokens(): array { - return $this->topLogprobs; + return $this->tokens; } /** - * @param mixed[][] $topLogprobs + * @param string[] $tokens */ - public function setTopLogprobs(array $topLogprobs): self + public function setTokens(array $tokens): self { - $this->initialized['topLogprobs'] = true; - $this->topLogprobs = $topLogprobs; + $this->initialized['tokens'] = true; + $this->tokens = $tokens; return $this; } /** - * @return int[] + * @return array[] */ - public function getTextOffset(): array + public function getTopLogprobs(): array { - return $this->textOffset; + return $this->topLogprobs; } /** - * @param int[] $textOffset + * @param array[] $topLogprobs */ - public function setTextOffset(array $textOffset): self + public function setTopLogprobs(array $topLogprobs): self { - $this->initialized['textOffset'] = true; - $this->textOffset = $textOffset; + $this->initialized['topLogprobs'] = true; + $this->topLogprobs = $topLogprobs; return $this; } } diff --git a/generated/Model/CreateCompletionResponseUsage.php b/generated/Model/CreateCompletionResponseUsage.php deleted file mode 100644 index 74a82d5..0000000 --- a/generated/Model/CreateCompletionResponseUsage.php +++ /dev/null @@ -1,77 +0,0 @@ -setPromptTokens($promptTokens); - } - if ($completionTokens !== null) { - $this->setCompletionTokens($completionTokens); - } - if ($totalTokens !== null) { - $this->setTotalTokens($totalTokens); - } - } - - public function isInitialized($property): bool - { - return array_key_exists($property, $this->initialized); - } - - public function getPromptTokens(): int - { - return $this->promptTokens; - } - - public function setPromptTokens(int $promptTokens): self - { - $this->initialized['promptTokens'] = true; - $this->promptTokens = $promptTokens; - return $this; - } - - public function getCompletionTokens(): int - { - return $this->completionTokens; - } - - public function setCompletionTokens(int $completionTokens): self - { - $this->initialized['completionTokens'] = true; - $this->completionTokens = $completionTokens; - return $this; - } - - public function getTotalTokens(): int - { - return $this->totalTokens; - } - - public function setTotalTokens(int $totalTokens): self - { - $this->initialized['totalTokens'] = true; - $this->totalTokens = $totalTokens; - return $this; - } -} diff --git a/generated/Model/CreateEditRequest.php b/generated/Model/CreateEditRequest.php index 9f2a28d..bcca02f 100644 --- a/generated/Model/CreateEditRequest.php +++ b/generated/Model/CreateEditRequest.php @@ -11,19 +11,21 @@ class CreateEditRequest extends ArrayObject protected array $initialized = []; /** - * ID of the model to use. You can use the `text-davinci-edit-001` or `code-davinci-edit-001` model with this endpoint. + * The instruction that tells the model how to edit the prompt. */ - protected ?string $model = null; + protected ?string $instruction = null; /** - * The input text to use as a starting point for the edit. + * ID of the model to use. You can use the `text-davinci-edit-001` or `code-davinci-edit-001` model with this endpoint. + * + * @var mixed */ - protected ?string $input = ''; + protected $model = null; /** - * The instruction that tells the model how to edit the prompt. + * The input text to use as a starting point for the edit. */ - protected ?string $instruction = null; + protected ?string $input = ''; /** * How many edits to generate for the input and instruction. @@ -47,26 +49,26 @@ class CreateEditRequest extends ArrayObject protected $topP = 1; /** - * @param string $model ID of the model to use. You can use the `text-davinci-edit-001` or `code-davinci-edit-001` model with this endpoint. - * @param string|null $input The input text to use as a starting point for the edit. * @param string $instruction The instruction that tells the model how to edit the prompt. + * @param mixed $model ID of the model to use. You can use the `text-davinci-edit-001` or `code-davinci-edit-001` model with this endpoint. + * @param string|null $input The input text to use as a starting point for the edit. * @param int|null $n How many edits to generate for the input and instruction. * @param float|null $temperature What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. * We generally recommend altering this or `top_p` but not both. * @param float|null $topP An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. * We generally recommend altering this or `temperature` but not both. */ - public function __construct($model = null, $input = '', $instruction = null, $n = 1, $temperature = 1, $topP = 1) + public function __construct($instruction = null, mixed $model = null, $input = '', $n = 1, $temperature = 1, $topP = 1) { + if ($instruction !== null) { + $this->setInstruction($instruction); + } if ($model !== null) { $this->setModel($model); } if ($input !== null) { $this->setInput($input); } - if ($instruction !== null) { - $this->setInstruction($instruction); - } if ($n !== null) { $this->setN($n); } @@ -83,10 +85,30 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } + /** + * The instruction that tells the model how to edit the prompt. + */ + public function getInstruction(): string + { + return $this->instruction; + } + + /** + * The instruction that tells the model how to edit the prompt. + */ + public function setInstruction(string $instruction): self + { + $this->initialized['instruction'] = true; + $this->instruction = $instruction; + return $this; + } + /** * ID of the model to use. You can use the `text-davinci-edit-001` or `code-davinci-edit-001` model with this endpoint. + * + * @return mixed */ - public function getModel(): string + public function getModel() { return $this->model; } @@ -94,7 +116,7 @@ public function getModel(): string /** * ID of the model to use. You can use the `text-davinci-edit-001` or `code-davinci-edit-001` model with this endpoint. */ - public function setModel(string $model): self + public function setModel(mixed $model): self { $this->initialized['model'] = true; $this->model = $model; @@ -119,24 +141,6 @@ public function setInput(?string $input): self return $this; } - /** - * The instruction that tells the model how to edit the prompt. - */ - public function getInstruction(): string - { - return $this->instruction; - } - - /** - * The instruction that tells the model how to edit the prompt. - */ - public function setInstruction(string $instruction): self - { - $this->initialized['instruction'] = true; - $this->instruction = $instruction; - return $this; - } - /** * How many edits to generate for the input and instruction. */ @@ -157,6 +161,7 @@ public function setN(?int $n): self /** * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + We generally recommend altering this or `top_p` but not both. */ public function getTemperature(): ?float @@ -166,6 +171,7 @@ public function getTemperature(): ?float /** * What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. + We generally recommend altering this or `top_p` but not both. */ public function setTemperature(?float $temperature): self @@ -177,6 +183,7 @@ public function setTemperature(?float $temperature): self /** * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. + We generally recommend altering this or `temperature` but not both. */ public function getTopP(): ?float @@ -186,6 +193,7 @@ public function getTopP(): ?float /** * An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. + We generally recommend altering this or `temperature` but not both. */ public function setTopP(?float $topP): self diff --git a/generated/Model/CreateEditResponse.php b/generated/Model/CreateEditResponse.php index e32be95..4ed6715 100644 --- a/generated/Model/CreateEditResponse.php +++ b/generated/Model/CreateEditResponse.php @@ -6,38 +6,52 @@ use ArrayObject; +/** + * @deprecated + */ class CreateEditResponse extends ArrayObject { protected array $initialized = []; + /** + * A list of edit choices. Can be more than one if `n` is greater than 1. + * + * @var CreateEditResponseChoicesItem[] + */ + protected ?array $choices = null; + + /** + * The object type, which is always `edit`. + */ protected ?string $object = null; + /** + * The Unix timestamp (in seconds) of when the edit was created. + */ protected ?int $created = null; /** - * @var CreateEditResponseChoicesItem[]|null + * Usage statistics for the completion request. */ - protected ?array $choices = null; - - protected ?CreateEditResponseUsage $usage = null; + protected ?CompletionUsage $usage = null; /** - * @param string $object - * @param int $created - * @param CreateEditResponseChoicesItem[] $choices - * @param CreateEditResponseUsage $usage + * @param CreateEditResponseChoicesItem[] $choices A list of edit choices. Can be more than one if `n` is greater than 1. + * @param string $object The object type, which is always `edit`. + * @param int $created The Unix timestamp (in seconds) of when the edit was created. + * @param CompletionUsage $usage Usage statistics for the completion request. */ - public function __construct($object = null, $created = null, $choices = null, $usage = null) + public function __construct($choices = null, $object = null, $created = null, $usage = null) { + if ($choices !== null) { + $this->setChoices($choices); + } if ($object !== null) { $this->setObject($object); } if ($created !== null) { $this->setCreated($created); } - if ($choices !== null) { - $this->setChoices($choices); - } if ($usage !== null) { $this->setUsage($usage); } @@ -48,11 +62,39 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } + /** + * A list of edit choices. Can be more than one if `n` is greater than 1. + * + * @return CreateEditResponseChoicesItem[] + */ + public function getChoices(): array + { + return $this->choices; + } + + /** + * A list of edit choices. Can be more than one if `n` is greater than 1. + * + * @param CreateEditResponseChoicesItem[] $choices + */ + public function setChoices(array $choices): self + { + $this->initialized['choices'] = true; + $this->choices = $choices; + return $this; + } + + /** + * The object type, which is always `edit`. + */ public function getObject(): string { return $this->object; } + /** + * The object type, which is always `edit`. + */ public function setObject(string $object): self { $this->initialized['object'] = true; @@ -60,11 +102,17 @@ public function setObject(string $object): self return $this; } + /** + * The Unix timestamp (in seconds) of when the edit was created. + */ public function getCreated(): int { return $this->created; } + /** + * The Unix timestamp (in seconds) of when the edit was created. + */ public function setCreated(int $created): self { $this->initialized['created'] = true; @@ -73,29 +121,17 @@ public function setCreated(int $created): self } /** - * @return CreateEditResponseChoicesItem[] + * Usage statistics for the completion request. */ - public function getChoices(): array + public function getUsage(): CompletionUsage { - return $this->choices; + return $this->usage; } /** - * @param CreateEditResponseChoicesItem[] $choices + * Usage statistics for the completion request. */ - public function setChoices(array $choices): self - { - $this->initialized['choices'] = true; - $this->choices = $choices; - return $this; - } - - public function getUsage(): CreateEditResponseUsage - { - return $this->usage; - } - - public function setUsage(CreateEditResponseUsage $usage): self + public function setUsage(CompletionUsage $usage): self { $this->initialized['usage'] = true; $this->usage = $usage; diff --git a/generated/Model/CreateEditResponseChoicesItem.php b/generated/Model/CreateEditResponseChoicesItem.php index 99fd03d..4fe43c0 100644 --- a/generated/Model/CreateEditResponseChoicesItem.php +++ b/generated/Model/CreateEditResponseChoicesItem.php @@ -10,33 +10,39 @@ class CreateEditResponseChoicesItem extends ArrayObject { protected array $initialized = []; - protected ?string $text = null; + /** + * The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + or `content_filter` if content was omitted due to a flag from our content filters. + */ + protected ?string $finishReason = null; + /** + * The index of the choice in the list of choices. + */ protected ?int $index = null; - protected ?CreateEditResponseChoicesItemLogprobs $logprobs = null; - - protected ?string $finishReason = null; + /** + * The edited result. + */ + protected ?string $text = null; /** - * @param string $text - * @param int $index - * @param CreateEditResponseChoicesItemLogprobs|null $logprobs - * @param string $finishReason + * @param string $finishReason The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + * `length` if the maximum number of tokens specified in the request was reached, + * or `content_filter` if content was omitted due to a flag from our content filters. + * @param int $index The index of the choice in the list of choices. + * @param string $text The edited result. */ - public function __construct($text = null, $index = null, $logprobs = null, $finishReason = null) + public function __construct($finishReason = null, $index = null, $text = null) { - if ($text !== null) { - $this->setText($text); + if ($finishReason !== null) { + $this->setFinishReason($finishReason); } if ($index !== null) { $this->setIndex($index); } - if ($logprobs !== null) { - $this->setLogprobs($logprobs); - } - if ($finishReason !== null) { - $this->setFinishReason($finishReason); + if ($text !== null) { + $this->setText($text); } } @@ -45,23 +51,37 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } - public function getText(): string + /** + * The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + or `content_filter` if content was omitted due to a flag from our content filters. + */ + public function getFinishReason(): string { - return $this->text; + return $this->finishReason; } - public function setText(string $text): self + /** + * The reason the model stopped generating tokens. This will be `stop` if the model hit a natural stop point or a provided stop sequence, + or `content_filter` if content was omitted due to a flag from our content filters. + */ + public function setFinishReason(string $finishReason): self { - $this->initialized['text'] = true; - $this->text = $text; + $this->initialized['finishReason'] = true; + $this->finishReason = $finishReason; return $this; } + /** + * The index of the choice in the list of choices. + */ public function getIndex(): int { return $this->index; } + /** + * The index of the choice in the list of choices. + */ public function setIndex(int $index): self { $this->initialized['index'] = true; @@ -69,27 +89,21 @@ public function setIndex(int $index): self return $this; } - public function getLogprobs(): ?CreateEditResponseChoicesItemLogprobs - { - return $this->logprobs; - } - - public function setLogprobs(?CreateEditResponseChoicesItemLogprobs $logprobs): self - { - $this->initialized['logprobs'] = true; - $this->logprobs = $logprobs; - return $this; - } - - public function getFinishReason(): string + /** + * The edited result. + */ + public function getText(): string { - return $this->finishReason; + return $this->text; } - public function setFinishReason(string $finishReason): self + /** + * The edited result. + */ + public function setText(string $text): self { - $this->initialized['finishReason'] = true; - $this->finishReason = $finishReason; + $this->initialized['text'] = true; + $this->text = $text; return $this; } } diff --git a/generated/Model/CreateEditResponseChoicesItemLogprobs.php b/generated/Model/CreateEditResponseChoicesItemLogprobs.php deleted file mode 100644 index fd9a4cc..0000000 --- a/generated/Model/CreateEditResponseChoicesItemLogprobs.php +++ /dev/null @@ -1,131 +0,0 @@ -setTokens($tokens); - } - if ($tokenLogprobs !== null) { - $this->setTokenLogprobs($tokenLogprobs); - } - if ($topLogprobs !== null) { - $this->setTopLogprobs($topLogprobs); - } - if ($textOffset !== null) { - $this->setTextOffset($textOffset); - } - } - - public function isInitialized($property): bool - { - return array_key_exists($property, $this->initialized); - } - - /** - * @return string[] - */ - public function getTokens(): array - { - return $this->tokens; - } - - /** - * @param string[] $tokens - */ - public function setTokens(array $tokens): self - { - $this->initialized['tokens'] = true; - $this->tokens = $tokens; - return $this; - } - - /** - * @return float[] - */ - public function getTokenLogprobs(): array - { - return $this->tokenLogprobs; - } - - /** - * @param float[] $tokenLogprobs - */ - public function setTokenLogprobs(array $tokenLogprobs): self - { - $this->initialized['tokenLogprobs'] = true; - $this->tokenLogprobs = $tokenLogprobs; - return $this; - } - - /** - * @return mixed[][] - */ - public function getTopLogprobs(): array - { - return $this->topLogprobs; - } - - /** - * @param mixed[][] $topLogprobs - */ - public function setTopLogprobs(array $topLogprobs): self - { - $this->initialized['topLogprobs'] = true; - $this->topLogprobs = $topLogprobs; - return $this; - } - - /** - * @return int[] - */ - public function getTextOffset(): array - { - return $this->textOffset; - } - - /** - * @param int[] $textOffset - */ - public function setTextOffset(array $textOffset): self - { - $this->initialized['textOffset'] = true; - $this->textOffset = $textOffset; - return $this; - } -} diff --git a/generated/Model/CreateEmbeddingRequest.php b/generated/Model/CreateEmbeddingRequest.php index b1a296c..710a4c5 100644 --- a/generated/Model/CreateEmbeddingRequest.php +++ b/generated/Model/CreateEmbeddingRequest.php @@ -9,16 +9,23 @@ class CreateEmbeddingRequest protected array $initialized = []; /** - * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + * Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. + * + * @var mixed */ - protected ?string $model = null; + protected $input = null; /** - * Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. Each input must not exceed the max input tokens for the model (8191 tokens for `text-embedding-ada-002`). [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb) for counting tokens. + * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. * * @var mixed */ - protected $input = null; + protected $model = null; + + /** + * The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/). + */ + protected string $encodingFormat = 'float'; /** * A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). @@ -26,17 +33,21 @@ class CreateEmbeddingRequest protected ?string $user = null; /** - * @param string $model ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. - * @param mixed $input Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. Each input must not exceed the max input tokens for the model (8191 tokens for `text-embedding-ada-002`). [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb) for counting tokens. + * @param mixed $input Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. + * @param mixed $model ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + * @param string $encodingFormat The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/). * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). */ - public function __construct($model = null, mixed $input = null, $user = null) + public function __construct(mixed $input = null, mixed $model = null, $encodingFormat = 'float', $user = null) { + if ($input !== null) { + $this->setInput($input); + } if ($model !== null) { $this->setModel($model); } - if ($input !== null) { - $this->setInput($input); + if ($encodingFormat !== null) { + $this->setEncodingFormat($encodingFormat); } if ($user !== null) { $this->setUser($user); @@ -48,10 +59,32 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } + /** + * Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. + * + * @return mixed + */ + public function getInput() + { + return $this->input; + } + + /** + * Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. + */ + public function setInput(mixed $input): self + { + $this->initialized['input'] = true; + $this->input = $input; + return $this; + } + /** * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + * + * @return mixed */ - public function getModel(): string + public function getModel() { return $this->model; } @@ -59,7 +92,7 @@ public function getModel(): string /** * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. */ - public function setModel(string $model): self + public function setModel(mixed $model): self { $this->initialized['model'] = true; $this->model = $model; @@ -67,22 +100,20 @@ public function setModel(string $model): self } /** - * Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. Each input must not exceed the max input tokens for the model (8191 tokens for `text-embedding-ada-002`). [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb) for counting tokens. - * - * @return mixed + * The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/). */ - public function getInput() + public function getEncodingFormat(): string { - return $this->input; + return $this->encodingFormat; } /** - * Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. Each input must not exceed the max input tokens for the model (8191 tokens for `text-embedding-ada-002`). [Example Python code](https://github.com/openai/openai-cookbook/blob/main/examples/How_to_count_tokens_with_tiktoken.ipynb) for counting tokens. + * The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/). */ - public function setInput(mixed $input): self + public function setEncodingFormat(string $encodingFormat): self { - $this->initialized['input'] = true; - $this->input = $input; + $this->initialized['encodingFormat'] = true; + $this->encodingFormat = $encodingFormat; return $this; } diff --git a/generated/Model/CreateEmbeddingResponse.php b/generated/Model/CreateEmbeddingResponse.php index cd81032..b07ad5d 100644 --- a/generated/Model/CreateEmbeddingResponse.php +++ b/generated/Model/CreateEmbeddingResponse.php @@ -10,33 +10,44 @@ class CreateEmbeddingResponse extends ArrayObject { protected array $initialized = []; - protected ?string $object = null; + /** + * The list of embeddings generated by the model. + * + * @var Embedding[] + */ + protected ?array $data = null; + /** + * The name of the model used to generate the embedding. + */ protected ?string $model = null; /** - * @var CreateEmbeddingResponseDataItem[]|null + * The object type, which is always "list". */ - protected ?array $data = null; + protected ?string $object = null; + /** + * The usage information for the request. + */ protected ?CreateEmbeddingResponseUsage $usage = null; /** - * @param string $object - * @param string $model - * @param CreateEmbeddingResponseDataItem[] $data - * @param CreateEmbeddingResponseUsage $usage + * @param Embedding[] $data The list of embeddings generated by the model. + * @param string $model The name of the model used to generate the embedding. + * @param string $object The object type, which is always "list". + * @param CreateEmbeddingResponseUsage $usage The usage information for the request. */ - public function __construct($object = null, $model = null, $data = null, $usage = null) + public function __construct($data = null, $model = null, $object = null, $usage = null) { - if ($object !== null) { - $this->setObject($object); + if ($data !== null) { + $this->setData($data); } if ($model !== null) { $this->setModel($model); } - if ($data !== null) { - $this->setData($data); + if ($object !== null) { + $this->setObject($object); } if ($usage !== null) { $this->setUsage($usage); @@ -48,23 +59,39 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } - public function getObject(): string + /** + * The list of embeddings generated by the model. + * + * @return Embedding[] + */ + public function getData(): array { - return $this->object; + return $this->data; } - public function setObject(string $object): self + /** + * The list of embeddings generated by the model. + * + * @param Embedding[] $data + */ + public function setData(array $data): self { - $this->initialized['object'] = true; - $this->object = $object; + $this->initialized['data'] = true; + $this->data = $data; return $this; } + /** + * The name of the model used to generate the embedding. + */ public function getModel(): string { return $this->model; } + /** + * The name of the model used to generate the embedding. + */ public function setModel(string $model): self { $this->initialized['model'] = true; @@ -73,28 +100,34 @@ public function setModel(string $model): self } /** - * @return CreateEmbeddingResponseDataItem[] + * The object type, which is always "list". */ - public function getData(): array + public function getObject(): string { - return $this->data; + return $this->object; } /** - * @param CreateEmbeddingResponseDataItem[] $data + * The object type, which is always "list". */ - public function setData(array $data): self + public function setObject(string $object): self { - $this->initialized['data'] = true; - $this->data = $data; + $this->initialized['object'] = true; + $this->object = $object; return $this; } + /** + * The usage information for the request. + */ public function getUsage(): CreateEmbeddingResponseUsage { return $this->usage; } + /** + * The usage information for the request. + */ public function setUsage(CreateEmbeddingResponseUsage $usage): self { $this->initialized['usage'] = true; diff --git a/generated/Model/CreateEmbeddingResponseUsage.php b/generated/Model/CreateEmbeddingResponseUsage.php index a8c7899..e64219a 100644 --- a/generated/Model/CreateEmbeddingResponseUsage.php +++ b/generated/Model/CreateEmbeddingResponseUsage.php @@ -10,13 +10,19 @@ class CreateEmbeddingResponseUsage extends ArrayObject { protected array $initialized = []; + /** + * The number of tokens used by the prompt. + */ protected ?int $promptTokens = null; + /** + * The total number of tokens used by the request. + */ protected ?int $totalTokens = null; /** - * @param int $promptTokens - * @param int $totalTokens + * @param int $promptTokens The number of tokens used by the prompt. + * @param int $totalTokens The total number of tokens used by the request. */ public function __construct($promptTokens = null, $totalTokens = null) { @@ -33,11 +39,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } + /** + * The number of tokens used by the prompt. + */ public function getPromptTokens(): int { return $this->promptTokens; } + /** + * The number of tokens used by the prompt. + */ public function setPromptTokens(int $promptTokens): self { $this->initialized['promptTokens'] = true; @@ -45,11 +57,17 @@ public function setPromptTokens(int $promptTokens): self return $this; } + /** + * The total number of tokens used by the request. + */ public function getTotalTokens(): int { return $this->totalTokens; } + /** + * The total number of tokens used by the request. + */ public function setTotalTokens(int $totalTokens): self { $this->initialized['totalTokens'] = true; diff --git a/generated/Model/CreateFileRequest.php b/generated/Model/CreateFileRequest.php index 0978621..f308d02 100644 --- a/generated/Model/CreateFileRequest.php +++ b/generated/Model/CreateFileRequest.php @@ -9,22 +9,21 @@ class CreateFileRequest protected array $initialized = []; /** - * Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. - If the `purpose` is set to "fine-tune", each line is a JSON record with "prompt" and "completion" fields representing your [training examples](/docs/guides/fine-tuning/prepare-training-data). + * The File object (not file name) to be uploaded. */ protected ?string $file = null; /** - * The intended purpose of the uploaded documents. - Use "fine-tune" for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate the format of the uploaded file. + * The intended purpose of the uploaded file. + + Use "fine-tune" for [Fine-tuning](/docs/api-reference/fine-tuning) and "assistants" for [Assistants](/docs/api-reference/assistants) and [Messages](/docs/api-reference/messages). This allows us to validate the format of the uploaded file is correct for fine-tuning. */ protected ?string $purpose = null; /** - * @param string $file Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. - * If the `purpose` is set to "fine-tune", each line is a JSON record with "prompt" and "completion" fields representing your [training examples](/docs/guides/fine-tuning/prepare-training-data). - * @param string $purpose The intended purpose of the uploaded documents. - * Use "fine-tune" for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate the format of the uploaded file. + * @param string $file The File object (not file name) to be uploaded. + * @param string $purpose The intended purpose of the uploaded file. + * Use "fine-tune" for [Fine-tuning](/docs/api-reference/fine-tuning) and "assistants" for [Assistants](/docs/api-reference/assistants) and [Messages](/docs/api-reference/messages). This allows us to validate the format of the uploaded file is correct for fine-tuning. */ public function __construct($file = null, $purpose = null) { @@ -42,8 +41,7 @@ public function isInitialized($property): bool } /** - * Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. - If the `purpose` is set to "fine-tune", each line is a JSON record with "prompt" and "completion" fields representing your [training examples](/docs/guides/fine-tuning/prepare-training-data). + * The File object (not file name) to be uploaded. */ public function getFile(): string { @@ -51,8 +49,7 @@ public function getFile(): string } /** - * Name of the [JSON Lines](https://jsonlines.readthedocs.io/en/latest/) file to be uploaded. - If the `purpose` is set to "fine-tune", each line is a JSON record with "prompt" and "completion" fields representing your [training examples](/docs/guides/fine-tuning/prepare-training-data). + * The File object (not file name) to be uploaded. */ public function setFile(string $file): self { @@ -62,8 +59,9 @@ public function setFile(string $file): self } /** - * The intended purpose of the uploaded documents. - Use "fine-tune" for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate the format of the uploaded file. + * The intended purpose of the uploaded file. + + Use "fine-tune" for [Fine-tuning](/docs/api-reference/fine-tuning) and "assistants" for [Assistants](/docs/api-reference/assistants) and [Messages](/docs/api-reference/messages). This allows us to validate the format of the uploaded file is correct for fine-tuning. */ public function getPurpose(): string { @@ -71,8 +69,9 @@ public function getPurpose(): string } /** - * The intended purpose of the uploaded documents. - Use "fine-tune" for [Fine-tuning](/docs/api-reference/fine-tunes). This allows us to validate the format of the uploaded file. + * The intended purpose of the uploaded file. + + Use "fine-tune" for [Fine-tuning](/docs/api-reference/fine-tuning) and "assistants" for [Assistants](/docs/api-reference/assistants) and [Messages](/docs/api-reference/messages). This allows us to validate the format of the uploaded file is correct for fine-tuning. */ public function setPurpose(string $purpose): self { diff --git a/generated/Model/CreateFineTuneRequest.php b/generated/Model/CreateFineTuneRequest.php index 1838ac1..3da6b50 100644 --- a/generated/Model/CreateFineTuneRequest.php +++ b/generated/Model/CreateFineTuneRequest.php @@ -12,45 +12,37 @@ class CreateFineTuneRequest extends ArrayObject /** * The ID of an uploaded file that contains training data. - See the [fine-tuning guide](/docs/guides/fine-tuning/creating-training-data) for more details. + + See the [fine-tuning guide](/docs/guides/legacy-fine-tuning/creating-training-data) for more details. */ protected ?string $trainingFile = null; /** - * The ID of an uploaded file that contains validation data. - See the [fine-tuning guide](/docs/guides/fine-tuning/creating-training-data) for more details. + * The batch size to use for training. The batch size is the number of + for larger datasets. */ - protected ?string $validationFile = null; + protected ?int $batchSize = null; /** - * The name of the base model to fine-tune. You can select one of "ada", - [Models](https://platform.openai.com/docs/models) documentation. + * If this is provided, we calculate F-beta scores at the specified + * + * @var float[]|null */ - protected ?string $model = 'curie'; + protected $classificationBetas = null; /** - * The number of epochs to train the model for. An epoch refers to one - full cycle through the training dataset. - */ - protected ?int $nEpochs = 4; + * The number of classes in a classification task. - /** - * The batch size to use for training. The batch size is the number of - for larger datasets. + This parameter is required for multiclass classification. */ - protected ?int $batchSize = null; + protected ?int $classificationNClasses = null; /** - * The learning rate multiplier to use for training. - results. - */ - protected ?float $learningRateMultiplier = null; + * The positive class in binary classification. - /** - * The weight to use for loss on the prompt tokens. This controls how - learning the prompt. + metrics when doing binary classification. */ - protected ?float $promptLossWeight = 0.01; + protected ?string $classificationPositiveClass = null; /** * If set, we calculate classification-specific metrics such as accuracy @@ -59,58 +51,76 @@ class CreateFineTuneRequest extends ArrayObject protected ?bool $computeClassificationMetrics = false; /** - * The number of classes in a classification task. - This parameter is required for multiclass classification. + * The hyperparameters used for the fine-tuning job. */ - protected ?int $classificationNClasses = null; + protected ?CreateFineTuneRequestHyperparameters $hyperparameters = null; /** - * The positive class in binary classification. - metrics when doing binary classification. + * The learning rate multiplier to use for training. + results. */ - protected ?string $classificationPositiveClass = null; + protected ?float $learningRateMultiplier = null; /** - * If this is provided, we calculate F-beta scores at the specified + * The name of the base model to fine-tune. You can select one of "ada", * - * @var float[]|null + * @var mixed|null + */ + protected string $model = 'curie'; + + /** + * The weight to use for loss on the prompt tokens. This controls how + learning the prompt. */ - protected ?array $classificationBetas = null; + protected ?float $promptLossWeight = 0.01; /** * A string of up to 40 characters that will be added to your fine-tuned model name. + For example, a `suffix` of "custom-model-name" would produce a model name like `ada:ft-your-org:custom-model-name-2022-02-15-04-21-04`. */ protected ?string $suffix = null; + /** + * The ID of an uploaded file that contains validation data. + + See the [fine-tuning guide](/docs/guides/legacy-fine-tuning/creating-training-data) for more details. + */ + protected ?string $validationFile = null; + /** * @param string $trainingFile The ID of an uploaded file that contains training data. * See [upload file](/docs/api-reference/files/upload) for how to upload a file. * Your dataset must be formatted as a JSONL file, where each training * example is a JSON object with the keys "prompt" and "completion". * Additionally, you must upload your file with the purpose `fine-tune`. - * See the [fine-tuning guide](/docs/guides/fine-tuning/creating-training-data) for more details. - * @param string|null $validationFile The ID of an uploaded file that contains validation data. - * If you provide this file, the data is used to generate validation - * metrics periodically during fine-tuning. These metrics can be viewed in - * the [fine-tuning results file](/docs/guides/fine-tuning/analyzing-your-fine-tuned-model). - * Your train and validation data should be mutually exclusive. - * Your dataset must be formatted as a JSONL file, where each validation - * example is a JSON object with the keys "prompt" and "completion". - * Additionally, you must upload your file with the purpose `fine-tune`. - * See the [fine-tuning guide](/docs/guides/fine-tuning/creating-training-data) for more details. - * @param string|null $model The name of the base model to fine-tune. You can select one of "ada", - * "babbage", "curie", "davinci", or a fine-tuned model created after 2022-04-21. - * To learn more about these models, see the - * [Models](https://platform.openai.com/docs/models) documentation. - * @param int|null $nEpochs The number of epochs to train the model for. An epoch refers to one - * full cycle through the training dataset. + * See the [fine-tuning guide](/docs/guides/legacy-fine-tuning/creating-training-data) for more details. * @param int|null $batchSize The batch size to use for training. The batch size is the number of * training examples used to train a single forward and backward pass. * By default, the batch size will be dynamically configured to be * ~0.2% of the number of examples in the training set, capped at 256 - * in general, we've found that larger batch sizes tend to work better * for larger datasets. + * @param float[]|null $classificationBetas If this is provided, we calculate F-beta scores at the specified + * beta values. The F-beta score is a generalization of F-1 score. + * This is only used for binary classification. + * With a beta of 1 (i.e. the F-1 score), precision and recall are + * given the same weight. A larger beta score puts more weight on + * recall and less on precision. A smaller beta score puts more weight + * on precision and less on recall. + * @param int|null $classificationNClasses The number of classes in a classification task. + * This parameter is required for multiclass classification. + * @param string|null $classificationPositiveClass The positive class in binary classification. + * This parameter is needed to generate precision, recall, and F1 + * metrics when doing binary classification. + * @param bool|null $computeClassificationMetrics If set, we calculate classification-specific metrics such as accuracy + * and F-1 score using the validation set at the end of every epoch. + * These metrics can be viewed in the [results file](/docs/guides/legacy-fine-tuning/analyzing-your-fine-tuned-model). + * In order to compute classification metrics, you must provide a + * `validation_file`. Additionally, you must + * specify `classification_n_classes` for multiclass classification or + * `classification_positive_class` for binary classification. + * @param CreateFineTuneRequestHyperparameters $hyperparameters The hyperparameters used for the fine-tuning job. * @param float|null $learningRateMultiplier The learning rate multiplier to use for training. * The fine-tuning learning rate is the original learning rate used for * pretraining multiplied by this value. @@ -119,6 +129,10 @@ class CreateFineTuneRequest extends ArrayObject * perform better with larger batch sizes). We recommend experimenting * with values in the range 0.02 to 0.2 to see what produces the best * results. + * @param mixed|null $model The name of the base model to fine-tune. You can select one of "ada", + * "babbage", "curie", "davinci", or a fine-tuned model created after 2022-04-21 and before 2023-08-22. + * To learn more about these models, see the + * [Models](/docs/models) documentation. * @param float|null $promptLossWeight The weight to use for loss on the prompt tokens. This controls how * much the model tries to learn to generate the prompt (as compared * to the completion which always has a weight of 1.0), and can add @@ -126,53 +140,28 @@ class CreateFineTuneRequest extends ArrayObject * If prompts are extremely long (relative to completions), it may make * sense to reduce this weight so as to avoid over-prioritizing * learning the prompt. - * @param bool|null $computeClassificationMetrics If set, we calculate classification-specific metrics such as accuracy - * and F-1 score using the validation set at the end of every epoch. - * These metrics can be viewed in the [results file](/docs/guides/fine-tuning/analyzing-your-fine-tuned-model). - * In order to compute classification metrics, you must provide a - * `validation_file`. Additionally, you must - * specify `classification_n_classes` for multiclass classification or - * `classification_positive_class` for binary classification. - * @param int|null $classificationNClasses The number of classes in a classification task. - * This parameter is required for multiclass classification. - * @param string|null $classificationPositiveClass The positive class in binary classification. - * This parameter is needed to generate precision, recall, and F1 - * metrics when doing binary classification. - * @param float[]|null $classificationBetas If this is provided, we calculate F-beta scores at the specified - * beta values. The F-beta score is a generalization of F-1 score. - * This is only used for binary classification. - * With a beta of 1 (i.e. the F-1 score), precision and recall are - * given the same weight. A larger beta score puts more weight on - * recall and less on precision. A smaller beta score puts more weight - * on precision and less on recall. * @param string|null $suffix A string of up to 40 characters that will be added to your fine-tuned model name. * For example, a `suffix` of "custom-model-name" would produce a model name like `ada:ft-your-org:custom-model-name-2022-02-15-04-21-04`. + * @param string|null $validationFile The ID of an uploaded file that contains validation data. + * If you provide this file, the data is used to generate validation + * metrics periodically during fine-tuning. These metrics can be viewed in + * the [fine-tuning results file](/docs/guides/legacy-fine-tuning/analyzing-your-fine-tuned-model). + * Your train and validation data should be mutually exclusive. + * Your dataset must be formatted as a JSONL file, where each validation + * example is a JSON object with the keys "prompt" and "completion". + * Additionally, you must upload your file with the purpose `fine-tune`. + * See the [fine-tuning guide](/docs/guides/legacy-fine-tuning/creating-training-data) for more details. */ - public function __construct($trainingFile = null, $validationFile = null, $model = 'curie', $nEpochs = 4, $batchSize = null, $learningRateMultiplier = null, $promptLossWeight = 0.01, $computeClassificationMetrics = false, $classificationNClasses = null, $classificationPositiveClass = null, $classificationBetas = null, $suffix = null) + public function __construct($trainingFile = null, $batchSize = null, $classificationBetas = null, $classificationNClasses = null, $classificationPositiveClass = null, $computeClassificationMetrics = false, $hyperparameters = null, $learningRateMultiplier = null, $model = 'curie', $promptLossWeight = 0.01, $suffix = null, $validationFile = null) { if ($trainingFile !== null) { $this->setTrainingFile($trainingFile); } - if ($validationFile !== null) { - $this->setValidationFile($validationFile); - } - if ($model !== null) { - $this->setModel($model); - } - if ($nEpochs !== null) { - $this->setNEpochs($nEpochs); - } if ($batchSize !== null) { $this->setBatchSize($batchSize); } - if ($learningRateMultiplier !== null) { - $this->setLearningRateMultiplier($learningRateMultiplier); - } - if ($promptLossWeight !== null) { - $this->setPromptLossWeight($promptLossWeight); - } - if ($computeClassificationMetrics !== null) { - $this->setComputeClassificationMetrics($computeClassificationMetrics); + if ($classificationBetas !== null) { + $this->setClassificationBetas($classificationBetas); } if ($classificationNClasses !== null) { $this->setClassificationNClasses($classificationNClasses); @@ -180,12 +169,27 @@ public function __construct($trainingFile = null, $validationFile = null, $model if ($classificationPositiveClass !== null) { $this->setClassificationPositiveClass($classificationPositiveClass); } - if ($classificationBetas !== null) { - $this->setClassificationBetas($classificationBetas); + if ($computeClassificationMetrics !== null) { + $this->setComputeClassificationMetrics($computeClassificationMetrics); + } + if ($hyperparameters !== null) { + $this->setHyperparameters($hyperparameters); + } + if ($learningRateMultiplier !== null) { + $this->setLearningRateMultiplier($learningRateMultiplier); + } + if ($model !== null) { + $this->setModel($model); + } + if ($promptLossWeight !== null) { + $this->setPromptLossWeight($promptLossWeight); } if ($suffix !== null) { $this->setSuffix($suffix); } + if ($validationFile !== null) { + $this->setValidationFile($validationFile); + } } public function isInitialized($property): bool @@ -195,7 +199,8 @@ public function isInitialized($property): bool /** * The ID of an uploaded file that contains training data. - See the [fine-tuning guide](/docs/guides/fine-tuning/creating-training-data) for more details. + + See the [fine-tuning guide](/docs/guides/legacy-fine-tuning/creating-training-data) for more details. */ public function getTrainingFile(): string { @@ -204,7 +209,8 @@ public function getTrainingFile(): string /** * The ID of an uploaded file that contains training data. - See the [fine-tuning guide](/docs/guides/fine-tuning/creating-training-data) for more details. + + See the [fine-tuning guide](/docs/guides/legacy-fine-tuning/creating-training-data) for more details. */ public function setTrainingFile(string $trainingFile): self { @@ -214,122 +220,88 @@ public function setTrainingFile(string $trainingFile): self } /** - * The ID of an uploaded file that contains validation data. - See the [fine-tuning guide](/docs/guides/fine-tuning/creating-training-data) for more details. + * The batch size to use for training. The batch size is the number of + for larger datasets. */ - public function getValidationFile(): ?string + public function getBatchSize(): ?int { - return $this->validationFile; + return $this->batchSize; } /** - * The ID of an uploaded file that contains validation data. - See the [fine-tuning guide](/docs/guides/fine-tuning/creating-training-data) for more details. + * The batch size to use for training. The batch size is the number of + for larger datasets. */ - public function setValidationFile(?string $validationFile): self + public function setBatchSize(?int $batchSize): self { - $this->initialized['validationFile'] = true; - $this->validationFile = $validationFile; + $this->initialized['batchSize'] = true; + $this->batchSize = $batchSize; return $this; } /** - * The name of the base model to fine-tune. You can select one of "ada", - [Models](https://platform.openai.com/docs/models) documentation. + * If this is provided, we calculate F-beta scores at the specified + * + * @return float[]|null */ - public function getModel(): ?string + public function getClassificationBetas(): ?array { - return $this->model; + return $this->classificationBetas; } /** - * The name of the base model to fine-tune. You can select one of "ada", - [Models](https://platform.openai.com/docs/models) documentation. + * If this is provided, we calculate F-beta scores at the specified + * + * @param float[]|null $classificationBetas */ - public function setModel(?string $model): self + public function setClassificationBetas(?array $classificationBetas): self { - $this->initialized['model'] = true; - $this->model = $model; + $this->initialized['classificationBetas'] = true; + $this->classificationBetas = $classificationBetas; return $this; } /** - * The number of epochs to train the model for. An epoch refers to one - full cycle through the training dataset. - */ - public function getNEpochs(): ?int - { - return $this->nEpochs; - } + * The number of classes in a classification task. - /** - * The number of epochs to train the model for. An epoch refers to one - full cycle through the training dataset. + This parameter is required for multiclass classification. */ - public function setNEpochs(?int $nEpochs): self + public function getClassificationNClasses(): ?int { - $this->initialized['nEpochs'] = true; - $this->nEpochs = $nEpochs; - return $this; + return $this->classificationNClasses; } /** - * The batch size to use for training. The batch size is the number of - for larger datasets. - */ - public function getBatchSize(): ?int - { - return $this->batchSize; - } + * The number of classes in a classification task. - /** - * The batch size to use for training. The batch size is the number of - for larger datasets. + This parameter is required for multiclass classification. */ - public function setBatchSize(?int $batchSize): self + public function setClassificationNClasses(?int $classificationNClasses): self { - $this->initialized['batchSize'] = true; - $this->batchSize = $batchSize; + $this->initialized['classificationNClasses'] = true; + $this->classificationNClasses = $classificationNClasses; return $this; } /** - * The learning rate multiplier to use for training. - results. - */ - public function getLearningRateMultiplier(): ?float - { - return $this->learningRateMultiplier; - } + * The positive class in binary classification. - /** - * The learning rate multiplier to use for training. - results. + metrics when doing binary classification. */ - public function setLearningRateMultiplier(?float $learningRateMultiplier): self + public function getClassificationPositiveClass(): ?string { - $this->initialized['learningRateMultiplier'] = true; - $this->learningRateMultiplier = $learningRateMultiplier; - return $this; + return $this->classificationPositiveClass; } /** - * The weight to use for loss on the prompt tokens. This controls how - learning the prompt. - */ - public function getPromptLossWeight(): ?float - { - return $this->promptLossWeight; - } + * The positive class in binary classification. - /** - * The weight to use for loss on the prompt tokens. This controls how - learning the prompt. + metrics when doing binary classification. */ - public function setPromptLossWeight(?float $promptLossWeight): self + public function setClassificationPositiveClass(?string $classificationPositiveClass): self { - $this->initialized['promptLossWeight'] = true; - $this->promptLossWeight = $promptLossWeight; + $this->initialized['classificationPositiveClass'] = true; + $this->classificationPositiveClass = $classificationPositiveClass; return $this; } @@ -354,69 +326,87 @@ public function setComputeClassificationMetrics(?bool $computeClassificationMetr } /** - * The number of classes in a classification task. - This parameter is required for multiclass classification. + * The hyperparameters used for the fine-tuning job. */ - public function getClassificationNClasses(): ?int + public function getHyperparameters(): CreateFineTuneRequestHyperparameters { - return $this->classificationNClasses; + return $this->hyperparameters; } /** - * The number of classes in a classification task. - This parameter is required for multiclass classification. + * The hyperparameters used for the fine-tuning job. */ - public function setClassificationNClasses(?int $classificationNClasses): self + public function setHyperparameters(CreateFineTuneRequestHyperparameters $hyperparameters): self { - $this->initialized['classificationNClasses'] = true; - $this->classificationNClasses = $classificationNClasses; + $this->initialized['hyperparameters'] = true; + $this->hyperparameters = $hyperparameters; return $this; } /** - * The positive class in binary classification. - metrics when doing binary classification. + * The learning rate multiplier to use for training. + results. */ - public function getClassificationPositiveClass(): ?string + public function getLearningRateMultiplier(): ?float { - return $this->classificationPositiveClass; + return $this->learningRateMultiplier; } /** - * The positive class in binary classification. - metrics when doing binary classification. + * The learning rate multiplier to use for training. + results. */ - public function setClassificationPositiveClass(?string $classificationPositiveClass): self + public function setLearningRateMultiplier(?float $learningRateMultiplier): self { - $this->initialized['classificationPositiveClass'] = true; - $this->classificationPositiveClass = $classificationPositiveClass; + $this->initialized['learningRateMultiplier'] = true; + $this->learningRateMultiplier = $learningRateMultiplier; return $this; } /** - * If this is provided, we calculate F-beta scores at the specified + * The name of the base model to fine-tune. You can select one of "ada", * - * @return float[]|null + * @return mixed */ - public function getClassificationBetas(): ?array + public function getModel(): string { - return $this->classificationBetas; + return $this->model; } /** - * If this is provided, we calculate F-beta scores at the specified - * - * @param float[]|null $classificationBetas + * The name of the base model to fine-tune. You can select one of "ada", + [Models](/docs/models) documentation. */ - public function setClassificationBetas(?array $classificationBetas): self + public function setModel(mixed $model): self { - $this->initialized['classificationBetas'] = true; - $this->classificationBetas = $classificationBetas; + $this->initialized['model'] = true; + $this->model = $model; + return $this; + } + + /** + * The weight to use for loss on the prompt tokens. This controls how + learning the prompt. + */ + public function getPromptLossWeight(): ?float + { + return $this->promptLossWeight; + } + + /** + * The weight to use for loss on the prompt tokens. This controls how + learning the prompt. + */ + public function setPromptLossWeight(?float $promptLossWeight): self + { + $this->initialized['promptLossWeight'] = true; + $this->promptLossWeight = $promptLossWeight; return $this; } /** * A string of up to 40 characters that will be added to your fine-tuned model name. + For example, a `suffix` of "custom-model-name" would produce a model name like `ada:ft-your-org:custom-model-name-2022-02-15-04-21-04`. */ public function getSuffix(): ?string @@ -426,6 +416,7 @@ public function getSuffix(): ?string /** * A string of up to 40 characters that will be added to your fine-tuned model name. + For example, a `suffix` of "custom-model-name" would produce a model name like `ada:ft-your-org:custom-model-name-2022-02-15-04-21-04`. */ public function setSuffix(?string $suffix): self @@ -434,4 +425,26 @@ public function setSuffix(?string $suffix): self $this->suffix = $suffix; return $this; } + + /** + * The ID of an uploaded file that contains validation data. + + See the [fine-tuning guide](/docs/guides/legacy-fine-tuning/creating-training-data) for more details. + */ + public function getValidationFile(): ?string + { + return $this->validationFile; + } + + /** + * The ID of an uploaded file that contains validation data. + + See the [fine-tuning guide](/docs/guides/legacy-fine-tuning/creating-training-data) for more details. + */ + public function setValidationFile(?string $validationFile): self + { + $this->initialized['validationFile'] = true; + $this->validationFile = $validationFile; + return $this; + } } diff --git a/generated/Model/CreateFineTuneRequestHyperparameters.php b/generated/Model/CreateFineTuneRequestHyperparameters.php new file mode 100644 index 0000000..2e6bcd1 --- /dev/null +++ b/generated/Model/CreateFineTuneRequestHyperparameters.php @@ -0,0 +1,56 @@ +setNEpochs($nEpochs); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The number of epochs to train the model for. An epoch refers to one + * + * @return mixed + */ + public function getNEpochs(): string + { + return $this->nEpochs; + } + + /** + * The number of epochs to train the model for. An epoch refers to one + full cycle through the training dataset. + */ + public function setNEpochs(mixed $nEpochs): self + { + $this->initialized['nEpochs'] = true; + $this->nEpochs = $nEpochs; + return $this; + } +} diff --git a/generated/Model/CreateFineTuningJobRequest.php b/generated/Model/CreateFineTuningJobRequest.php new file mode 100644 index 0000000..cc31cda --- /dev/null +++ b/generated/Model/CreateFineTuningJobRequest.php @@ -0,0 +1,192 @@ +setModel($model); + } + if ($trainingFile !== null) { + $this->setTrainingFile($trainingFile); + } + if ($hyperparameters !== null) { + $this->setHyperparameters($hyperparameters); + } + if ($suffix !== null) { + $this->setSuffix($suffix); + } + if ($validationFile !== null) { + $this->setValidationFile($validationFile); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The name of the model to fine-tune. You can select one of the + * + * @return mixed + */ + public function getModel() + { + return $this->model; + } + + /** + * The name of the model to fine-tune. You can select one of the + [supported models](/docs/guides/fine-tuning/what-models-can-be-fine-tuned). + */ + public function setModel(mixed $model): self + { + $this->initialized['model'] = true; + $this->model = $model; + return $this; + } + + /** + * The ID of an uploaded file that contains training data. + + See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. + */ + public function getTrainingFile(): string + { + return $this->trainingFile; + } + + /** + * The ID of an uploaded file that contains training data. + + See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. + */ + public function setTrainingFile(string $trainingFile): self + { + $this->initialized['trainingFile'] = true; + $this->trainingFile = $trainingFile; + return $this; + } + + /** + * The hyperparameters used for the fine-tuning job. + */ + public function getHyperparameters(): CreateFineTuningJobRequestHyperparameters + { + return $this->hyperparameters; + } + + /** + * The hyperparameters used for the fine-tuning job. + */ + public function setHyperparameters(CreateFineTuningJobRequestHyperparameters $hyperparameters): self + { + $this->initialized['hyperparameters'] = true; + $this->hyperparameters = $hyperparameters; + return $this; + } + + /** + * A string of up to 18 characters that will be added to your fine-tuned model name. + + For example, a `suffix` of "custom-model-name" would produce a model name like `ft:gpt-3.5-turbo:openai:custom-model-name:7p4lURel`. + */ + public function getSuffix(): ?string + { + return $this->suffix; + } + + /** + * A string of up to 18 characters that will be added to your fine-tuned model name. + + For example, a `suffix` of "custom-model-name" would produce a model name like `ft:gpt-3.5-turbo:openai:custom-model-name:7p4lURel`. + */ + public function setSuffix(?string $suffix): self + { + $this->initialized['suffix'] = true; + $this->suffix = $suffix; + return $this; + } + + /** + * The ID of an uploaded file that contains validation data. + + See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. + */ + public function getValidationFile(): ?string + { + return $this->validationFile; + } + + /** + * The ID of an uploaded file that contains validation data. + + See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. + */ + public function setValidationFile(?string $validationFile): self + { + $this->initialized['validationFile'] = true; + $this->validationFile = $validationFile; + return $this; + } +} diff --git a/generated/Model/CreateFineTuningJobRequestHyperparameters.php b/generated/Model/CreateFineTuningJobRequestHyperparameters.php new file mode 100644 index 0000000..6aed9f8 --- /dev/null +++ b/generated/Model/CreateFineTuningJobRequestHyperparameters.php @@ -0,0 +1,122 @@ +setBatchSize($batchSize); + } + if ($learningRateMultiplier !== null) { + $this->setLearningRateMultiplier($learningRateMultiplier); + } + if ($nEpochs !== null) { + $this->setNEpochs($nEpochs); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * Number of examples in each batch. A larger batch size means that model parameters + * + * @return mixed + */ + public function getBatchSize(): string + { + return $this->batchSize; + } + + /** + * Number of examples in each batch. A larger batch size means that model parameters + are updated less frequently, but with lower variance. + */ + public function setBatchSize(mixed $batchSize): self + { + $this->initialized['batchSize'] = true; + $this->batchSize = $batchSize; + return $this; + } + + /** + * Scaling factor for the learning rate. A smaller learning rate may be useful to avoid + * + * @return mixed + */ + public function getLearningRateMultiplier(): string + { + return $this->learningRateMultiplier; + } + + /** + * Scaling factor for the learning rate. A smaller learning rate may be useful to avoid + overfitting. + */ + public function setLearningRateMultiplier(mixed $learningRateMultiplier): self + { + $this->initialized['learningRateMultiplier'] = true; + $this->learningRateMultiplier = $learningRateMultiplier; + return $this; + } + + /** + * The number of epochs to train the model for. An epoch refers to one full cycle + * + * @return mixed + */ + public function getNEpochs(): string + { + return $this->nEpochs; + } + + /** + * The number of epochs to train the model for. An epoch refers to one full cycle + through the training dataset. + */ + public function setNEpochs(mixed $nEpochs): self + { + $this->initialized['nEpochs'] = true; + $this->nEpochs = $nEpochs; + return $this; + } +} diff --git a/generated/Model/CreateImageEditRequest.php b/generated/Model/CreateImageEditRequest.php index 253f645..a61a73a 100644 --- a/generated/Model/CreateImageEditRequest.php +++ b/generated/Model/CreateImageEditRequest.php @@ -15,15 +15,22 @@ class CreateImageEditRequest extends ArrayObject */ protected ?string $image = null; + /** + * A text description of the desired image(s). The maximum length is 1000 characters. + */ + protected ?string $prompt = null; + /** * An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. */ protected ?string $mask = null; /** - * A text description of the desired image(s). The maximum length is 1000 characters. + * The model to use for image generation. Only `dall-e-2` is supported at this time. + * + * @var mixed|null */ - protected ?string $prompt = null; + protected string $model = 'dall-e-2'; /** * The number of images to generate. Must be between 1 and 10. @@ -47,23 +54,27 @@ class CreateImageEditRequest extends ArrayObject /** * @param string $image The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask is not provided, image must have transparency, which will be used as the mask. - * @param string $mask An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. * @param string $prompt A text description of the desired image(s). The maximum length is 1000 characters. + * @param string $mask An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. + * @param mixed|null $model The model to use for image generation. Only `dall-e-2` is supported at this time. * @param int|null $n The number of images to generate. Must be between 1 and 10. * @param string|null $size The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. * @param string|null $responseFormat The format in which the generated images are returned. Must be one of `url` or `b64_json`. * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). */ - public function __construct($image = null, $mask = null, $prompt = null, $n = 1, $size = '1024x1024', $responseFormat = 'url', $user = null) + public function __construct($image = null, $prompt = null, $mask = null, $model = 'dall-e-2', $n = 1, $size = '1024x1024', $responseFormat = 'url', $user = null) { if ($image !== null) { $this->setImage($image); } + if ($prompt !== null) { + $this->setPrompt($prompt); + } if ($mask !== null) { $this->setMask($mask); } - if ($prompt !== null) { - $this->setPrompt($prompt); + if ($model !== null) { + $this->setModel($model); } if ($n !== null) { $this->setN($n); @@ -102,6 +113,24 @@ public function setImage(string $image): self return $this; } + /** + * A text description of the desired image(s). The maximum length is 1000 characters. + */ + public function getPrompt(): string + { + return $this->prompt; + } + + /** + * A text description of the desired image(s). The maximum length is 1000 characters. + */ + public function setPrompt(string $prompt): self + { + $this->initialized['prompt'] = true; + $this->prompt = $prompt; + return $this; + } + /** * An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. */ @@ -121,20 +150,22 @@ public function setMask(string $mask): self } /** - * A text description of the desired image(s). The maximum length is 1000 characters. + * The model to use for image generation. Only `dall-e-2` is supported at this time. + * + * @return mixed */ - public function getPrompt(): string + public function getModel(): string { - return $this->prompt; + return $this->model; } /** - * A text description of the desired image(s). The maximum length is 1000 characters. + * The model to use for image generation. Only `dall-e-2` is supported at this time. */ - public function setPrompt(string $prompt): self + public function setModel(mixed $model): self { - $this->initialized['prompt'] = true; - $this->prompt = $prompt; + $this->initialized['model'] = true; + $this->model = $model; return $this; } diff --git a/generated/Model/CreateImageRequest.php b/generated/Model/CreateImageRequest.php index 55dca7a..c4f036e 100644 --- a/generated/Model/CreateImageRequest.php +++ b/generated/Model/CreateImageRequest.php @@ -11,51 +11,80 @@ class CreateImageRequest extends ArrayObject protected array $initialized = []; /** - * A text description of the desired image(s). The maximum length is 1000 characters. + * A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`. */ protected ?string $prompt = null; /** - * The number of images to generate. Must be between 1 and 10. + * The model to use for image generation. + * + * @var mixed|null + */ + protected string $model = 'dall-e-2'; + + /** + * The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported. */ protected ?int $n = 1; /** - * The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * The quality of the image that will be generated. `hd` creates images with finer details and greater consistency across the image. This param is only supported for `dall-e-3`. */ - protected ?string $size = '1024x1024'; + protected string $quality = 'standard'; /** * The format in which the generated images are returned. Must be one of `url` or `b64_json`. */ protected ?string $responseFormat = 'url'; + /** + * The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3` models. + */ + protected ?string $size = '1024x1024'; + + /** + * The style of the generated images. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images. This param is only supported for `dall-e-3`. + */ + protected ?string $style = 'vivid'; + /** * A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). */ protected ?string $user = null; /** - * @param string $prompt A text description of the desired image(s). The maximum length is 1000 characters. - * @param int|null $n The number of images to generate. Must be between 1 and 10. - * @param string|null $size The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param string $prompt A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`. + * @param mixed|null $model The model to use for image generation. + * @param int|null $n The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported. + * @param string $quality The quality of the image that will be generated. `hd` creates images with finer details and greater consistency across the image. This param is only supported for `dall-e-3`. * @param string|null $responseFormat The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @param string|null $size The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3` models. + * @param string|null $style The style of the generated images. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images. This param is only supported for `dall-e-3`. * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). */ - public function __construct($prompt = null, $n = 1, $size = '1024x1024', $responseFormat = 'url', $user = null) + public function __construct($prompt = null, $model = 'dall-e-2', $n = 1, $quality = 'standard', $responseFormat = 'url', $size = '1024x1024', $style = 'vivid', $user = null) { if ($prompt !== null) { $this->setPrompt($prompt); } + if ($model !== null) { + $this->setModel($model); + } if ($n !== null) { $this->setN($n); } - if ($size !== null) { - $this->setSize($size); + if ($quality !== null) { + $this->setQuality($quality); } if ($responseFormat !== null) { $this->setResponseFormat($responseFormat); } + if ($size !== null) { + $this->setSize($size); + } + if ($style !== null) { + $this->setStyle($style); + } if ($user !== null) { $this->setUser($user); } @@ -67,7 +96,7 @@ public function isInitialized($property): bool } /** - * A text description of the desired image(s). The maximum length is 1000 characters. + * A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`. */ public function getPrompt(): string { @@ -75,7 +104,7 @@ public function getPrompt(): string } /** - * A text description of the desired image(s). The maximum length is 1000 characters. + * A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`. */ public function setPrompt(string $prompt): self { @@ -85,7 +114,27 @@ public function setPrompt(string $prompt): self } /** - * The number of images to generate. Must be between 1 and 10. + * The model to use for image generation. + * + * @return mixed + */ + public function getModel(): string + { + return $this->model; + } + + /** + * The model to use for image generation. + */ + public function setModel(mixed $model): self + { + $this->initialized['model'] = true; + $this->model = $model; + return $this; + } + + /** + * The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported. */ public function getN(): ?int { @@ -93,7 +142,7 @@ public function getN(): ?int } /** - * The number of images to generate. Must be between 1 and 10. + * The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported. */ public function setN(?int $n): self { @@ -103,20 +152,20 @@ public function setN(?int $n): self } /** - * The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * The quality of the image that will be generated. `hd` creates images with finer details and greater consistency across the image. This param is only supported for `dall-e-3`. */ - public function getSize(): ?string + public function getQuality(): string { - return $this->size; + return $this->quality; } /** - * The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * The quality of the image that will be generated. `hd` creates images with finer details and greater consistency across the image. This param is only supported for `dall-e-3`. */ - public function setSize(?string $size): self + public function setQuality(string $quality): self { - $this->initialized['size'] = true; - $this->size = $size; + $this->initialized['quality'] = true; + $this->quality = $quality; return $this; } @@ -138,6 +187,42 @@ public function setResponseFormat(?string $responseFormat): self return $this; } + /** + * The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3` models. + */ + public function getSize(): ?string + { + return $this->size; + } + + /** + * The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3` models. + */ + public function setSize(?string $size): self + { + $this->initialized['size'] = true; + $this->size = $size; + return $this; + } + + /** + * The style of the generated images. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images. This param is only supported for `dall-e-3`. + */ + public function getStyle(): ?string + { + return $this->style; + } + + /** + * The style of the generated images. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images. This param is only supported for `dall-e-3`. + */ + public function setStyle(?string $style): self + { + $this->initialized['style'] = true; + $this->style = $style; + return $this; + } + /** * A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). */ diff --git a/generated/Model/CreateImageVariationRequest.php b/generated/Model/CreateImageVariationRequest.php index 1819ca9..46f2329 100644 --- a/generated/Model/CreateImageVariationRequest.php +++ b/generated/Model/CreateImageVariationRequest.php @@ -16,20 +16,27 @@ class CreateImageVariationRequest extends ArrayObject protected ?string $image = null; /** - * The number of images to generate. Must be between 1 and 10. + * The model to use for image generation. Only `dall-e-2` is supported at this time. + * + * @var mixed|null */ - protected ?int $n = 1; + protected string $model = 'dall-e-2'; /** - * The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported. */ - protected ?string $size = '1024x1024'; + protected ?int $n = 1; /** * The format in which the generated images are returned. Must be one of `url` or `b64_json`. */ protected ?string $responseFormat = 'url'; + /** + * The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + */ + protected ?string $size = '1024x1024'; + /** * A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). */ @@ -37,25 +44,29 @@ class CreateImageVariationRequest extends ArrayObject /** * @param string $image The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square. - * @param int|null $n The number of images to generate. Must be between 1 and 10. - * @param string|null $size The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * @param mixed|null $model The model to use for image generation. Only `dall-e-2` is supported at this time. + * @param int|null $n The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported. * @param string|null $responseFormat The format in which the generated images are returned. Must be one of `url` or `b64_json`. + * @param string|null $size The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). */ - public function __construct($image = null, $n = 1, $size = '1024x1024', $responseFormat = 'url', $user = null) + public function __construct($image = null, $model = 'dall-e-2', $n = 1, $responseFormat = 'url', $size = '1024x1024', $user = null) { if ($image !== null) { $this->setImage($image); } + if ($model !== null) { + $this->setModel($model); + } if ($n !== null) { $this->setN($n); } - if ($size !== null) { - $this->setSize($size); - } if ($responseFormat !== null) { $this->setResponseFormat($responseFormat); } + if ($size !== null) { + $this->setSize($size); + } if ($user !== null) { $this->setUser($user); } @@ -85,38 +96,40 @@ public function setImage(string $image): self } /** - * The number of images to generate. Must be between 1 and 10. + * The model to use for image generation. Only `dall-e-2` is supported at this time. + * + * @return mixed */ - public function getN(): ?int + public function getModel(): string { - return $this->n; + return $this->model; } /** - * The number of images to generate. Must be between 1 and 10. + * The model to use for image generation. Only `dall-e-2` is supported at this time. */ - public function setN(?int $n): self + public function setModel(mixed $model): self { - $this->initialized['n'] = true; - $this->n = $n; + $this->initialized['model'] = true; + $this->model = $model; return $this; } /** - * The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported. */ - public function getSize(): ?string + public function getN(): ?int { - return $this->size; + return $this->n; } /** - * The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + * The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported. */ - public function setSize(?string $size): self + public function setN(?int $n): self { - $this->initialized['size'] = true; - $this->size = $size; + $this->initialized['n'] = true; + $this->n = $n; return $this; } @@ -138,6 +151,24 @@ public function setResponseFormat(?string $responseFormat): self return $this; } + /** + * The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + */ + public function getSize(): ?string + { + return $this->size; + } + + /** + * The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. + */ + public function setSize(?string $size): self + { + $this->initialized['size'] = true; + $this->size = $size; + return $this; + } + /** * A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). */ diff --git a/generated/Model/CreateMessageRequest.php b/generated/Model/CreateMessageRequest.php new file mode 100644 index 0000000..4fdd8b0 --- /dev/null +++ b/generated/Model/CreateMessageRequest.php @@ -0,0 +1,141 @@ +|null + */ + protected $metadata = null; + + /** + * @param string $role The role of the entity that is creating the message. Currently only `user` is supported. + * @param string $content The content of the message. + * @param string[] $fileIds A list of [File](/docs/api-reference/files) IDs that the message should use. There can be a maximum of 10 files attached to a message. Useful for tools like `retrieval` and `code_interpreter` that can access and use files. + * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + */ + public function __construct($role = null, $content = null, $fileIds = [], $metadata = null) + { + if ($role !== null) { + $this->setRole($role); + } + if ($content !== null) { + $this->setContent($content); + } + if ($fileIds !== null) { + $this->setFileIds($fileIds); + } + if ($metadata !== null) { + $this->setMetadata($metadata); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The role of the entity that is creating the message. Currently only `user` is supported. + */ + public function getRole(): string + { + return $this->role; + } + + /** + * The role of the entity that is creating the message. Currently only `user` is supported. + */ + public function setRole(string $role): self + { + $this->initialized['role'] = true; + $this->role = $role; + return $this; + } + + /** + * The content of the message. + */ + public function getContent(): string + { + return $this->content; + } + + /** + * The content of the message. + */ + public function setContent(string $content): self + { + $this->initialized['content'] = true; + $this->content = $content; + return $this; + } + + /** + * A list of [File](/docs/api-reference/files) IDs that the message should use. There can be a maximum of 10 files attached to a message. Useful for tools like `retrieval` and `code_interpreter` that can access and use files. + * + * @return string[] + */ + public function getFileIds(): array + { + return $this->fileIds; + } + + /** + * A list of [File](/docs/api-reference/files) IDs that the message should use. There can be a maximum of 10 files attached to a message. Useful for tools like `retrieval` and `code_interpreter` that can access and use files. + * + * @param string[] $fileIds + */ + public function setFileIds(array $fileIds): self + { + $this->initialized['fileIds'] = true; + $this->fileIds = $fileIds; + return $this; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @return array|null + */ + public function getMetadata(): ?iterable + { + return $this->metadata; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @param array|null $metadata + */ + public function setMetadata(?iterable $metadata): self + { + $this->initialized['metadata'] = true; + $this->metadata = $metadata; + return $this; + } +} diff --git a/generated/Model/CreateModerationRequest.php b/generated/Model/CreateModerationRequest.php index d1d2f42..d650289 100644 --- a/generated/Model/CreateModerationRequest.php +++ b/generated/Model/CreateModerationRequest.php @@ -19,16 +19,18 @@ class CreateModerationRequest extends ArrayObject /** * Two content moderations models are available: `text-moderation-stable` and `text-moderation-latest`. - The default is `text-moderation-latest` which will be automatically upgraded over time. This ensures you are always using our most accurate model. If you use `text-moderation-stable`, we will provide advanced notice before updating the model. Accuracy of `text-moderation-stable` may be slightly lower than for `text-moderation-latest`. + + * + * @var mixed */ protected string $model = 'text-moderation-latest'; /** * @param mixed $input The input text to classify - * @param string $model Two content moderations models are available: `text-moderation-stable` and `text-moderation-latest`. - * The default is `text-moderation-latest` which will be automatically upgraded over time. This ensures you are always using our most accurate model. If you use `text-moderation-stable`, we will provide advanced notice before updating the model. Accuracy of `text-moderation-stable` may be slightly lower than for `text-moderation-latest`. + * @param mixed $model Two content moderations models are available: `text-moderation-stable` and `text-moderation-latest`. + * The default is `text-moderation-latest` which will be automatically upgraded over time. This ensures you are always using our most accurate model. If you use `text-moderation-stable`, we will provide advanced notice before updating the model. Accuracy of `text-moderation-stable` may be slightly lower than for `text-moderation-latest`. */ - public function __construct(mixed $input = null, $model = 'text-moderation-latest') + public function __construct(mixed $input = null, mixed $model = 'text-moderation-latest') { if ($input !== null) { $this->setInput($input); @@ -65,7 +67,9 @@ public function setInput(mixed $input): self /** * Two content moderations models are available: `text-moderation-stable` and `text-moderation-latest`. - The default is `text-moderation-latest` which will be automatically upgraded over time. This ensures you are always using our most accurate model. If you use `text-moderation-stable`, we will provide advanced notice before updating the model. Accuracy of `text-moderation-stable` may be slightly lower than for `text-moderation-latest`. + + * + * @return mixed */ public function getModel(): string { @@ -74,9 +78,10 @@ public function getModel(): string /** * Two content moderations models are available: `text-moderation-stable` and `text-moderation-latest`. + The default is `text-moderation-latest` which will be automatically upgraded over time. This ensures you are always using our most accurate model. If you use `text-moderation-stable`, we will provide advanced notice before updating the model. Accuracy of `text-moderation-stable` may be slightly lower than for `text-moderation-latest`. */ - public function setModel(string $model): self + public function setModel(mixed $model): self { $this->initialized['model'] = true; $this->model = $model; diff --git a/generated/Model/CreateModerationResponse.php b/generated/Model/CreateModerationResponse.php index b0d032a..eb866d6 100644 --- a/generated/Model/CreateModerationResponse.php +++ b/generated/Model/CreateModerationResponse.php @@ -10,19 +10,27 @@ class CreateModerationResponse extends ArrayObject { protected array $initialized = []; + /** + * The unique identifier for the moderation request. + */ protected ?string $id = null; + /** + * The model used to generate the moderation results. + */ protected ?string $model = null; /** - * @var CreateModerationResponseResultsItem[]|null + * A list of moderation objects. + * + * @var CreateModerationResponseResultsItem[] */ protected ?array $results = null; /** - * @param string $id - * @param string $model - * @param CreateModerationResponseResultsItem[] $results + * @param string $id The unique identifier for the moderation request. + * @param string $model The model used to generate the moderation results. + * @param CreateModerationResponseResultsItem[] $results A list of moderation objects. */ public function __construct($id = null, $model = null, $results = null) { @@ -42,11 +50,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } + /** + * The unique identifier for the moderation request. + */ public function getId(): string { return $this->id; } + /** + * The unique identifier for the moderation request. + */ public function setId(string $id): self { $this->initialized['id'] = true; @@ -54,11 +68,17 @@ public function setId(string $id): self return $this; } + /** + * The model used to generate the moderation results. + */ public function getModel(): string { return $this->model; } + /** + * The model used to generate the moderation results. + */ public function setModel(string $model): self { $this->initialized['model'] = true; @@ -67,6 +87,8 @@ public function setModel(string $model): self } /** + * A list of moderation objects. + * * @return CreateModerationResponseResultsItem[] */ public function getResults(): array @@ -75,6 +97,8 @@ public function getResults(): array } /** + * A list of moderation objects. + * * @param CreateModerationResponseResultsItem[] $results */ public function setResults(array $results): self diff --git a/generated/Model/CreateModerationResponseResultsItem.php b/generated/Model/CreateModerationResponseResultsItem.php index 452c576..f7e8b39 100644 --- a/generated/Model/CreateModerationResponseResultsItem.php +++ b/generated/Model/CreateModerationResponseResultsItem.php @@ -10,16 +10,25 @@ class CreateModerationResponseResultsItem extends ArrayObject { protected array $initialized = []; + /** + * Whether the content violates [OpenAI's usage policies](/policies/usage-policies). + */ protected ?bool $flagged = null; + /** + * A list of the categories, and whether they are flagged or not. + */ protected ?CreateModerationResponseResultsItemCategories $categories = null; + /** + * A list of the categories along with their scores as predicted by model. + */ protected ?CreateModerationResponseResultsItemCategoryScores $categoryScores = null; /** - * @param bool $flagged - * @param CreateModerationResponseResultsItemCategories $categories - * @param CreateModerationResponseResultsItemCategoryScores $categoryScores + * @param bool $flagged Whether the content violates [OpenAI's usage policies](/policies/usage-policies). + * @param CreateModerationResponseResultsItemCategories $categories A list of the categories, and whether they are flagged or not. + * @param CreateModerationResponseResultsItemCategoryScores $categoryScores A list of the categories along with their scores as predicted by model. */ public function __construct($flagged = null, $categories = null, $categoryScores = null) { @@ -39,11 +48,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } + /** + * Whether the content violates [OpenAI's usage policies](/policies/usage-policies). + */ public function getFlagged(): bool { return $this->flagged; } + /** + * Whether the content violates [OpenAI's usage policies](/policies/usage-policies). + */ public function setFlagged(bool $flagged): self { $this->initialized['flagged'] = true; @@ -51,11 +66,17 @@ public function setFlagged(bool $flagged): self return $this; } + /** + * A list of the categories, and whether they are flagged or not. + */ public function getCategories(): CreateModerationResponseResultsItemCategories { return $this->categories; } + /** + * A list of the categories, and whether they are flagged or not. + */ public function setCategories(CreateModerationResponseResultsItemCategories $categories): self { $this->initialized['categories'] = true; @@ -63,11 +84,17 @@ public function setCategories(CreateModerationResponseResultsItemCategories $cat return $this; } + /** + * A list of the categories along with their scores as predicted by model. + */ public function getCategoryScores(): CreateModerationResponseResultsItemCategoryScores { return $this->categoryScores; } + /** + * A list of the categories along with their scores as predicted by model. + */ public function setCategoryScores(CreateModerationResponseResultsItemCategoryScores $categoryScores): self { $this->initialized['categoryScores'] = true; diff --git a/generated/Model/CreateModerationResponseResultsItemCategories.php b/generated/Model/CreateModerationResponseResultsItemCategories.php index 81c659d..d66d99e 100644 --- a/generated/Model/CreateModerationResponseResultsItemCategories.php +++ b/generated/Model/CreateModerationResponseResultsItemCategories.php @@ -10,30 +10,75 @@ class CreateModerationResponseResultsItemCategories extends ArrayObject { protected array $initialized = []; + /** + * Content that expresses, incites, or promotes hate based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. Hateful content aimed at non-protected groups (e.g., chess players) is harassment. + */ protected ?bool $hate = null; + /** + * Hateful content that also includes violence or serious harm towards the targeted group based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. + */ protected ?bool $hateThreatening = null; + /** + * Content that expresses, incites, or promotes harassing language towards any target. + */ + protected ?bool $harassment = null; + + /** + * Harassment content that also includes violence or serious harm towards any target. + */ + protected ?bool $harassmentThreatening = null; + + /** + * Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, and eating disorders. + */ protected ?bool $selfHarm = null; + /** + * Content where the speaker expresses that they are engaging or intend to engage in acts of self-harm, such as suicide, cutting, and eating disorders. + */ + protected ?bool $selfHarmIntent = null; + + /** + * Content that encourages performing acts of self-harm, such as suicide, cutting, and eating disorders, or that gives instructions or advice on how to commit such acts. + */ + protected ?bool $selfHarmInstructions = null; + + /** + * Content meant to arouse sexual excitement, such as the description of sexual activity, or that promotes sexual services (excluding sex education and wellness). + */ protected ?bool $sexual = null; + /** + * Sexual content that includes an individual who is under 18 years old. + */ protected ?bool $sexualMinors = null; + /** + * Content that depicts death, violence, or physical injury. + */ protected ?bool $violence = null; + /** + * Content that depicts death, violence, or physical injury in graphic detail. + */ protected ?bool $violenceGraphic = null; /** - * @param bool $hate - * @param bool $hateThreatening - * @param bool $selfHarm - * @param bool $sexual - * @param bool $sexualMinors - * @param bool $violence - * @param bool $violenceGraphic + * @param bool $hate Content that expresses, incites, or promotes hate based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. Hateful content aimed at non-protected groups (e.g., chess players) is harassment. + * @param bool $hateThreatening Hateful content that also includes violence or serious harm towards the targeted group based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. + * @param bool $harassment Content that expresses, incites, or promotes harassing language towards any target. + * @param bool $harassmentThreatening Harassment content that also includes violence or serious harm towards any target. + * @param bool $selfHarm Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, and eating disorders. + * @param bool $selfHarmIntent Content where the speaker expresses that they are engaging or intend to engage in acts of self-harm, such as suicide, cutting, and eating disorders. + * @param bool $selfHarmInstructions Content that encourages performing acts of self-harm, such as suicide, cutting, and eating disorders, or that gives instructions or advice on how to commit such acts. + * @param bool $sexual Content meant to arouse sexual excitement, such as the description of sexual activity, or that promotes sexual services (excluding sex education and wellness). + * @param bool $sexualMinors Sexual content that includes an individual who is under 18 years old. + * @param bool $violence Content that depicts death, violence, or physical injury. + * @param bool $violenceGraphic Content that depicts death, violence, or physical injury in graphic detail. */ - public function __construct($hate = null, $hateThreatening = null, $selfHarm = null, $sexual = null, $sexualMinors = null, $violence = null, $violenceGraphic = null) + public function __construct($hate = null, $hateThreatening = null, $harassment = null, $harassmentThreatening = null, $selfHarm = null, $selfHarmIntent = null, $selfHarmInstructions = null, $sexual = null, $sexualMinors = null, $violence = null, $violenceGraphic = null) { if ($hate !== null) { $this->setHate($hate); @@ -41,9 +86,21 @@ public function __construct($hate = null, $hateThreatening = null, $selfHarm = n if ($hateThreatening !== null) { $this->setHateThreatening($hateThreatening); } + if ($harassment !== null) { + $this->setHarassment($harassment); + } + if ($harassmentThreatening !== null) { + $this->setHarassmentThreatening($harassmentThreatening); + } if ($selfHarm !== null) { $this->setSelfHarm($selfHarm); } + if ($selfHarmIntent !== null) { + $this->setSelfHarmIntent($selfHarmIntent); + } + if ($selfHarmInstructions !== null) { + $this->setSelfHarmInstructions($selfHarmInstructions); + } if ($sexual !== null) { $this->setSexual($sexual); } @@ -63,11 +120,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } + /** + * Content that expresses, incites, or promotes hate based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. Hateful content aimed at non-protected groups (e.g., chess players) is harassment. + */ public function getHate(): bool { return $this->hate; } + /** + * Content that expresses, incites, or promotes hate based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. Hateful content aimed at non-protected groups (e.g., chess players) is harassment. + */ public function setHate(bool $hate): self { $this->initialized['hate'] = true; @@ -75,11 +138,17 @@ public function setHate(bool $hate): self return $this; } + /** + * Hateful content that also includes violence or serious harm towards the targeted group based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. + */ public function getHateThreatening(): bool { return $this->hateThreatening; } + /** + * Hateful content that also includes violence or serious harm towards the targeted group based on race, gender, ethnicity, religion, nationality, sexual orientation, disability status, or caste. + */ public function setHateThreatening(bool $hateThreatening): self { $this->initialized['hateThreatening'] = true; @@ -87,11 +156,53 @@ public function setHateThreatening(bool $hateThreatening): self return $this; } + /** + * Content that expresses, incites, or promotes harassing language towards any target. + */ + public function getHarassment(): bool + { + return $this->harassment; + } + + /** + * Content that expresses, incites, or promotes harassing language towards any target. + */ + public function setHarassment(bool $harassment): self + { + $this->initialized['harassment'] = true; + $this->harassment = $harassment; + return $this; + } + + /** + * Harassment content that also includes violence or serious harm towards any target. + */ + public function getHarassmentThreatening(): bool + { + return $this->harassmentThreatening; + } + + /** + * Harassment content that also includes violence or serious harm towards any target. + */ + public function setHarassmentThreatening(bool $harassmentThreatening): self + { + $this->initialized['harassmentThreatening'] = true; + $this->harassmentThreatening = $harassmentThreatening; + return $this; + } + + /** + * Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, and eating disorders. + */ public function getSelfHarm(): bool { return $this->selfHarm; } + /** + * Content that promotes, encourages, or depicts acts of self-harm, such as suicide, cutting, and eating disorders. + */ public function setSelfHarm(bool $selfHarm): self { $this->initialized['selfHarm'] = true; @@ -99,11 +210,53 @@ public function setSelfHarm(bool $selfHarm): self return $this; } + /** + * Content where the speaker expresses that they are engaging or intend to engage in acts of self-harm, such as suicide, cutting, and eating disorders. + */ + public function getSelfHarmIntent(): bool + { + return $this->selfHarmIntent; + } + + /** + * Content where the speaker expresses that they are engaging or intend to engage in acts of self-harm, such as suicide, cutting, and eating disorders. + */ + public function setSelfHarmIntent(bool $selfHarmIntent): self + { + $this->initialized['selfHarmIntent'] = true; + $this->selfHarmIntent = $selfHarmIntent; + return $this; + } + + /** + * Content that encourages performing acts of self-harm, such as suicide, cutting, and eating disorders, or that gives instructions or advice on how to commit such acts. + */ + public function getSelfHarmInstructions(): bool + { + return $this->selfHarmInstructions; + } + + /** + * Content that encourages performing acts of self-harm, such as suicide, cutting, and eating disorders, or that gives instructions or advice on how to commit such acts. + */ + public function setSelfHarmInstructions(bool $selfHarmInstructions): self + { + $this->initialized['selfHarmInstructions'] = true; + $this->selfHarmInstructions = $selfHarmInstructions; + return $this; + } + + /** + * Content meant to arouse sexual excitement, such as the description of sexual activity, or that promotes sexual services (excluding sex education and wellness). + */ public function getSexual(): bool { return $this->sexual; } + /** + * Content meant to arouse sexual excitement, such as the description of sexual activity, or that promotes sexual services (excluding sex education and wellness). + */ public function setSexual(bool $sexual): self { $this->initialized['sexual'] = true; @@ -111,11 +264,17 @@ public function setSexual(bool $sexual): self return $this; } + /** + * Sexual content that includes an individual who is under 18 years old. + */ public function getSexualMinors(): bool { return $this->sexualMinors; } + /** + * Sexual content that includes an individual who is under 18 years old. + */ public function setSexualMinors(bool $sexualMinors): self { $this->initialized['sexualMinors'] = true; @@ -123,11 +282,17 @@ public function setSexualMinors(bool $sexualMinors): self return $this; } + /** + * Content that depicts death, violence, or physical injury. + */ public function getViolence(): bool { return $this->violence; } + /** + * Content that depicts death, violence, or physical injury. + */ public function setViolence(bool $violence): self { $this->initialized['violence'] = true; @@ -135,11 +300,17 @@ public function setViolence(bool $violence): self return $this; } + /** + * Content that depicts death, violence, or physical injury in graphic detail. + */ public function getViolenceGraphic(): bool { return $this->violenceGraphic; } + /** + * Content that depicts death, violence, or physical injury in graphic detail. + */ public function setViolenceGraphic(bool $violenceGraphic): self { $this->initialized['violenceGraphic'] = true; diff --git a/generated/Model/CreateModerationResponseResultsItemCategoryScores.php b/generated/Model/CreateModerationResponseResultsItemCategoryScores.php index f1b74b6..bbd066d 100644 --- a/generated/Model/CreateModerationResponseResultsItemCategoryScores.php +++ b/generated/Model/CreateModerationResponseResultsItemCategoryScores.php @@ -10,30 +10,75 @@ class CreateModerationResponseResultsItemCategoryScores extends ArrayObject { protected array $initialized = []; + /** + * The score for the category 'hate'. + */ protected ?float $hate = null; + /** + * The score for the category 'hate/threatening'. + */ protected ?float $hateThreatening = null; + /** + * The score for the category 'harassment'. + */ + protected ?float $harassment = null; + + /** + * The score for the category 'harassment/threatening'. + */ + protected ?float $harassmentThreatening = null; + + /** + * The score for the category 'self-harm'. + */ protected ?float $selfHarm = null; + /** + * The score for the category 'self-harm/intent'. + */ + protected ?float $selfHarmIntent = null; + + /** + * The score for the category 'self-harm/instructions'. + */ + protected ?float $selfHarmInstructions = null; + + /** + * The score for the category 'sexual'. + */ protected ?float $sexual = null; + /** + * The score for the category 'sexual/minors'. + */ protected ?float $sexualMinors = null; + /** + * The score for the category 'violence'. + */ protected ?float $violence = null; + /** + * The score for the category 'violence/graphic'. + */ protected ?float $violenceGraphic = null; /** - * @param float $hate - * @param float $hateThreatening - * @param float $selfHarm - * @param float $sexual - * @param float $sexualMinors - * @param float $violence - * @param float $violenceGraphic + * @param float $hate The score for the category 'hate'. + * @param float $hateThreatening The score for the category 'hate/threatening'. + * @param float $harassment The score for the category 'harassment'. + * @param float $harassmentThreatening The score for the category 'harassment/threatening'. + * @param float $selfHarm The score for the category 'self-harm'. + * @param float $selfHarmIntent The score for the category 'self-harm/intent'. + * @param float $selfHarmInstructions The score for the category 'self-harm/instructions'. + * @param float $sexual The score for the category 'sexual'. + * @param float $sexualMinors The score for the category 'sexual/minors'. + * @param float $violence The score for the category 'violence'. + * @param float $violenceGraphic The score for the category 'violence/graphic'. */ - public function __construct($hate = null, $hateThreatening = null, $selfHarm = null, $sexual = null, $sexualMinors = null, $violence = null, $violenceGraphic = null) + public function __construct($hate = null, $hateThreatening = null, $harassment = null, $harassmentThreatening = null, $selfHarm = null, $selfHarmIntent = null, $selfHarmInstructions = null, $sexual = null, $sexualMinors = null, $violence = null, $violenceGraphic = null) { if ($hate !== null) { $this->setHate($hate); @@ -41,9 +86,21 @@ public function __construct($hate = null, $hateThreatening = null, $selfHarm = n if ($hateThreatening !== null) { $this->setHateThreatening($hateThreatening); } + if ($harassment !== null) { + $this->setHarassment($harassment); + } + if ($harassmentThreatening !== null) { + $this->setHarassmentThreatening($harassmentThreatening); + } if ($selfHarm !== null) { $this->setSelfHarm($selfHarm); } + if ($selfHarmIntent !== null) { + $this->setSelfHarmIntent($selfHarmIntent); + } + if ($selfHarmInstructions !== null) { + $this->setSelfHarmInstructions($selfHarmInstructions); + } if ($sexual !== null) { $this->setSexual($sexual); } @@ -63,11 +120,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } + /** + * The score for the category 'hate'. + */ public function getHate(): float { return $this->hate; } + /** + * The score for the category 'hate'. + */ public function setHate(float $hate): self { $this->initialized['hate'] = true; @@ -75,11 +138,17 @@ public function setHate(float $hate): self return $this; } + /** + * The score for the category 'hate/threatening'. + */ public function getHateThreatening(): float { return $this->hateThreatening; } + /** + * The score for the category 'hate/threatening'. + */ public function setHateThreatening(float $hateThreatening): self { $this->initialized['hateThreatening'] = true; @@ -87,11 +156,53 @@ public function setHateThreatening(float $hateThreatening): self return $this; } + /** + * The score for the category 'harassment'. + */ + public function getHarassment(): float + { + return $this->harassment; + } + + /** + * The score for the category 'harassment'. + */ + public function setHarassment(float $harassment): self + { + $this->initialized['harassment'] = true; + $this->harassment = $harassment; + return $this; + } + + /** + * The score for the category 'harassment/threatening'. + */ + public function getHarassmentThreatening(): float + { + return $this->harassmentThreatening; + } + + /** + * The score for the category 'harassment/threatening'. + */ + public function setHarassmentThreatening(float $harassmentThreatening): self + { + $this->initialized['harassmentThreatening'] = true; + $this->harassmentThreatening = $harassmentThreatening; + return $this; + } + + /** + * The score for the category 'self-harm'. + */ public function getSelfHarm(): float { return $this->selfHarm; } + /** + * The score for the category 'self-harm'. + */ public function setSelfHarm(float $selfHarm): self { $this->initialized['selfHarm'] = true; @@ -99,11 +210,53 @@ public function setSelfHarm(float $selfHarm): self return $this; } + /** + * The score for the category 'self-harm/intent'. + */ + public function getSelfHarmIntent(): float + { + return $this->selfHarmIntent; + } + + /** + * The score for the category 'self-harm/intent'. + */ + public function setSelfHarmIntent(float $selfHarmIntent): self + { + $this->initialized['selfHarmIntent'] = true; + $this->selfHarmIntent = $selfHarmIntent; + return $this; + } + + /** + * The score for the category 'self-harm/instructions'. + */ + public function getSelfHarmInstructions(): float + { + return $this->selfHarmInstructions; + } + + /** + * The score for the category 'self-harm/instructions'. + */ + public function setSelfHarmInstructions(float $selfHarmInstructions): self + { + $this->initialized['selfHarmInstructions'] = true; + $this->selfHarmInstructions = $selfHarmInstructions; + return $this; + } + + /** + * The score for the category 'sexual'. + */ public function getSexual(): float { return $this->sexual; } + /** + * The score for the category 'sexual'. + */ public function setSexual(float $sexual): self { $this->initialized['sexual'] = true; @@ -111,11 +264,17 @@ public function setSexual(float $sexual): self return $this; } + /** + * The score for the category 'sexual/minors'. + */ public function getSexualMinors(): float { return $this->sexualMinors; } + /** + * The score for the category 'sexual/minors'. + */ public function setSexualMinors(float $sexualMinors): self { $this->initialized['sexualMinors'] = true; @@ -123,11 +282,17 @@ public function setSexualMinors(float $sexualMinors): self return $this; } + /** + * The score for the category 'violence'. + */ public function getViolence(): float { return $this->violence; } + /** + * The score for the category 'violence'. + */ public function setViolence(float $violence): self { $this->initialized['violence'] = true; @@ -135,11 +300,17 @@ public function setViolence(float $violence): self return $this; } + /** + * The score for the category 'violence/graphic'. + */ public function getViolenceGraphic(): float { return $this->violenceGraphic; } + /** + * The score for the category 'violence/graphic'. + */ public function setViolenceGraphic(float $violenceGraphic): self { $this->initialized['violenceGraphic'] = true; diff --git a/generated/Model/CreateRunRequest.php b/generated/Model/CreateRunRequest.php new file mode 100644 index 0000000..956d96b --- /dev/null +++ b/generated/Model/CreateRunRequest.php @@ -0,0 +1,195 @@ +|null + */ + protected $metadata = null; + + /** + * @param string $assistantId The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run. + * @param string|null $model The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used. + * @param string|null $instructions Overrides the [instructions](/docs/api-reference/assistants/createAssistant) of the assistant. This is useful for modifying the behavior on a per-run basis. + * @param string|null $additionalInstructions Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions. + * @param mixed[]|null $tools Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. + * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + */ + public function __construct($assistantId = null, $model = null, $instructions = null, $additionalInstructions = null, $tools = null, $metadata = null) + { + if ($assistantId !== null) { + $this->setAssistantId($assistantId); + } + if ($model !== null) { + $this->setModel($model); + } + if ($instructions !== null) { + $this->setInstructions($instructions); + } + if ($additionalInstructions !== null) { + $this->setAdditionalInstructions($additionalInstructions); + } + if ($tools !== null) { + $this->setTools($tools); + } + if ($metadata !== null) { + $this->setMetadata($metadata); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run. + */ + public function getAssistantId(): string + { + return $this->assistantId; + } + + /** + * The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run. + */ + public function setAssistantId(string $assistantId): self + { + $this->initialized['assistantId'] = true; + $this->assistantId = $assistantId; + return $this; + } + + /** + * The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used. + */ + public function getModel(): ?string + { + return $this->model; + } + + /** + * The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used. + */ + public function setModel(?string $model): self + { + $this->initialized['model'] = true; + $this->model = $model; + return $this; + } + + /** + * Overrides the [instructions](/docs/api-reference/assistants/createAssistant) of the assistant. This is useful for modifying the behavior on a per-run basis. + */ + public function getInstructions(): ?string + { + return $this->instructions; + } + + /** + * Overrides the [instructions](/docs/api-reference/assistants/createAssistant) of the assistant. This is useful for modifying the behavior on a per-run basis. + */ + public function setInstructions(?string $instructions): self + { + $this->initialized['instructions'] = true; + $this->instructions = $instructions; + return $this; + } + + /** + * Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions. + */ + public function getAdditionalInstructions(): ?string + { + return $this->additionalInstructions; + } + + /** + * Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions. + */ + public function setAdditionalInstructions(?string $additionalInstructions): self + { + $this->initialized['additionalInstructions'] = true; + $this->additionalInstructions = $additionalInstructions; + return $this; + } + + /** + * Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. + * + * @return mixed[]|null + */ + public function getTools(): ?array + { + return $this->tools; + } + + /** + * Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. + * + * @param mixed[]|null $tools + */ + public function setTools(?array $tools): self + { + $this->initialized['tools'] = true; + $this->tools = $tools; + return $this; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @return array|null + */ + public function getMetadata(): ?iterable + { + return $this->metadata; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @param array|null $metadata + */ + public function setMetadata(?iterable $metadata): self + { + $this->initialized['metadata'] = true; + $this->metadata = $metadata; + return $this; + } +} diff --git a/generated/Model/CreateSearchRequest.php b/generated/Model/CreateSearchRequest.php deleted file mode 100644 index f0d57a7..0000000 --- a/generated/Model/CreateSearchRequest.php +++ /dev/null @@ -1,207 +0,0 @@ -setQuery($query); - } - if ($documents !== null) { - $this->setDocuments($documents); - } - if ($file !== null) { - $this->setFile($file); - } - if ($maxRerank !== null) { - $this->setMaxRerank($maxRerank); - } - if ($returnMetadata !== null) { - $this->setReturnMetadata($returnMetadata); - } - if ($user !== null) { - $this->setUser($user); - } - } - - public function isInitialized($property): bool - { - return array_key_exists($property, $this->initialized); - } - - /** - * Query to search against the documents. - */ - public function getQuery(): string - { - return $this->query; - } - - /** - * Query to search against the documents. - */ - public function setQuery(string $query): self - { - $this->initialized['query'] = true; - $this->query = $query; - return $this; - } - - /** - * Up to 200 documents to search over, provided as a list of strings. - - * - * @return string[]|null - */ - public function getDocuments(): ?array - { - return $this->documents; - } - - /** - * Up to 200 documents to search over, provided as a list of strings. - * - * @param string[]|null $documents - */ - public function setDocuments(?array $documents): self - { - $this->initialized['documents'] = true; - $this->documents = $documents; - return $this; - } - - /** - * The ID of an uploaded file that contains documents to search over. - You should specify either `documents` or a `file`, but not both. - */ - public function getFile(): ?string - { - return $this->file; - } - - /** - * The ID of an uploaded file that contains documents to search over. - You should specify either `documents` or a `file`, but not both. - */ - public function setFile(?string $file): self - { - $this->initialized['file'] = true; - $this->file = $file; - return $this; - } - - /** - * The maximum number of documents to be re-ranked and returned by search. - This flag only takes effect when `file` is set. - */ - public function getMaxRerank(): ?int - { - return $this->maxRerank; - } - - /** - * The maximum number of documents to be re-ranked and returned by search. - This flag only takes effect when `file` is set. - */ - public function setMaxRerank(?int $maxRerank): self - { - $this->initialized['maxRerank'] = true; - $this->maxRerank = $maxRerank; - return $this; - } - - /** - * A special boolean flag for showing metadata. If set to `true`, each document entry in the returned JSON will contain a "metadata" field. - This flag only takes effect when `file` is set. - */ - public function getReturnMetadata(): ?bool - { - return $this->returnMetadata; - } - - /** - * A special boolean flag for showing metadata. If set to `true`, each document entry in the returned JSON will contain a "metadata" field. - This flag only takes effect when `file` is set. - */ - public function setReturnMetadata(?bool $returnMetadata): self - { - $this->initialized['returnMetadata'] = true; - $this->returnMetadata = $returnMetadata; - return $this; - } - - /** - * A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - */ - public function getUser(): string - { - return $this->user; - } - - /** - * A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - */ - public function setUser(string $user): self - { - $this->initialized['user'] = true; - $this->user = $user; - return $this; - } -} diff --git a/generated/Model/CreateSpeechRequest.php b/generated/Model/CreateSpeechRequest.php new file mode 100644 index 0000000..2a59d55 --- /dev/null +++ b/generated/Model/CreateSpeechRequest.php @@ -0,0 +1,160 @@ +setModel($model); + } + if ($input !== null) { + $this->setInput($input); + } + if ($voice !== null) { + $this->setVoice($voice); + } + if ($responseFormat !== null) { + $this->setResponseFormat($responseFormat); + } + if ($speed !== null) { + $this->setSpeed($speed); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * One of the available [TTS models](/docs/models/tts): `tts-1` or `tts-1-hd` + * + * @return mixed + */ + public function getModel() + { + return $this->model; + } + + /** + * One of the available [TTS models](/docs/models/tts): `tts-1` or `tts-1-hd` + */ + public function setModel(mixed $model): self + { + $this->initialized['model'] = true; + $this->model = $model; + return $this; + } + + /** + * The text to generate audio for. The maximum length is 4096 characters. + */ + public function getInput(): string + { + return $this->input; + } + + /** + * The text to generate audio for. The maximum length is 4096 characters. + */ + public function setInput(string $input): self + { + $this->initialized['input'] = true; + $this->input = $input; + return $this; + } + + /** + * The voice to use when generating the audio. Supported voices are `alloy`, `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are available in the [Text to speech guide](/docs/guides/text-to-speech/voice-options). + */ + public function getVoice(): string + { + return $this->voice; + } + + /** + * The voice to use when generating the audio. Supported voices are `alloy`, `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are available in the [Text to speech guide](/docs/guides/text-to-speech/voice-options). + */ + public function setVoice(string $voice): self + { + $this->initialized['voice'] = true; + $this->voice = $voice; + return $this; + } + + /** + * The format to audio in. Supported formats are `mp3`, `opus`, `aac`, and `flac`. + */ + public function getResponseFormat(): string + { + return $this->responseFormat; + } + + /** + * The format to audio in. Supported formats are `mp3`, `opus`, `aac`, and `flac`. + */ + public function setResponseFormat(string $responseFormat): self + { + $this->initialized['responseFormat'] = true; + $this->responseFormat = $responseFormat; + return $this; + } + + /** + * The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default. + */ + public function getSpeed(): float + { + return $this->speed; + } + + /** + * The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default. + */ + public function setSpeed(float $speed): self + { + $this->initialized['speed'] = true; + $this->speed = $speed; + return $this; + } +} diff --git a/generated/Model/CreateThreadAndRunRequest.php b/generated/Model/CreateThreadAndRunRequest.php new file mode 100644 index 0000000..7540c69 --- /dev/null +++ b/generated/Model/CreateThreadAndRunRequest.php @@ -0,0 +1,186 @@ +|null + */ + protected $metadata = null; + + /** + * @param string $assistantId The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run. + * @param CreateThreadRequest $thread + * @param string|null $model The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used. + * @param string|null $instructions Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis. + * @param mixed[]|null $tools Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. + * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + */ + public function __construct($assistantId = null, $thread = null, $model = null, $instructions = null, $tools = null, $metadata = null) + { + if ($assistantId !== null) { + $this->setAssistantId($assistantId); + } + if ($thread !== null) { + $this->setThread($thread); + } + if ($model !== null) { + $this->setModel($model); + } + if ($instructions !== null) { + $this->setInstructions($instructions); + } + if ($tools !== null) { + $this->setTools($tools); + } + if ($metadata !== null) { + $this->setMetadata($metadata); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run. + */ + public function getAssistantId(): string + { + return $this->assistantId; + } + + /** + * The ID of the [assistant](/docs/api-reference/assistants) to use to execute this run. + */ + public function setAssistantId(string $assistantId): self + { + $this->initialized['assistantId'] = true; + $this->assistantId = $assistantId; + return $this; + } + + public function getThread(): CreateThreadRequest + { + return $this->thread; + } + + public function setThread(CreateThreadRequest $thread): self + { + $this->initialized['thread'] = true; + $this->thread = $thread; + return $this; + } + + /** + * The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used. + */ + public function getModel(): ?string + { + return $this->model; + } + + /** + * The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used. + */ + public function setModel(?string $model): self + { + $this->initialized['model'] = true; + $this->model = $model; + return $this; + } + + /** + * Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis. + */ + public function getInstructions(): ?string + { + return $this->instructions; + } + + /** + * Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis. + */ + public function setInstructions(?string $instructions): self + { + $this->initialized['instructions'] = true; + $this->instructions = $instructions; + return $this; + } + + /** + * Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. + * + * @return mixed[]|null + */ + public function getTools(): ?array + { + return $this->tools; + } + + /** + * Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. + * + * @param mixed[]|null $tools + */ + public function setTools(?array $tools): self + { + $this->initialized['tools'] = true; + $this->tools = $tools; + return $this; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @return array|null + */ + public function getMetadata(): ?iterable + { + return $this->metadata; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @param array|null $metadata + */ + public function setMetadata(?iterable $metadata): self + { + $this->initialized['metadata'] = true; + $this->metadata = $metadata; + return $this; + } +} diff --git a/generated/Model/CreateThreadRequest.php b/generated/Model/CreateThreadRequest.php new file mode 100644 index 0000000..28f8f19 --- /dev/null +++ b/generated/Model/CreateThreadRequest.php @@ -0,0 +1,87 @@ +|null + */ + protected $metadata = null; + + /** + * @param CreateMessageRequest[] $messages A list of [messages](/docs/api-reference/messages) to start the thread with. + * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + */ + public function __construct($messages = null, $metadata = null) + { + if ($messages !== null) { + $this->setMessages($messages); + } + if ($metadata !== null) { + $this->setMetadata($metadata); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * A list of [messages](/docs/api-reference/messages) to start the thread with. + * + * @return CreateMessageRequest[] + */ + public function getMessages(): array + { + return $this->messages; + } + + /** + * A list of [messages](/docs/api-reference/messages) to start the thread with. + * + * @param CreateMessageRequest[] $messages + */ + public function setMessages(array $messages): self + { + $this->initialized['messages'] = true; + $this->messages = $messages; + return $this; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @return array|null + */ + public function getMetadata(): ?iterable + { + return $this->metadata; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @param array|null $metadata + */ + public function setMetadata(?iterable $metadata): self + { + $this->initialized['metadata'] = true; + $this->metadata = $metadata; + return $this; + } +} diff --git a/generated/Model/CreateTranscriptionRequest.php b/generated/Model/CreateTranscriptionRequest.php index 5a22b58..86f1ead 100644 --- a/generated/Model/CreateTranscriptionRequest.php +++ b/generated/Model/CreateTranscriptionRequest.php @@ -9,14 +9,21 @@ class CreateTranscriptionRequest protected array $initialized = []; /** - * The audio file object (not file name) to transcribe, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm. + * The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. */ protected ?string $file = null; /** * ID of the model to use. Only `whisper-1` is currently available. + * + * @var mixed */ - protected ?string $model = null; + protected $model = null; + + /** + * The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will improve accuracy and latency. + */ + protected ?string $language = null; /** * An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should match the audio language. @@ -24,7 +31,7 @@ class CreateTranscriptionRequest protected ?string $prompt = null; /** - * The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt. + * The format of the transcript output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`. */ protected string $responseFormat = 'json'; @@ -36,19 +43,14 @@ class CreateTranscriptionRequest protected $temperature = 0; /** - * The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will improve accuracy and latency. - */ - protected ?string $language = null; - - /** - * @param string $file The audio file object (not file name) to transcribe, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm. - * @param string $model ID of the model to use. Only `whisper-1` is currently available. + * @param string $file The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. + * @param mixed $model ID of the model to use. Only `whisper-1` is currently available. + * @param string $language The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will improve accuracy and latency. * @param string $prompt An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should match the audio language. - * @param string $responseFormat The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt. + * @param string $responseFormat The format of the transcript output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`. * @param float $temperature The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit. - * @param string $language The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will improve accuracy and latency. */ - public function __construct($file = null, $model = null, $prompt = null, $responseFormat = 'json', $temperature = 0, $language = null) + public function __construct($file = null, mixed $model = null, $language = null, $prompt = null, $responseFormat = 'json', $temperature = 0) { if ($file !== null) { $this->setFile($file); @@ -56,6 +58,9 @@ public function __construct($file = null, $model = null, $prompt = null, $respon if ($model !== null) { $this->setModel($model); } + if ($language !== null) { + $this->setLanguage($language); + } if ($prompt !== null) { $this->setPrompt($prompt); } @@ -65,9 +70,6 @@ public function __construct($file = null, $model = null, $prompt = null, $respon if ($temperature !== null) { $this->setTemperature($temperature); } - if ($language !== null) { - $this->setLanguage($language); - } } public function isInitialized($property): bool @@ -76,7 +78,7 @@ public function isInitialized($property): bool } /** - * The audio file object (not file name) to transcribe, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm. + * The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. */ public function getFile(): string { @@ -84,7 +86,7 @@ public function getFile(): string } /** - * The audio file object (not file name) to transcribe, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm. + * The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. */ public function setFile(string $file): self { @@ -95,8 +97,10 @@ public function setFile(string $file): self /** * ID of the model to use. Only `whisper-1` is currently available. + * + * @return mixed */ - public function getModel(): string + public function getModel() { return $this->model; } @@ -104,13 +108,31 @@ public function getModel(): string /** * ID of the model to use. Only `whisper-1` is currently available. */ - public function setModel(string $model): self + public function setModel(mixed $model): self { $this->initialized['model'] = true; $this->model = $model; return $this; } + /** + * The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will improve accuracy and latency. + */ + public function getLanguage(): string + { + return $this->language; + } + + /** + * The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will improve accuracy and latency. + */ + public function setLanguage(string $language): self + { + $this->initialized['language'] = true; + $this->language = $language; + return $this; + } + /** * An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should match the audio language. */ @@ -130,7 +152,7 @@ public function setPrompt(string $prompt): self } /** - * The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt. + * The format of the transcript output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`. */ public function getResponseFormat(): string { @@ -138,7 +160,7 @@ public function getResponseFormat(): string } /** - * The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt. + * The format of the transcript output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`. */ public function setResponseFormat(string $responseFormat): self { @@ -164,22 +186,4 @@ public function setTemperature(float $temperature): self $this->temperature = $temperature; return $this; } - - /** - * The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will improve accuracy and latency. - */ - public function getLanguage(): string - { - return $this->language; - } - - /** - * The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will improve accuracy and latency. - */ - public function setLanguage(string $language): self - { - $this->initialized['language'] = true; - $this->language = $language; - return $this; - } } diff --git a/generated/Model/CreateTranslationRequest.php b/generated/Model/CreateTranslationRequest.php index f21e374..85f8e18 100644 --- a/generated/Model/CreateTranslationRequest.php +++ b/generated/Model/CreateTranslationRequest.php @@ -9,14 +9,16 @@ class CreateTranslationRequest protected array $initialized = []; /** - * The audio file object (not file name) translate, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm. + * The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. */ protected ?string $file = null; /** * ID of the model to use. Only `whisper-1` is currently available. + * + * @var mixed */ - protected ?string $model = null; + protected $model = null; /** * An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should be in English. @@ -24,7 +26,7 @@ class CreateTranslationRequest protected ?string $prompt = null; /** - * The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt. + * The format of the transcript output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`. */ protected string $responseFormat = 'json'; @@ -36,13 +38,13 @@ class CreateTranslationRequest protected $temperature = 0; /** - * @param string $file The audio file object (not file name) translate, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm. - * @param string $model ID of the model to use. Only `whisper-1` is currently available. + * @param string $file The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. + * @param mixed $model ID of the model to use. Only `whisper-1` is currently available. * @param string $prompt An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should be in English. - * @param string $responseFormat The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt. + * @param string $responseFormat The format of the transcript output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`. * @param float $temperature The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit. */ - public function __construct($file = null, $model = null, $prompt = null, $responseFormat = 'json', $temperature = 0) + public function __construct($file = null, mixed $model = null, $prompt = null, $responseFormat = 'json', $temperature = 0) { if ($file !== null) { $this->setFile($file); @@ -67,7 +69,7 @@ public function isInitialized($property): bool } /** - * The audio file object (not file name) translate, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm. + * The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. */ public function getFile(): string { @@ -75,7 +77,7 @@ public function getFile(): string } /** - * The audio file object (not file name) translate, in one of these formats: mp3, mp4, mpeg, mpga, m4a, wav, or webm. + * The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. */ public function setFile(string $file): self { @@ -86,8 +88,10 @@ public function setFile(string $file): self /** * ID of the model to use. Only `whisper-1` is currently available. + * + * @return mixed */ - public function getModel(): string + public function getModel() { return $this->model; } @@ -95,7 +99,7 @@ public function getModel(): string /** * ID of the model to use. Only `whisper-1` is currently available. */ - public function setModel(string $model): self + public function setModel(mixed $model): self { $this->initialized['model'] = true; $this->model = $model; @@ -121,7 +125,7 @@ public function setPrompt(string $prompt): self } /** - * The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt. + * The format of the transcript output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`. */ public function getResponseFormat(): string { @@ -129,7 +133,7 @@ public function getResponseFormat(): string } /** - * The format of the transcript output, in one of these options: json, text, srt, verbose_json, or vtt. + * The format of the transcript output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`. */ public function setResponseFormat(string $responseFormat): self { diff --git a/generated/Model/Engine.php b/generated/Model/DeleteAssistantFileResponse.php similarity index 56% rename from generated/Model/Engine.php rename to generated/Model/DeleteAssistantFileResponse.php index 9910337..c58b307 100644 --- a/generated/Model/Engine.php +++ b/generated/Model/DeleteAssistantFileResponse.php @@ -6,38 +6,32 @@ use ArrayObject; -class Engine extends ArrayObject +class DeleteAssistantFileResponse extends ArrayObject { protected array $initialized = []; protected ?string $id = null; - protected ?string $object = null; - - protected ?int $created = null; + protected ?bool $deleted = null; - protected ?bool $ready = null; + protected ?string $object = null; /** * @param string $id + * @param bool $deleted * @param string $object - * @param int|null $created - * @param bool $ready */ - public function __construct($id = null, $object = null, $created = null, $ready = null) + public function __construct($id = null, $deleted = null, $object = null) { if ($id !== null) { $this->setId($id); } + if ($deleted !== null) { + $this->setDeleted($deleted); + } if ($object !== null) { $this->setObject($object); } - if ($created !== null) { - $this->setCreated($created); - } - if ($ready !== null) { - $this->setReady($ready); - } } public function isInitialized($property): bool @@ -57,39 +51,27 @@ public function setId(string $id): self return $this; } - public function getObject(): string + public function getDeleted(): bool { - return $this->object; + return $this->deleted; } - public function setObject(string $object): self + public function setDeleted(bool $deleted): self { - $this->initialized['object'] = true; - $this->object = $object; + $this->initialized['deleted'] = true; + $this->deleted = $deleted; return $this; } - public function getCreated(): ?int - { - return $this->created; - } - - public function setCreated(?int $created): self - { - $this->initialized['created'] = true; - $this->created = $created; - return $this; - } - - public function getReady(): bool + public function getObject(): string { - return $this->ready; + return $this->object; } - public function setReady(bool $ready): self + public function setObject(string $object): self { - $this->initialized['ready'] = true; - $this->ready = $ready; + $this->initialized['object'] = true; + $this->object = $object; return $this; } } diff --git a/generated/Model/CreateSearchResponseDataItem.php b/generated/Model/DeleteAssistantResponse.php similarity index 50% rename from generated/Model/CreateSearchResponseDataItem.php rename to generated/Model/DeleteAssistantResponse.php index d1b99a5..04e868c 100644 --- a/generated/Model/CreateSearchResponseDataItem.php +++ b/generated/Model/DeleteAssistantResponse.php @@ -6,31 +6,31 @@ use ArrayObject; -class CreateSearchResponseDataItem extends ArrayObject +class DeleteAssistantResponse extends ArrayObject { protected array $initialized = []; - protected ?string $object = null; + protected ?string $id = null; - protected ?int $document = null; + protected ?bool $deleted = null; - protected ?float $score = null; + protected ?string $object = null; /** + * @param string $id + * @param bool $deleted * @param string $object - * @param int $document - * @param float $score */ - public function __construct($object = null, $document = null, $score = null) + public function __construct($id = null, $deleted = null, $object = null) { - if ($object !== null) { - $this->setObject($object); + if ($id !== null) { + $this->setId($id); } - if ($document !== null) { - $this->setDocument($document); + if ($deleted !== null) { + $this->setDeleted($deleted); } - if ($score !== null) { - $this->setScore($score); + if ($object !== null) { + $this->setObject($object); } } @@ -39,39 +39,39 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } - public function getObject(): string + public function getId(): string { - return $this->object; + return $this->id; } - public function setObject(string $object): self + public function setId(string $id): self { - $this->initialized['object'] = true; - $this->object = $object; + $this->initialized['id'] = true; + $this->id = $id; return $this; } - public function getDocument(): int + public function getDeleted(): bool { - return $this->document; + return $this->deleted; } - public function setDocument(int $document): self + public function setDeleted(bool $deleted): self { - $this->initialized['document'] = true; - $this->document = $document; + $this->initialized['deleted'] = true; + $this->deleted = $deleted; return $this; } - public function getScore(): float + public function getObject(): string { - return $this->score; + return $this->object; } - public function setScore(float $score): self + public function setObject(string $object): self { - $this->initialized['score'] = true; - $this->score = $score; + $this->initialized['object'] = true; + $this->object = $object; return $this; } } diff --git a/generated/Model/DeleteMessageResponse.php b/generated/Model/DeleteMessageResponse.php new file mode 100644 index 0000000..ecfe9d2 --- /dev/null +++ b/generated/Model/DeleteMessageResponse.php @@ -0,0 +1,77 @@ +setId($id); + } + if ($deleted !== null) { + $this->setDeleted($deleted); + } + if ($object !== null) { + $this->setObject($object); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + public function getId(): string + { + return $this->id; + } + + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + public function getDeleted(): bool + { + return $this->deleted; + } + + public function setDeleted(bool $deleted): self + { + $this->initialized['deleted'] = true; + $this->deleted = $deleted; + return $this; + } + + public function getObject(): string + { + return $this->object; + } + + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } +} diff --git a/generated/Model/DeleteModelResponse.php b/generated/Model/DeleteModelResponse.php index 27a8040..9da4c71 100644 --- a/generated/Model/DeleteModelResponse.php +++ b/generated/Model/DeleteModelResponse.php @@ -12,26 +12,26 @@ class DeleteModelResponse extends ArrayObject protected ?string $id = null; - protected ?string $object = null; - protected ?bool $deleted = null; + protected ?string $object = null; + /** * @param string $id - * @param string $object * @param bool $deleted + * @param string $object */ - public function __construct($id = null, $object = null, $deleted = null) + public function __construct($id = null, $deleted = null, $object = null) { if ($id !== null) { $this->setId($id); } - if ($object !== null) { - $this->setObject($object); - } if ($deleted !== null) { $this->setDeleted($deleted); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool @@ -51,27 +51,27 @@ public function setId(string $id): self return $this; } - public function getObject(): string + public function getDeleted(): bool { - return $this->object; + return $this->deleted; } - public function setObject(string $object): self + public function setDeleted(bool $deleted): self { - $this->initialized['object'] = true; - $this->object = $object; + $this->initialized['deleted'] = true; + $this->deleted = $deleted; return $this; } - public function getDeleted(): bool + public function getObject(): string { - return $this->deleted; + return $this->object; } - public function setDeleted(bool $deleted): self + public function setObject(string $object): self { - $this->initialized['deleted'] = true; - $this->deleted = $deleted; + $this->initialized['object'] = true; + $this->object = $object; return $this; } } diff --git a/generated/Model/DeleteThreadResponse.php b/generated/Model/DeleteThreadResponse.php new file mode 100644 index 0000000..d98316e --- /dev/null +++ b/generated/Model/DeleteThreadResponse.php @@ -0,0 +1,77 @@ +setId($id); + } + if ($deleted !== null) { + $this->setDeleted($deleted); + } + if ($object !== null) { + $this->setObject($object); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + public function getId(): string + { + return $this->id; + } + + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + public function getDeleted(): bool + { + return $this->deleted; + } + + public function setDeleted(bool $deleted): self + { + $this->initialized['deleted'] = true; + $this->deleted = $deleted; + return $this; + } + + public function getObject(): string + { + return $this->object; + } + + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } +} diff --git a/generated/Model/CreateEmbeddingResponseDataItem.php b/generated/Model/Embedding.php similarity index 51% rename from generated/Model/CreateEmbeddingResponseDataItem.php rename to generated/Model/Embedding.php index 2d7cb21..c95c94d 100644 --- a/generated/Model/CreateEmbeddingResponseDataItem.php +++ b/generated/Model/Embedding.php @@ -6,35 +6,43 @@ use ArrayObject; -class CreateEmbeddingResponseDataItem extends ArrayObject +class Embedding extends ArrayObject { protected array $initialized = []; + /** + * The index of the embedding in the list of embeddings. + */ protected ?int $index = null; - protected ?string $object = null; - /** - * @var float[]|null + * The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the [embedding guide](/docs/guides/embeddings). + * + * @var float[] */ protected ?array $embedding = null; /** - * @param int $index - * @param string $object - * @param float[] $embedding + * The object type, which is always "embedding". + */ + protected ?string $object = null; + + /** + * @param int $index The index of the embedding in the list of embeddings. + * @param float[] $embedding The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the [embedding guide](/docs/guides/embeddings). + * @param string $object The object type, which is always "embedding". */ - public function __construct($index = null, $object = null, $embedding = null) + public function __construct($index = null, $embedding = null, $object = null) { if ($index !== null) { $this->setIndex($index); } - if ($object !== null) { - $this->setObject($object); - } if ($embedding !== null) { $this->setEmbedding($embedding); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool @@ -42,11 +50,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } + /** + * The index of the embedding in the list of embeddings. + */ public function getIndex(): int { return $this->index; } + /** + * The index of the embedding in the list of embeddings. + */ public function setIndex(int $index): self { $this->initialized['index'] = true; @@ -54,19 +68,9 @@ public function setIndex(int $index): self return $this; } - public function getObject(): string - { - return $this->object; - } - - public function setObject(string $object): self - { - $this->initialized['object'] = true; - $this->object = $object; - return $this; - } - /** + * The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the [embedding guide](/docs/guides/embeddings). + * * @return float[] */ public function getEmbedding(): array @@ -75,6 +79,8 @@ public function getEmbedding(): array } /** + * The embedding vector, which is a list of floats. The length of vector depends on the model as listed in the [embedding guide](/docs/guides/embeddings). + * * @param float[] $embedding */ public function setEmbedding(array $embedding): self @@ -83,4 +89,22 @@ public function setEmbedding(array $embedding): self $this->embedding = $embedding; return $this; } + + /** + * The object type, which is always "embedding". + */ + public function getObject(): string + { + return $this->object; + } + + /** + * The object type, which is always "embedding". + */ + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } } diff --git a/generated/Model/Error.php b/generated/Model/Error.php index b74160f..ce78f34 100644 --- a/generated/Model/Error.php +++ b/generated/Model/Error.php @@ -10,24 +10,24 @@ class Error extends ArrayObject { protected array $initialized = []; - protected ?string $type = null; + protected ?string $code = null; protected ?string $message = null; protected ?string $param = null; - protected ?string $code = null; + protected ?string $type = null; /** - * @param string $type + * @param string|null $code * @param string $message * @param string|null $param - * @param string|null $code + * @param string $type */ - public function __construct($type = null, $message = null, $param = null, $code = null) + public function __construct($code = null, $message = null, $param = null, $type = null) { - if ($type !== null) { - $this->setType($type); + if ($code !== null) { + $this->setCode($code); } if ($message !== null) { $this->setMessage($message); @@ -35,8 +35,8 @@ public function __construct($type = null, $message = null, $param = null, $code if ($param !== null) { $this->setParam($param); } - if ($code !== null) { - $this->setCode($code); + if ($type !== null) { + $this->setType($type); } } @@ -45,15 +45,15 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } - public function getType(): string + public function getCode(): ?string { - return $this->type; + return $this->code; } - public function setType(string $type): self + public function setCode(?string $code): self { - $this->initialized['type'] = true; - $this->type = $type; + $this->initialized['code'] = true; + $this->code = $code; return $this; } @@ -81,15 +81,15 @@ public function setParam(?string $param): self return $this; } - public function getCode(): ?string + public function getType(): string { - return $this->code; + return $this->type; } - public function setCode(?string $code): self + public function setType(string $type): self { - $this->initialized['code'] = true; - $this->code = $code; + $this->initialized['type'] = true; + $this->type = $type; return $this; } } diff --git a/generated/Model/FineTune.php b/generated/Model/FineTune.php index f4f0e2a..7f54963 100644 --- a/generated/Model/FineTune.php +++ b/generated/Model/FineTune.php @@ -6,107 +6,142 @@ use ArrayObject; +/** + * @deprecated + */ class FineTune extends ArrayObject { protected array $initialized = []; + /** + * The object identifier, which can be referenced in the API endpoints. + */ protected ?string $id = null; - protected ?string $object = null; - + /** + * The Unix timestamp (in seconds) for when the fine-tuning job was created. + */ protected ?int $createdAt = null; - protected ?int $updatedAt = null; + /** + * The list of events that have been observed in the lifecycle of the FineTune job. + * + * @var FineTuneEvent[] + */ + protected ?array $events = null; + + /** + * The name of the fine-tuned model that is being created. + */ + protected ?string $fineTunedModel = null; + /** + * The hyperparameters used for the fine-tuning job. See the [fine-tuning guide](/docs/guides/legacy-fine-tuning/hyperparameters) for more details. + */ + protected ?FineTuneHyperparams $hyperparams = null; + + /** + * The base model that is being fine-tuned. + */ protected ?string $model = null; - protected ?string $fineTunedModel = null; + /** + * The object type, which is always "fine-tune". + */ + protected ?string $object = null; + /** + * The organization that owns the fine-tuning job. + */ protected ?string $organizationId = null; - protected ?string $status = null; - /** - * @var mixed[]|null + * The compiled results files for the fine-tuning job. + * + * @var OpenAIFile[] */ - protected ?iterable $hyperparams = null; + protected ?array $resultFiles = null; /** - * @var OpenAIFile[]|null + * The current status of the fine-tuning job, which can be either `created`, `running`, `succeeded`, `failed`, or `cancelled`. */ - protected ?array $trainingFiles = null; + protected ?string $status = null; /** - * @var OpenAIFile[]|null + * The list of files used for training. + * + * @var OpenAIFile[] */ - protected ?array $validationFiles = null; + protected ?array $trainingFiles = null; /** - * @var OpenAIFile[]|null + * The Unix timestamp (in seconds) for when the fine-tuning job was last updated. */ - protected ?array $resultFiles = null; + protected ?int $updatedAt = null; /** - * @var FineTuneEvent[]|null + * The list of files used for validation. + * + * @var OpenAIFile[] */ - protected ?array $events = null; + protected ?array $validationFiles = null; /** - * @param string $id - * @param string $object - * @param int $createdAt - * @param int $updatedAt - * @param string $model - * @param string|null $fineTunedModel - * @param string $organizationId - * @param string $status - * @param mixed[] $hyperparams - * @param OpenAIFile[] $trainingFiles - * @param OpenAIFile[] $validationFiles - * @param OpenAIFile[] $resultFiles - * @param FineTuneEvent[] $events + * @param string $id The object identifier, which can be referenced in the API endpoints. + * @param int $createdAt The Unix timestamp (in seconds) for when the fine-tuning job was created. + * @param FineTuneEvent[] $events The list of events that have been observed in the lifecycle of the FineTune job. + * @param string|null $fineTunedModel The name of the fine-tuned model that is being created. + * @param FineTuneHyperparams $hyperparams The hyperparameters used for the fine-tuning job. See the [fine-tuning guide](/docs/guides/legacy-fine-tuning/hyperparameters) for more details. + * @param string $model The base model that is being fine-tuned. + * @param string $object The object type, which is always "fine-tune". + * @param string $organizationId The organization that owns the fine-tuning job. + * @param OpenAIFile[] $resultFiles The compiled results files for the fine-tuning job. + * @param string $status The current status of the fine-tuning job, which can be either `created`, `running`, `succeeded`, `failed`, or `cancelled`. + * @param OpenAIFile[] $trainingFiles The list of files used for training. + * @param int $updatedAt The Unix timestamp (in seconds) for when the fine-tuning job was last updated. + * @param OpenAIFile[] $validationFiles The list of files used for validation. */ - public function __construct($id = null, $object = null, $createdAt = null, $updatedAt = null, $model = null, $fineTunedModel = null, $organizationId = null, $status = null, $hyperparams = null, $trainingFiles = null, $validationFiles = null, $resultFiles = null, $events = null) + public function __construct($id = null, $createdAt = null, $events = null, $fineTunedModel = null, $hyperparams = null, $model = null, $object = null, $organizationId = null, $resultFiles = null, $status = null, $trainingFiles = null, $updatedAt = null, $validationFiles = null) { if ($id !== null) { $this->setId($id); } - if ($object !== null) { - $this->setObject($object); - } if ($createdAt !== null) { $this->setCreatedAt($createdAt); } - if ($updatedAt !== null) { - $this->setUpdatedAt($updatedAt); + if ($events !== null) { + $this->setEvents($events); + } + if ($fineTunedModel !== null) { + $this->setFineTunedModel($fineTunedModel); + } + if ($hyperparams !== null) { + $this->setHyperparams($hyperparams); } if ($model !== null) { $this->setModel($model); } - if ($fineTunedModel !== null) { - $this->setFineTunedModel($fineTunedModel); + if ($object !== null) { + $this->setObject($object); } if ($organizationId !== null) { $this->setOrganizationId($organizationId); } + if ($resultFiles !== null) { + $this->setResultFiles($resultFiles); + } if ($status !== null) { $this->setStatus($status); } - if ($hyperparams !== null) { - $this->setHyperparams($hyperparams); - } if ($trainingFiles !== null) { $this->setTrainingFiles($trainingFiles); } + if ($updatedAt !== null) { + $this->setUpdatedAt($updatedAt); + } if ($validationFiles !== null) { $this->setValidationFiles($validationFiles); } - if ($resultFiles !== null) { - $this->setResultFiles($resultFiles); - } - if ($events !== null) { - $this->setEvents($events); - } } public function isInitialized($property): bool @@ -114,11 +149,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } + /** + * The object identifier, which can be referenced in the API endpoints. + */ public function getId(): string { return $this->id; } + /** + * The object identifier, which can be referenced in the API endpoints. + */ public function setId(string $id): self { $this->initialized['id'] = true; @@ -126,47 +167,93 @@ public function setId(string $id): self return $this; } - public function getObject(): string + /** + * The Unix timestamp (in seconds) for when the fine-tuning job was created. + */ + public function getCreatedAt(): int { - return $this->object; + return $this->createdAt; } - public function setObject(string $object): self + /** + * The Unix timestamp (in seconds) for when the fine-tuning job was created. + */ + public function setCreatedAt(int $createdAt): self { - $this->initialized['object'] = true; - $this->object = $object; + $this->initialized['createdAt'] = true; + $this->createdAt = $createdAt; return $this; } - public function getCreatedAt(): int + /** + * The list of events that have been observed in the lifecycle of the FineTune job. + * + * @return FineTuneEvent[] + */ + public function getEvents(): array { - return $this->createdAt; + return $this->events; } - public function setCreatedAt(int $createdAt): self + /** + * The list of events that have been observed in the lifecycle of the FineTune job. + * + * @param FineTuneEvent[] $events + */ + public function setEvents(array $events): self { - $this->initialized['createdAt'] = true; - $this->createdAt = $createdAt; + $this->initialized['events'] = true; + $this->events = $events; return $this; } - public function getUpdatedAt(): int + /** + * The name of the fine-tuned model that is being created. + */ + public function getFineTunedModel(): ?string { - return $this->updatedAt; + return $this->fineTunedModel; } - public function setUpdatedAt(int $updatedAt): self + /** + * The name of the fine-tuned model that is being created. + */ + public function setFineTunedModel(?string $fineTunedModel): self { - $this->initialized['updatedAt'] = true; - $this->updatedAt = $updatedAt; + $this->initialized['fineTunedModel'] = true; + $this->fineTunedModel = $fineTunedModel; + return $this; + } + + /** + * The hyperparameters used for the fine-tuning job. See the [fine-tuning guide](/docs/guides/legacy-fine-tuning/hyperparameters) for more details. + */ + public function getHyperparams(): FineTuneHyperparams + { + return $this->hyperparams; + } + + /** + * The hyperparameters used for the fine-tuning job. See the [fine-tuning guide](/docs/guides/legacy-fine-tuning/hyperparameters) for more details. + */ + public function setHyperparams(FineTuneHyperparams $hyperparams): self + { + $this->initialized['hyperparams'] = true; + $this->hyperparams = $hyperparams; return $this; } + /** + * The base model that is being fine-tuned. + */ public function getModel(): string { return $this->model; } + /** + * The base model that is being fine-tuned. + */ public function setModel(string $model): self { $this->initialized['model'] = true; @@ -174,23 +261,35 @@ public function setModel(string $model): self return $this; } - public function getFineTunedModel(): ?string + /** + * The object type, which is always "fine-tune". + */ + public function getObject(): string { - return $this->fineTunedModel; + return $this->object; } - public function setFineTunedModel(?string $fineTunedModel): self + /** + * The object type, which is always "fine-tune". + */ + public function setObject(string $object): self { - $this->initialized['fineTunedModel'] = true; - $this->fineTunedModel = $fineTunedModel; + $this->initialized['object'] = true; + $this->object = $object; return $this; } + /** + * The organization that owns the fine-tuning job. + */ public function getOrganizationId(): string { return $this->organizationId; } + /** + * The organization that owns the fine-tuning job. + */ public function setOrganizationId(string $organizationId): self { $this->initialized['organizationId'] = true; @@ -198,37 +297,49 @@ public function setOrganizationId(string $organizationId): self return $this; } - public function getStatus(): string + /** + * The compiled results files for the fine-tuning job. + * + * @return OpenAIFile[] + */ + public function getResultFiles(): array { - return $this->status; + return $this->resultFiles; } - public function setStatus(string $status): self + /** + * The compiled results files for the fine-tuning job. + * + * @param OpenAIFile[] $resultFiles + */ + public function setResultFiles(array $resultFiles): self { - $this->initialized['status'] = true; - $this->status = $status; + $this->initialized['resultFiles'] = true; + $this->resultFiles = $resultFiles; return $this; } /** - * @return mixed[] + * The current status of the fine-tuning job, which can be either `created`, `running`, `succeeded`, `failed`, or `cancelled`. */ - public function getHyperparams(): iterable + public function getStatus(): string { - return $this->hyperparams; + return $this->status; } /** - * @param mixed[] $hyperparams + * The current status of the fine-tuning job, which can be either `created`, `running`, `succeeded`, `failed`, or `cancelled`. */ - public function setHyperparams(iterable $hyperparams): self + public function setStatus(string $status): self { - $this->initialized['hyperparams'] = true; - $this->hyperparams = $hyperparams; + $this->initialized['status'] = true; + $this->status = $status; return $this; } /** + * The list of files used for training. + * * @return OpenAIFile[] */ public function getTrainingFiles(): array @@ -237,6 +348,8 @@ public function getTrainingFiles(): array } /** + * The list of files used for training. + * * @param OpenAIFile[] $trainingFiles */ public function setTrainingFiles(array $trainingFiles): self @@ -247,56 +360,42 @@ public function setTrainingFiles(array $trainingFiles): self } /** - * @return OpenAIFile[] + * The Unix timestamp (in seconds) for when the fine-tuning job was last updated. */ - public function getValidationFiles(): array + public function getUpdatedAt(): int { - return $this->validationFiles; + return $this->updatedAt; } /** - * @param OpenAIFile[] $validationFiles + * The Unix timestamp (in seconds) for when the fine-tuning job was last updated. */ - public function setValidationFiles(array $validationFiles): self + public function setUpdatedAt(int $updatedAt): self { - $this->initialized['validationFiles'] = true; - $this->validationFiles = $validationFiles; + $this->initialized['updatedAt'] = true; + $this->updatedAt = $updatedAt; return $this; } /** + * The list of files used for validation. + * * @return OpenAIFile[] */ - public function getResultFiles(): array - { - return $this->resultFiles; - } - - /** - * @param OpenAIFile[] $resultFiles - */ - public function setResultFiles(array $resultFiles): self - { - $this->initialized['resultFiles'] = true; - $this->resultFiles = $resultFiles; - return $this; - } - - /** - * @return FineTuneEvent[] - */ - public function getEvents(): array + public function getValidationFiles(): array { - return $this->events; + return $this->validationFiles; } /** - * @param FineTuneEvent[] $events + * The list of files used for validation. + * + * @param OpenAIFile[] $validationFiles */ - public function setEvents(array $events): self + public function setValidationFiles(array $validationFiles): self { - $this->initialized['events'] = true; - $this->events = $events; + $this->initialized['validationFiles'] = true; + $this->validationFiles = $validationFiles; return $this; } } diff --git a/generated/Model/FineTuneEvent.php b/generated/Model/FineTuneEvent.php index 1bce06e..a832945 100644 --- a/generated/Model/FineTuneEvent.php +++ b/generated/Model/FineTuneEvent.php @@ -6,29 +6,29 @@ use ArrayObject; +/** + * @deprecated + */ class FineTuneEvent extends ArrayObject { protected array $initialized = []; - protected ?string $object = null; - protected ?int $createdAt = null; protected ?string $level = null; protected ?string $message = null; + protected ?string $object = null; + /** - * @param string $object * @param int $createdAt * @param string $level * @param string $message + * @param string $object */ - public function __construct($object = null, $createdAt = null, $level = null, $message = null) + public function __construct($createdAt = null, $level = null, $message = null, $object = null) { - if ($object !== null) { - $this->setObject($object); - } if ($createdAt !== null) { $this->setCreatedAt($createdAt); } @@ -38,6 +38,9 @@ public function __construct($object = null, $createdAt = null, $level = null, $m if ($message !== null) { $this->setMessage($message); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool @@ -45,18 +48,6 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } - public function getObject(): string - { - return $this->object; - } - - public function setObject(string $object): self - { - $this->initialized['object'] = true; - $this->object = $object; - return $this; - } - public function getCreatedAt(): int { return $this->createdAt; @@ -92,4 +83,16 @@ public function setMessage(string $message): self $this->message = $message; return $this; } + + public function getObject(): string + { + return $this->object; + } + + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } } diff --git a/generated/Model/FineTuneHyperparams.php b/generated/Model/FineTuneHyperparams.php new file mode 100644 index 0000000..1d8b25c --- /dev/null +++ b/generated/Model/FineTuneHyperparams.php @@ -0,0 +1,220 @@ +setBatchSize($batchSize); + } + if ($classificationNClasses !== null) { + $this->setClassificationNClasses($classificationNClasses); + } + if ($classificationPositiveClass !== null) { + $this->setClassificationPositiveClass($classificationPositiveClass); + } + if ($computeClassificationMetrics !== null) { + $this->setComputeClassificationMetrics($computeClassificationMetrics); + } + if ($learningRateMultiplier !== null) { + $this->setLearningRateMultiplier($learningRateMultiplier); + } + if ($nEpochs !== null) { + $this->setNEpochs($nEpochs); + } + if ($promptLossWeight !== null) { + $this->setPromptLossWeight($promptLossWeight); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The batch size to use for training. The batch size is the number of + training examples used to train a single forward and backward pass. + */ + public function getBatchSize(): int + { + return $this->batchSize; + } + + /** + * The batch size to use for training. The batch size is the number of + training examples used to train a single forward and backward pass. + */ + public function setBatchSize(int $batchSize): self + { + $this->initialized['batchSize'] = true; + $this->batchSize = $batchSize; + return $this; + } + + /** + * The number of classes to use for computing classification metrics. + */ + public function getClassificationNClasses(): int + { + return $this->classificationNClasses; + } + + /** + * The number of classes to use for computing classification metrics. + */ + public function setClassificationNClasses(int $classificationNClasses): self + { + $this->initialized['classificationNClasses'] = true; + $this->classificationNClasses = $classificationNClasses; + return $this; + } + + /** + * The positive class to use for computing classification metrics. + */ + public function getClassificationPositiveClass(): string + { + return $this->classificationPositiveClass; + } + + /** + * The positive class to use for computing classification metrics. + */ + public function setClassificationPositiveClass(string $classificationPositiveClass): self + { + $this->initialized['classificationPositiveClass'] = true; + $this->classificationPositiveClass = $classificationPositiveClass; + return $this; + } + + /** + * The classification metrics to compute using the validation dataset at the end of every epoch. + */ + public function getComputeClassificationMetrics(): bool + { + return $this->computeClassificationMetrics; + } + + /** + * The classification metrics to compute using the validation dataset at the end of every epoch. + */ + public function setComputeClassificationMetrics(bool $computeClassificationMetrics): self + { + $this->initialized['computeClassificationMetrics'] = true; + $this->computeClassificationMetrics = $computeClassificationMetrics; + return $this; + } + + /** + * The learning rate multiplier to use for training. + */ + public function getLearningRateMultiplier(): float + { + return $this->learningRateMultiplier; + } + + /** + * The learning rate multiplier to use for training. + */ + public function setLearningRateMultiplier(float $learningRateMultiplier): self + { + $this->initialized['learningRateMultiplier'] = true; + $this->learningRateMultiplier = $learningRateMultiplier; + return $this; + } + + /** + * The number of epochs to train the model for. An epoch refers to one + full cycle through the training dataset. + */ + public function getNEpochs(): int + { + return $this->nEpochs; + } + + /** + * The number of epochs to train the model for. An epoch refers to one + full cycle through the training dataset. + */ + public function setNEpochs(int $nEpochs): self + { + $this->initialized['nEpochs'] = true; + $this->nEpochs = $nEpochs; + return $this; + } + + /** + * The weight to use for loss on the prompt tokens. + */ + public function getPromptLossWeight(): float + { + return $this->promptLossWeight; + } + + /** + * The weight to use for loss on the prompt tokens. + */ + public function setPromptLossWeight(float $promptLossWeight): self + { + $this->initialized['promptLossWeight'] = true; + $this->promptLossWeight = $promptLossWeight; + return $this; + } +} diff --git a/generated/Model/FineTuningJob.php b/generated/Model/FineTuningJob.php new file mode 100644 index 0000000..6437cb2 --- /dev/null +++ b/generated/Model/FineTuningJob.php @@ -0,0 +1,407 @@ +setId($id); + } + if ($createdAt !== null) { + $this->setCreatedAt($createdAt); + } + if ($error !== null) { + $this->setError($error); + } + if ($fineTunedModel !== null) { + $this->setFineTunedModel($fineTunedModel); + } + if ($finishedAt !== null) { + $this->setFinishedAt($finishedAt); + } + if ($hyperparameters !== null) { + $this->setHyperparameters($hyperparameters); + } + if ($model !== null) { + $this->setModel($model); + } + if ($object !== null) { + $this->setObject($object); + } + if ($organizationId !== null) { + $this->setOrganizationId($organizationId); + } + if ($resultFiles !== null) { + $this->setResultFiles($resultFiles); + } + if ($status !== null) { + $this->setStatus($status); + } + if ($trainedTokens !== null) { + $this->setTrainedTokens($trainedTokens); + } + if ($trainingFile !== null) { + $this->setTrainingFile($trainingFile); + } + if ($validationFile !== null) { + $this->setValidationFile($validationFile); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The object identifier, which can be referenced in the API endpoints. + */ + public function getId(): string + { + return $this->id; + } + + /** + * The object identifier, which can be referenced in the API endpoints. + */ + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + /** + * The Unix timestamp (in seconds) for when the fine-tuning job was created. + */ + public function getCreatedAt(): int + { + return $this->createdAt; + } + + /** + * The Unix timestamp (in seconds) for when the fine-tuning job was created. + */ + public function setCreatedAt(int $createdAt): self + { + $this->initialized['createdAt'] = true; + $this->createdAt = $createdAt; + return $this; + } + + /** + * For fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure. + */ + public function getError(): ?FineTuningJobError + { + return $this->error; + } + + /** + * For fine-tuning jobs that have `failed`, this will contain more information on the cause of the failure. + */ + public function setError(?FineTuningJobError $error): self + { + $this->initialized['error'] = true; + $this->error = $error; + return $this; + } + + /** + * The name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running. + */ + public function getFineTunedModel(): ?string + { + return $this->fineTunedModel; + } + + /** + * The name of the fine-tuned model that is being created. The value will be null if the fine-tuning job is still running. + */ + public function setFineTunedModel(?string $fineTunedModel): self + { + $this->initialized['fineTunedModel'] = true; + $this->fineTunedModel = $fineTunedModel; + return $this; + } + + /** + * The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running. + */ + public function getFinishedAt(): ?int + { + return $this->finishedAt; + } + + /** + * The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running. + */ + public function setFinishedAt(?int $finishedAt): self + { + $this->initialized['finishedAt'] = true; + $this->finishedAt = $finishedAt; + return $this; + } + + /** + * The hyperparameters used for the fine-tuning job. See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. + */ + public function getHyperparameters(): FineTuningJobHyperparameters + { + return $this->hyperparameters; + } + + /** + * The hyperparameters used for the fine-tuning job. See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. + */ + public function setHyperparameters(FineTuningJobHyperparameters $hyperparameters): self + { + $this->initialized['hyperparameters'] = true; + $this->hyperparameters = $hyperparameters; + return $this; + } + + /** + * The base model that is being fine-tuned. + */ + public function getModel(): string + { + return $this->model; + } + + /** + * The base model that is being fine-tuned. + */ + public function setModel(string $model): self + { + $this->initialized['model'] = true; + $this->model = $model; + return $this; + } + + /** + * The object type, which is always "fine_tuning.job". + */ + public function getObject(): string + { + return $this->object; + } + + /** + * The object type, which is always "fine_tuning.job". + */ + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * The organization that owns the fine-tuning job. + */ + public function getOrganizationId(): string + { + return $this->organizationId; + } + + /** + * The organization that owns the fine-tuning job. + */ + public function setOrganizationId(string $organizationId): self + { + $this->initialized['organizationId'] = true; + $this->organizationId = $organizationId; + return $this; + } + + /** + * The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](/docs/api-reference/files/retrieve-contents). + * + * @return string[] + */ + public function getResultFiles(): array + { + return $this->resultFiles; + } + + /** + * The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](/docs/api-reference/files/retrieve-contents). + * + * @param string[] $resultFiles + */ + public function setResultFiles(array $resultFiles): self + { + $this->initialized['resultFiles'] = true; + $this->resultFiles = $resultFiles; + return $this; + } + + /** + * The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`. + */ + public function getStatus(): string + { + return $this->status; + } + + /** + * The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`. + */ + public function setStatus(string $status): self + { + $this->initialized['status'] = true; + $this->status = $status; + return $this; + } + + /** + * The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running. + */ + public function getTrainedTokens(): ?int + { + return $this->trainedTokens; + } + + /** + * The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running. + */ + public function setTrainedTokens(?int $trainedTokens): self + { + $this->initialized['trainedTokens'] = true; + $this->trainedTokens = $trainedTokens; + return $this; + } + + /** + * The file ID used for training. You can retrieve the training data with the [Files API](/docs/api-reference/files/retrieve-contents). + */ + public function getTrainingFile(): string + { + return $this->trainingFile; + } + + /** + * The file ID used for training. You can retrieve the training data with the [Files API](/docs/api-reference/files/retrieve-contents). + */ + public function setTrainingFile(string $trainingFile): self + { + $this->initialized['trainingFile'] = true; + $this->trainingFile = $trainingFile; + return $this; + } + + /** + * The file ID used for validation. You can retrieve the validation results with the [Files API](/docs/api-reference/files/retrieve-contents). + */ + public function getValidationFile(): ?string + { + return $this->validationFile; + } + + /** + * The file ID used for validation. You can retrieve the validation results with the [Files API](/docs/api-reference/files/retrieve-contents). + */ + public function setValidationFile(?string $validationFile): self + { + $this->initialized['validationFile'] = true; + $this->validationFile = $validationFile; + return $this; + } +} diff --git a/generated/Model/FineTuningJobError.php b/generated/Model/FineTuningJobError.php new file mode 100644 index 0000000..2046b0a --- /dev/null +++ b/generated/Model/FineTuningJobError.php @@ -0,0 +1,104 @@ +setCode($code); + } + if ($message !== null) { + $this->setMessage($message); + } + if ($param !== null) { + $this->setParam($param); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * A machine-readable error code. + */ + public function getCode(): string + { + return $this->code; + } + + /** + * A machine-readable error code. + */ + public function setCode(string $code): self + { + $this->initialized['code'] = true; + $this->code = $code; + return $this; + } + + /** + * A human-readable error message. + */ + public function getMessage(): string + { + return $this->message; + } + + /** + * A human-readable error message. + */ + public function setMessage(string $message): self + { + $this->initialized['message'] = true; + $this->message = $message; + return $this; + } + + /** + * The parameter that was invalid, usually `training_file` or `validation_file`. This field will be null if the failure was not parameter-specific. + */ + public function getParam(): ?string + { + return $this->param; + } + + /** + * The parameter that was invalid, usually `training_file` or `validation_file`. This field will be null if the failure was not parameter-specific. + */ + public function setParam(?string $param): self + { + $this->initialized['param'] = true; + $this->param = $param; + return $this; + } +} diff --git a/generated/Model/FineTuningJobEvent.php b/generated/Model/FineTuningJobEvent.php new file mode 100644 index 0000000..7915fb3 --- /dev/null +++ b/generated/Model/FineTuningJobEvent.php @@ -0,0 +1,113 @@ +setId($id); + } + if ($createdAt !== null) { + $this->setCreatedAt($createdAt); + } + if ($level !== null) { + $this->setLevel($level); + } + if ($message !== null) { + $this->setMessage($message); + } + if ($object !== null) { + $this->setObject($object); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + public function getId(): string + { + return $this->id; + } + + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + public function getCreatedAt(): int + { + return $this->createdAt; + } + + public function setCreatedAt(int $createdAt): self + { + $this->initialized['createdAt'] = true; + $this->createdAt = $createdAt; + return $this; + } + + public function getLevel(): string + { + return $this->level; + } + + public function setLevel(string $level): self + { + $this->initialized['level'] = true; + $this->level = $level; + return $this; + } + + public function getMessage(): string + { + return $this->message; + } + + public function setMessage(string $message): self + { + $this->initialized['message'] = true; + $this->message = $message; + return $this; + } + + public function getObject(): string + { + return $this->object; + } + + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } +} diff --git a/generated/Model/FineTuningJobHyperparameters.php b/generated/Model/FineTuningJobHyperparameters.php new file mode 100644 index 0000000..e1aee66 --- /dev/null +++ b/generated/Model/FineTuningJobHyperparameters.php @@ -0,0 +1,56 @@ +setNEpochs($nEpochs); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. + * + * @return mixed + */ + public function getNEpochs(): string + { + return $this->nEpochs; + } + + /** + * The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. + "auto" decides the optimal number of epochs based on the size of the dataset. If setting the number manually, we support any number between 1 and 50 epochs. + */ + public function setNEpochs(mixed $nEpochs): self + { + $this->initialized['nEpochs'] = true; + $this->nEpochs = $nEpochs; + return $this; + } +} diff --git a/generated/Model/FunctionObject.php b/generated/Model/FunctionObject.php new file mode 100644 index 0000000..a282b54 --- /dev/null +++ b/generated/Model/FunctionObject.php @@ -0,0 +1,114 @@ + + */ + protected ?iterable $parameters = null; + + /** + * @param string $description A description of what the function does, used by the model to choose when and how to call the function. + * @param string $name The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + * @param array $parameters The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/text-generation/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + * Omitting `parameters` defines a function with an empty parameter list. + */ + public function __construct($description = null, $name = null, $parameters = null) + { + if ($description !== null) { + $this->setDescription($description); + } + if ($name !== null) { + $this->setName($name); + } + if ($parameters !== null) { + $this->setParameters($parameters); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * A description of what the function does, used by the model to choose when and how to call the function. + */ + public function getDescription(): string + { + return $this->description; + } + + /** + * A description of what the function does, used by the model to choose when and how to call the function. + */ + public function setDescription(string $description): self + { + $this->initialized['description'] = true; + $this->description = $description; + return $this; + } + + /** + * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + */ + public function getName(): string + { + return $this->name; + } + + /** + * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64. + */ + public function setName(string $name): self + { + $this->initialized['name'] = true; + $this->name = $name; + return $this; + } + + /** + * The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/text-generation/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + * + * @return array + */ + public function getParameters(): iterable + { + return $this->parameters; + } + + /** + * The parameters the functions accepts, described as a JSON Schema object. See the [guide](/docs/guides/text-generation/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for documentation about the format. + + * + * @param array $parameters + */ + public function setParameters(iterable $parameters): self + { + $this->initialized['parameters'] = true; + $this->parameters = $parameters; + return $this; + } +} diff --git a/generated/Model/Image.php b/generated/Model/Image.php new file mode 100644 index 0000000..df729e6 --- /dev/null +++ b/generated/Model/Image.php @@ -0,0 +1,104 @@ +setB64Json($b64Json); + } + if ($url !== null) { + $this->setUrl($url); + } + if ($revisedPrompt !== null) { + $this->setRevisedPrompt($revisedPrompt); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The base64-encoded JSON of the generated image, if `response_format` is `b64_json`. + */ + public function getB64Json(): string + { + return $this->b64Json; + } + + /** + * The base64-encoded JSON of the generated image, if `response_format` is `b64_json`. + */ + public function setB64Json(string $b64Json): self + { + $this->initialized['b64Json'] = true; + $this->b64Json = $b64Json; + return $this; + } + + /** + * The URL of the generated image, if `response_format` is `url` (default). + */ + public function getUrl(): string + { + return $this->url; + } + + /** + * The URL of the generated image, if `response_format` is `url` (default). + */ + public function setUrl(string $url): self + { + $this->initialized['url'] = true; + $this->url = $url; + return $this; + } + + /** + * The prompt that was used to generate the image, if there was any revision to the prompt. + */ + public function getRevisedPrompt(): string + { + return $this->revisedPrompt; + } + + /** + * The prompt that was used to generate the image, if there was any revision to the prompt. + */ + public function setRevisedPrompt(string $revisedPrompt): self + { + $this->initialized['revisedPrompt'] = true; + $this->revisedPrompt = $revisedPrompt; + return $this; + } +} diff --git a/generated/Model/ImagesResponse.php b/generated/Model/ImagesResponse.php index 3112151..023574b 100644 --- a/generated/Model/ImagesResponse.php +++ b/generated/Model/ImagesResponse.php @@ -13,13 +13,13 @@ class ImagesResponse extends ArrayObject protected ?int $created = null; /** - * @var ImagesResponseDataItem[]|null + * @var Image[] */ protected ?array $data = null; /** * @param int $created - * @param ImagesResponseDataItem[] $data + * @param Image[] $data */ public function __construct($created = null, $data = null) { @@ -49,7 +49,7 @@ public function setCreated(int $created): self } /** - * @return ImagesResponseDataItem[] + * @return Image[] */ public function getData(): array { @@ -57,7 +57,7 @@ public function getData(): array } /** - * @param ImagesResponseDataItem[] $data + * @param Image[] $data */ public function setData(array $data): self { diff --git a/generated/Model/ImagesResponseDataItem.php b/generated/Model/ImagesResponseDataItem.php deleted file mode 100644 index 52268bc..0000000 --- a/generated/Model/ImagesResponseDataItem.php +++ /dev/null @@ -1,59 +0,0 @@ -setUrl($url); - } - if ($b64Json !== null) { - $this->setB64Json($b64Json); - } - } - - public function isInitialized($property): bool - { - return array_key_exists($property, $this->initialized); - } - - public function getUrl(): string - { - return $this->url; - } - - public function setUrl(string $url): self - { - $this->initialized['url'] = true; - $this->url = $url; - return $this; - } - - public function getB64Json(): string - { - return $this->b64Json; - } - - public function setB64Json(string $b64Json): self - { - $this->initialized['b64Json'] = true; - $this->b64Json = $b64Json; - return $this; - } -} diff --git a/generated/Model/ListAssistantFilesResponse.php b/generated/Model/ListAssistantFilesResponse.php new file mode 100644 index 0000000..39df7ab --- /dev/null +++ b/generated/Model/ListAssistantFilesResponse.php @@ -0,0 +1,122 @@ +setObject($object); + } + if ($data !== null) { + $this->setData($data); + } + if ($firstId !== null) { + $this->setFirstId($firstId); + } + if ($lastId !== null) { + $this->setLastId($lastId); + } + if ($hasMore !== null) { + $this->setHasMore($hasMore); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + public function getObject(): string + { + return $this->object; + } + + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * @return AssistantFileObject[] + */ + public function getData(): array + { + return $this->data; + } + + /** + * @param AssistantFileObject[] $data + */ + public function setData(array $data): self + { + $this->initialized['data'] = true; + $this->data = $data; + return $this; + } + + public function getFirstId(): string + { + return $this->firstId; + } + + public function setFirstId(string $firstId): self + { + $this->initialized['firstId'] = true; + $this->firstId = $firstId; + return $this; + } + + public function getLastId(): string + { + return $this->lastId; + } + + public function setLastId(string $lastId): self + { + $this->initialized['lastId'] = true; + $this->lastId = $lastId; + return $this; + } + + public function getHasMore(): bool + { + return $this->hasMore; + } + + public function setHasMore(bool $hasMore): self + { + $this->initialized['hasMore'] = true; + $this->hasMore = $hasMore; + return $this; + } +} diff --git a/generated/Model/ListAssistantsResponse.php b/generated/Model/ListAssistantsResponse.php new file mode 100644 index 0000000..62e28e4 --- /dev/null +++ b/generated/Model/ListAssistantsResponse.php @@ -0,0 +1,122 @@ +setObject($object); + } + if ($data !== null) { + $this->setData($data); + } + if ($firstId !== null) { + $this->setFirstId($firstId); + } + if ($lastId !== null) { + $this->setLastId($lastId); + } + if ($hasMore !== null) { + $this->setHasMore($hasMore); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + public function getObject(): string + { + return $this->object; + } + + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * @return AssistantObject[] + */ + public function getData(): array + { + return $this->data; + } + + /** + * @param AssistantObject[] $data + */ + public function setData(array $data): self + { + $this->initialized['data'] = true; + $this->data = $data; + return $this; + } + + public function getFirstId(): string + { + return $this->firstId; + } + + public function setFirstId(string $firstId): self + { + $this->initialized['firstId'] = true; + $this->firstId = $firstId; + return $this; + } + + public function getLastId(): string + { + return $this->lastId; + } + + public function setLastId(string $lastId): self + { + $this->initialized['lastId'] = true; + $this->lastId = $lastId; + return $this; + } + + public function getHasMore(): bool + { + return $this->hasMore; + } + + public function setHasMore(bool $hasMore): self + { + $this->initialized['hasMore'] = true; + $this->hasMore = $hasMore; + return $this; + } +} diff --git a/generated/Model/ListFilesResponse.php b/generated/Model/ListFilesResponse.php index 013163f..e89f294 100644 --- a/generated/Model/ListFilesResponse.php +++ b/generated/Model/ListFilesResponse.php @@ -10,25 +10,25 @@ class ListFilesResponse extends ArrayObject { protected array $initialized = []; - protected ?string $object = null; - /** - * @var OpenAIFile[]|null + * @var OpenAIFile[] */ protected ?array $data = null; + protected ?string $object = null; + /** - * @param string $object * @param OpenAIFile[] $data + * @param string $object */ - public function __construct($object = null, $data = null) + public function __construct($data = null, $object = null) { - if ($object !== null) { - $this->setObject($object); - } if ($data !== null) { $this->setData($data); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool @@ -36,18 +36,6 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } - public function getObject(): string - { - return $this->object; - } - - public function setObject(string $object): self - { - $this->initialized['object'] = true; - $this->object = $object; - return $this; - } - /** * @return OpenAIFile[] */ @@ -65,4 +53,16 @@ public function setData(array $data): self $this->data = $data; return $this; } + + public function getObject(): string + { + return $this->object; + } + + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } } diff --git a/generated/Model/ListFineTuneEventsResponse.php b/generated/Model/ListFineTuneEventsResponse.php index 2ae6c22..cb31bb0 100644 --- a/generated/Model/ListFineTuneEventsResponse.php +++ b/generated/Model/ListFineTuneEventsResponse.php @@ -10,25 +10,25 @@ class ListFineTuneEventsResponse extends ArrayObject { protected array $initialized = []; - protected ?string $object = null; - /** - * @var FineTuneEvent[]|null + * @var FineTuneEvent[] */ protected ?array $data = null; + protected ?string $object = null; + /** - * @param string $object * @param FineTuneEvent[] $data + * @param string $object */ - public function __construct($object = null, $data = null) + public function __construct($data = null, $object = null) { - if ($object !== null) { - $this->setObject($object); - } if ($data !== null) { $this->setData($data); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool @@ -36,18 +36,6 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } - public function getObject(): string - { - return $this->object; - } - - public function setObject(string $object): self - { - $this->initialized['object'] = true; - $this->object = $object; - return $this; - } - /** * @return FineTuneEvent[] */ @@ -65,4 +53,16 @@ public function setData(array $data): self $this->data = $data; return $this; } + + public function getObject(): string + { + return $this->object; + } + + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } } diff --git a/generated/Model/ListFineTunesResponse.php b/generated/Model/ListFineTunesResponse.php index c767403..59eb721 100644 --- a/generated/Model/ListFineTunesResponse.php +++ b/generated/Model/ListFineTunesResponse.php @@ -10,25 +10,25 @@ class ListFineTunesResponse extends ArrayObject { protected array $initialized = []; - protected ?string $object = null; - /** - * @var FineTune[]|null + * @var FineTune[] */ protected ?array $data = null; + protected ?string $object = null; + /** - * @param string $object * @param FineTune[] $data + * @param string $object */ - public function __construct($object = null, $data = null) + public function __construct($data = null, $object = null) { - if ($object !== null) { - $this->setObject($object); - } if ($data !== null) { $this->setData($data); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool @@ -36,18 +36,6 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } - public function getObject(): string - { - return $this->object; - } - - public function setObject(string $object): self - { - $this->initialized['object'] = true; - $this->object = $object; - return $this; - } - /** * @return FineTune[] */ @@ -65,4 +53,16 @@ public function setData(array $data): self $this->data = $data; return $this; } + + public function getObject(): string + { + return $this->object; + } + + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } } diff --git a/generated/Model/ListEnginesResponse.php b/generated/Model/ListFineTuningJobEventsResponse.php similarity index 80% rename from generated/Model/ListEnginesResponse.php rename to generated/Model/ListFineTuningJobEventsResponse.php index ecb57bf..172df60 100644 --- a/generated/Model/ListEnginesResponse.php +++ b/generated/Model/ListFineTuningJobEventsResponse.php @@ -6,29 +6,29 @@ use ArrayObject; -class ListEnginesResponse extends ArrayObject +class ListFineTuningJobEventsResponse extends ArrayObject { protected array $initialized = []; - protected ?string $object = null; - /** - * @var Engine[]|null + * @var FineTuningJobEvent[] */ protected ?array $data = null; + protected ?string $object = null; + /** + * @param FineTuningJobEvent[] $data * @param string $object - * @param Engine[] $data */ - public function __construct($object = null, $data = null) + public function __construct($data = null, $object = null) { - if ($object !== null) { - $this->setObject($object); - } if ($data !== null) { $this->setData($data); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool @@ -36,20 +36,8 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } - public function getObject(): string - { - return $this->object; - } - - public function setObject(string $object): self - { - $this->initialized['object'] = true; - $this->object = $object; - return $this; - } - /** - * @return Engine[] + * @return FineTuningJobEvent[] */ public function getData(): array { @@ -57,7 +45,7 @@ public function getData(): array } /** - * @param Engine[] $data + * @param FineTuningJobEvent[] $data */ public function setData(array $data): self { @@ -65,4 +53,16 @@ public function setData(array $data): self $this->data = $data; return $this; } + + public function getObject(): string + { + return $this->object; + } + + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } } diff --git a/generated/Model/ListMessageFilesResponse.php b/generated/Model/ListMessageFilesResponse.php new file mode 100644 index 0000000..a4e4fbd --- /dev/null +++ b/generated/Model/ListMessageFilesResponse.php @@ -0,0 +1,122 @@ +setObject($object); + } + if ($data !== null) { + $this->setData($data); + } + if ($firstId !== null) { + $this->setFirstId($firstId); + } + if ($lastId !== null) { + $this->setLastId($lastId); + } + if ($hasMore !== null) { + $this->setHasMore($hasMore); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + public function getObject(): string + { + return $this->object; + } + + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * @return MessageFileObject[] + */ + public function getData(): array + { + return $this->data; + } + + /** + * @param MessageFileObject[] $data + */ + public function setData(array $data): self + { + $this->initialized['data'] = true; + $this->data = $data; + return $this; + } + + public function getFirstId(): string + { + return $this->firstId; + } + + public function setFirstId(string $firstId): self + { + $this->initialized['firstId'] = true; + $this->firstId = $firstId; + return $this; + } + + public function getLastId(): string + { + return $this->lastId; + } + + public function setLastId(string $lastId): self + { + $this->initialized['lastId'] = true; + $this->lastId = $lastId; + return $this; + } + + public function getHasMore(): bool + { + return $this->hasMore; + } + + public function setHasMore(bool $hasMore): self + { + $this->initialized['hasMore'] = true; + $this->hasMore = $hasMore; + return $this; + } +} diff --git a/generated/Model/ListMessagesResponse.php b/generated/Model/ListMessagesResponse.php new file mode 100644 index 0000000..926679b --- /dev/null +++ b/generated/Model/ListMessagesResponse.php @@ -0,0 +1,122 @@ +setObject($object); + } + if ($data !== null) { + $this->setData($data); + } + if ($firstId !== null) { + $this->setFirstId($firstId); + } + if ($lastId !== null) { + $this->setLastId($lastId); + } + if ($hasMore !== null) { + $this->setHasMore($hasMore); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + public function getObject(): string + { + return $this->object; + } + + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * @return MessageObject[] + */ + public function getData(): array + { + return $this->data; + } + + /** + * @param MessageObject[] $data + */ + public function setData(array $data): self + { + $this->initialized['data'] = true; + $this->data = $data; + return $this; + } + + public function getFirstId(): string + { + return $this->firstId; + } + + public function setFirstId(string $firstId): self + { + $this->initialized['firstId'] = true; + $this->firstId = $firstId; + return $this; + } + + public function getLastId(): string + { + return $this->lastId; + } + + public function setLastId(string $lastId): self + { + $this->initialized['lastId'] = true; + $this->lastId = $lastId; + return $this; + } + + public function getHasMore(): bool + { + return $this->hasMore; + } + + public function setHasMore(bool $hasMore): self + { + $this->initialized['hasMore'] = true; + $this->hasMore = $hasMore; + return $this; + } +} diff --git a/generated/Model/ListModelsResponse.php b/generated/Model/ListModelsResponse.php index dc48afe..2f85bbd 100644 --- a/generated/Model/ListModelsResponse.php +++ b/generated/Model/ListModelsResponse.php @@ -13,7 +13,7 @@ class ListModelsResponse extends ArrayObject protected ?string $object = null; /** - * @var Model[]|null + * @var Model[] */ protected ?array $data = null; diff --git a/generated/Model/CreateSearchResponse.php b/generated/Model/ListPaginatedFineTuningJobsResponse.php similarity index 64% rename from generated/Model/CreateSearchResponse.php rename to generated/Model/ListPaginatedFineTuningJobsResponse.php index 7eaf271..52af845 100644 --- a/generated/Model/CreateSearchResponse.php +++ b/generated/Model/ListPaginatedFineTuningJobsResponse.php @@ -6,35 +6,35 @@ use ArrayObject; -class CreateSearchResponse extends ArrayObject +class ListPaginatedFineTuningJobsResponse extends ArrayObject { protected array $initialized = []; - protected ?string $object = null; - - protected ?string $model = null; - /** - * @var CreateSearchResponseDataItem[]|null + * @var FineTuningJob[] */ protected ?array $data = null; + protected ?bool $hasMore = null; + + protected ?string $object = null; + /** + * @param FineTuningJob[] $data + * @param bool $hasMore * @param string $object - * @param string $model - * @param CreateSearchResponseDataItem[] $data */ - public function __construct($object = null, $model = null, $data = null) + public function __construct($data = null, $hasMore = null, $object = null) { - if ($object !== null) { - $this->setObject($object); - } - if ($model !== null) { - $this->setModel($model); - } if ($data !== null) { $this->setData($data); } + if ($hasMore !== null) { + $this->setHasMore($hasMore); + } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool @@ -42,45 +42,45 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } - public function getObject(): string + /** + * @return FineTuningJob[] + */ + public function getData(): array { - return $this->object; + return $this->data; } - public function setObject(string $object): self + /** + * @param FineTuningJob[] $data + */ + public function setData(array $data): self { - $this->initialized['object'] = true; - $this->object = $object; + $this->initialized['data'] = true; + $this->data = $data; return $this; } - public function getModel(): string + public function getHasMore(): bool { - return $this->model; + return $this->hasMore; } - public function setModel(string $model): self + public function setHasMore(bool $hasMore): self { - $this->initialized['model'] = true; - $this->model = $model; + $this->initialized['hasMore'] = true; + $this->hasMore = $hasMore; return $this; } - /** - * @return CreateSearchResponseDataItem[] - */ - public function getData(): array + public function getObject(): string { - return $this->data; + return $this->object; } - /** - * @param CreateSearchResponseDataItem[] $data - */ - public function setData(array $data): self + public function setObject(string $object): self { - $this->initialized['data'] = true; - $this->data = $data; + $this->initialized['object'] = true; + $this->object = $object; return $this; } } diff --git a/generated/Model/ListRunStepsResponse.php b/generated/Model/ListRunStepsResponse.php new file mode 100644 index 0000000..92ea035 --- /dev/null +++ b/generated/Model/ListRunStepsResponse.php @@ -0,0 +1,122 @@ +setObject($object); + } + if ($data !== null) { + $this->setData($data); + } + if ($firstId !== null) { + $this->setFirstId($firstId); + } + if ($lastId !== null) { + $this->setLastId($lastId); + } + if ($hasMore !== null) { + $this->setHasMore($hasMore); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + public function getObject(): string + { + return $this->object; + } + + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * @return RunStepObject[] + */ + public function getData(): array + { + return $this->data; + } + + /** + * @param RunStepObject[] $data + */ + public function setData(array $data): self + { + $this->initialized['data'] = true; + $this->data = $data; + return $this; + } + + public function getFirstId(): string + { + return $this->firstId; + } + + public function setFirstId(string $firstId): self + { + $this->initialized['firstId'] = true; + $this->firstId = $firstId; + return $this; + } + + public function getLastId(): string + { + return $this->lastId; + } + + public function setLastId(string $lastId): self + { + $this->initialized['lastId'] = true; + $this->lastId = $lastId; + return $this; + } + + public function getHasMore(): bool + { + return $this->hasMore; + } + + public function setHasMore(bool $hasMore): self + { + $this->initialized['hasMore'] = true; + $this->hasMore = $hasMore; + return $this; + } +} diff --git a/generated/Model/ListRunsResponse.php b/generated/Model/ListRunsResponse.php new file mode 100644 index 0000000..28231f2 --- /dev/null +++ b/generated/Model/ListRunsResponse.php @@ -0,0 +1,122 @@ +setObject($object); + } + if ($data !== null) { + $this->setData($data); + } + if ($firstId !== null) { + $this->setFirstId($firstId); + } + if ($lastId !== null) { + $this->setLastId($lastId); + } + if ($hasMore !== null) { + $this->setHasMore($hasMore); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + public function getObject(): string + { + return $this->object; + } + + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * @return RunObject[] + */ + public function getData(): array + { + return $this->data; + } + + /** + * @param RunObject[] $data + */ + public function setData(array $data): self + { + $this->initialized['data'] = true; + $this->data = $data; + return $this; + } + + public function getFirstId(): string + { + return $this->firstId; + } + + public function setFirstId(string $firstId): self + { + $this->initialized['firstId'] = true; + $this->firstId = $firstId; + return $this; + } + + public function getLastId(): string + { + return $this->lastId; + } + + public function setLastId(string $lastId): self + { + $this->initialized['lastId'] = true; + $this->lastId = $lastId; + return $this; + } + + public function getHasMore(): bool + { + return $this->hasMore; + } + + public function setHasMore(bool $hasMore): self + { + $this->initialized['hasMore'] = true; + $this->hasMore = $hasMore; + return $this; + } +} diff --git a/generated/Model/ListThreadsResponse.php b/generated/Model/ListThreadsResponse.php new file mode 100644 index 0000000..c71686e --- /dev/null +++ b/generated/Model/ListThreadsResponse.php @@ -0,0 +1,122 @@ +setObject($object); + } + if ($data !== null) { + $this->setData($data); + } + if ($firstId !== null) { + $this->setFirstId($firstId); + } + if ($lastId !== null) { + $this->setLastId($lastId); + } + if ($hasMore !== null) { + $this->setHasMore($hasMore); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + public function getObject(): string + { + return $this->object; + } + + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * @return ThreadObject[] + */ + public function getData(): array + { + return $this->data; + } + + /** + * @param ThreadObject[] $data + */ + public function setData(array $data): self + { + $this->initialized['data'] = true; + $this->data = $data; + return $this; + } + + public function getFirstId(): string + { + return $this->firstId; + } + + public function setFirstId(string $firstId): self + { + $this->initialized['firstId'] = true; + $this->firstId = $firstId; + return $this; + } + + public function getLastId(): string + { + return $this->lastId; + } + + public function setLastId(string $lastId): self + { + $this->initialized['lastId'] = true; + $this->lastId = $lastId; + return $this; + } + + public function getHasMore(): bool + { + return $this->hasMore; + } + + public function setHasMore(bool $hasMore): self + { + $this->initialized['hasMore'] = true; + $this->hasMore = $hasMore; + return $this; + } +} diff --git a/generated/Model/MessageContentImageFileObject.php b/generated/Model/MessageContentImageFileObject.php new file mode 100644 index 0000000..5adde16 --- /dev/null +++ b/generated/Model/MessageContentImageFileObject.php @@ -0,0 +1,68 @@ +setType($type); + } + if ($imageFile !== null) { + $this->setImageFile($imageFile); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * Always `image_file`. + */ + public function getType(): string + { + return $this->type; + } + + /** + * Always `image_file`. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + public function getImageFile(): MessageContentImageFileObjectImageFile + { + return $this->imageFile; + } + + public function setImageFile(MessageContentImageFileObjectImageFile $imageFile): self + { + $this->initialized['imageFile'] = true; + $this->imageFile = $imageFile; + return $this; + } +} diff --git a/generated/Model/MessageContentImageFileObjectImageFile.php b/generated/Model/MessageContentImageFileObjectImageFile.php new file mode 100644 index 0000000..43e35a2 --- /dev/null +++ b/generated/Model/MessageContentImageFileObjectImageFile.php @@ -0,0 +1,50 @@ +setFileId($fileId); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The [File](/docs/api-reference/files) ID of the image in the message content. + */ + public function getFileId(): string + { + return $this->fileId; + } + + /** + * The [File](/docs/api-reference/files) ID of the image in the message content. + */ + public function setFileId(string $fileId): self + { + $this->initialized['fileId'] = true; + $this->fileId = $fileId; + return $this; + } +} diff --git a/generated/Model/MessageContentTextAnnotationsFileCitationObject.php b/generated/Model/MessageContentTextAnnotationsFileCitationObject.php new file mode 100644 index 0000000..baa30f9 --- /dev/null +++ b/generated/Model/MessageContentTextAnnotationsFileCitationObject.php @@ -0,0 +1,131 @@ +setType($type); + } + if ($text !== null) { + $this->setText($text); + } + if ($fileCitation !== null) { + $this->setFileCitation($fileCitation); + } + if ($startIndex !== null) { + $this->setStartIndex($startIndex); + } + if ($endIndex !== null) { + $this->setEndIndex($endIndex); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * Always `file_citation`. + */ + public function getType(): string + { + return $this->type; + } + + /** + * Always `file_citation`. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + /** + * The text in the message content that needs to be replaced. + */ + public function getText(): string + { + return $this->text; + } + + /** + * The text in the message content that needs to be replaced. + */ + public function setText(string $text): self + { + $this->initialized['text'] = true; + $this->text = $text; + return $this; + } + + public function getFileCitation(): MessageContentTextAnnotationsFileCitationObjectFileCitation + { + return $this->fileCitation; + } + + public function setFileCitation(MessageContentTextAnnotationsFileCitationObjectFileCitation $fileCitation): self + { + $this->initialized['fileCitation'] = true; + $this->fileCitation = $fileCitation; + return $this; + } + + public function getStartIndex(): int + { + return $this->startIndex; + } + + public function setStartIndex(int $startIndex): self + { + $this->initialized['startIndex'] = true; + $this->startIndex = $startIndex; + return $this; + } + + public function getEndIndex(): int + { + return $this->endIndex; + } + + public function setEndIndex(int $endIndex): self + { + $this->initialized['endIndex'] = true; + $this->endIndex = $endIndex; + return $this; + } +} diff --git a/generated/Model/MessageContentTextAnnotationsFileCitationObjectFileCitation.php b/generated/Model/MessageContentTextAnnotationsFileCitationObjectFileCitation.php new file mode 100644 index 0000000..1265dfe --- /dev/null +++ b/generated/Model/MessageContentTextAnnotationsFileCitationObjectFileCitation.php @@ -0,0 +1,77 @@ +setFileId($fileId); + } + if ($quote !== null) { + $this->setQuote($quote); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The ID of the specific File the citation is from. + */ + public function getFileId(): string + { + return $this->fileId; + } + + /** + * The ID of the specific File the citation is from. + */ + public function setFileId(string $fileId): self + { + $this->initialized['fileId'] = true; + $this->fileId = $fileId; + return $this; + } + + /** + * The specific quote in the file. + */ + public function getQuote(): string + { + return $this->quote; + } + + /** + * The specific quote in the file. + */ + public function setQuote(string $quote): self + { + $this->initialized['quote'] = true; + $this->quote = $quote; + return $this; + } +} diff --git a/generated/Model/MessageContentTextAnnotationsFilePathObject.php b/generated/Model/MessageContentTextAnnotationsFilePathObject.php new file mode 100644 index 0000000..bed908e --- /dev/null +++ b/generated/Model/MessageContentTextAnnotationsFilePathObject.php @@ -0,0 +1,131 @@ +setType($type); + } + if ($text !== null) { + $this->setText($text); + } + if ($filePath !== null) { + $this->setFilePath($filePath); + } + if ($startIndex !== null) { + $this->setStartIndex($startIndex); + } + if ($endIndex !== null) { + $this->setEndIndex($endIndex); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * Always `file_path`. + */ + public function getType(): string + { + return $this->type; + } + + /** + * Always `file_path`. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + /** + * The text in the message content that needs to be replaced. + */ + public function getText(): string + { + return $this->text; + } + + /** + * The text in the message content that needs to be replaced. + */ + public function setText(string $text): self + { + $this->initialized['text'] = true; + $this->text = $text; + return $this; + } + + public function getFilePath(): MessageContentTextAnnotationsFilePathObjectFilePath + { + return $this->filePath; + } + + public function setFilePath(MessageContentTextAnnotationsFilePathObjectFilePath $filePath): self + { + $this->initialized['filePath'] = true; + $this->filePath = $filePath; + return $this; + } + + public function getStartIndex(): int + { + return $this->startIndex; + } + + public function setStartIndex(int $startIndex): self + { + $this->initialized['startIndex'] = true; + $this->startIndex = $startIndex; + return $this; + } + + public function getEndIndex(): int + { + return $this->endIndex; + } + + public function setEndIndex(int $endIndex): self + { + $this->initialized['endIndex'] = true; + $this->endIndex = $endIndex; + return $this; + } +} diff --git a/generated/Model/MessageContentTextAnnotationsFilePathObjectFilePath.php b/generated/Model/MessageContentTextAnnotationsFilePathObjectFilePath.php new file mode 100644 index 0000000..7b3f452 --- /dev/null +++ b/generated/Model/MessageContentTextAnnotationsFilePathObjectFilePath.php @@ -0,0 +1,50 @@ +setFileId($fileId); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The ID of the file that was generated. + */ + public function getFileId(): string + { + return $this->fileId; + } + + /** + * The ID of the file that was generated. + */ + public function setFileId(string $fileId): self + { + $this->initialized['fileId'] = true; + $this->fileId = $fileId; + return $this; + } +} diff --git a/generated/Model/MessageContentTextObject.php b/generated/Model/MessageContentTextObject.php new file mode 100644 index 0000000..d6413dc --- /dev/null +++ b/generated/Model/MessageContentTextObject.php @@ -0,0 +1,68 @@ +setType($type); + } + if ($text !== null) { + $this->setText($text); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * Always `text`. + */ + public function getType(): string + { + return $this->type; + } + + /** + * Always `text`. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + public function getText(): MessageContentTextObjectText + { + return $this->text; + } + + public function setText(MessageContentTextObjectText $text): self + { + $this->initialized['text'] = true; + $this->text = $text; + return $this; + } +} diff --git a/generated/Model/MessageContentTextObjectText.php b/generated/Model/MessageContentTextObjectText.php new file mode 100644 index 0000000..097f20d --- /dev/null +++ b/generated/Model/MessageContentTextObjectText.php @@ -0,0 +1,77 @@ +setValue($value); + } + if ($annotations !== null) { + $this->setAnnotations($annotations); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The data that makes up the text. + */ + public function getValue(): string + { + return $this->value; + } + + /** + * The data that makes up the text. + */ + public function setValue(string $value): self + { + $this->initialized['value'] = true; + $this->value = $value; + return $this; + } + + /** + * @return mixed[] + */ + public function getAnnotations(): array + { + return $this->annotations; + } + + /** + * @param mixed[] $annotations + */ + public function setAnnotations(array $annotations): self + { + $this->initialized['annotations'] = true; + $this->annotations = $annotations; + return $this; + } +} diff --git a/generated/Model/MessageFileObject.php b/generated/Model/MessageFileObject.php new file mode 100644 index 0000000..253585e --- /dev/null +++ b/generated/Model/MessageFileObject.php @@ -0,0 +1,131 @@ +setId($id); + } + if ($object !== null) { + $this->setObject($object); + } + if ($createdAt !== null) { + $this->setCreatedAt($createdAt); + } + if ($messageId !== null) { + $this->setMessageId($messageId); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The identifier, which can be referenced in API endpoints. + */ + public function getId(): string + { + return $this->id; + } + + /** + * The identifier, which can be referenced in API endpoints. + */ + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + /** + * The object type, which is always `thread.message.file`. + */ + public function getObject(): string + { + return $this->object; + } + + /** + * The object type, which is always `thread.message.file`. + */ + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * The Unix timestamp (in seconds) for when the message file was created. + */ + public function getCreatedAt(): int + { + return $this->createdAt; + } + + /** + * The Unix timestamp (in seconds) for when the message file was created. + */ + public function setCreatedAt(int $createdAt): self + { + $this->initialized['createdAt'] = true; + $this->createdAt = $createdAt; + return $this; + } + + /** + * The ID of the [message](/docs/api-reference/messages) that the [File](/docs/api-reference/files) is attached to. + */ + public function getMessageId(): string + { + return $this->messageId; + } + + /** + * The ID of the [message](/docs/api-reference/messages) that the [File](/docs/api-reference/files) is attached to. + */ + public function setMessageId(string $messageId): self + { + $this->initialized['messageId'] = true; + $this->messageId = $messageId; + return $this; + } +} diff --git a/generated/Model/MessageObject.php b/generated/Model/MessageObject.php new file mode 100644 index 0000000..37cbf5a --- /dev/null +++ b/generated/Model/MessageObject.php @@ -0,0 +1,311 @@ +|null + */ + protected $metadata = null; + + /** + * @param string $id The identifier, which can be referenced in API endpoints. + * @param string $object The object type, which is always `thread.message`. + * @param int $createdAt The Unix timestamp (in seconds) for when the message was created. + * @param string $threadId The [thread](/docs/api-reference/threads) ID that this message belongs to. + * @param string $role The entity that produced the message. One of `user` or `assistant`. + * @param mixed[] $content The content of the message in array of text and/or images. + * @param string|null $assistantId If applicable, the ID of the [assistant](/docs/api-reference/assistants) that authored this message. + * @param string|null $runId If applicable, the ID of the [run](/docs/api-reference/runs) associated with the authoring of this message. + * @param string[] $fileIds A list of [file](/docs/api-reference/files) IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can access files. A maximum of 10 files can be attached to a message. + * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + */ + public function __construct($id = null, $object = null, $createdAt = null, $threadId = null, $role = null, $content = null, $assistantId = null, $runId = null, $fileIds = [], $metadata = null) + { + if ($id !== null) { + $this->setId($id); + } + if ($object !== null) { + $this->setObject($object); + } + if ($createdAt !== null) { + $this->setCreatedAt($createdAt); + } + if ($threadId !== null) { + $this->setThreadId($threadId); + } + if ($role !== null) { + $this->setRole($role); + } + if ($content !== null) { + $this->setContent($content); + } + if ($assistantId !== null) { + $this->setAssistantId($assistantId); + } + if ($runId !== null) { + $this->setRunId($runId); + } + if ($fileIds !== null) { + $this->setFileIds($fileIds); + } + if ($metadata !== null) { + $this->setMetadata($metadata); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The identifier, which can be referenced in API endpoints. + */ + public function getId(): string + { + return $this->id; + } + + /** + * The identifier, which can be referenced in API endpoints. + */ + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + /** + * The object type, which is always `thread.message`. + */ + public function getObject(): string + { + return $this->object; + } + + /** + * The object type, which is always `thread.message`. + */ + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * The Unix timestamp (in seconds) for when the message was created. + */ + public function getCreatedAt(): int + { + return $this->createdAt; + } + + /** + * The Unix timestamp (in seconds) for when the message was created. + */ + public function setCreatedAt(int $createdAt): self + { + $this->initialized['createdAt'] = true; + $this->createdAt = $createdAt; + return $this; + } + + /** + * The [thread](/docs/api-reference/threads) ID that this message belongs to. + */ + public function getThreadId(): string + { + return $this->threadId; + } + + /** + * The [thread](/docs/api-reference/threads) ID that this message belongs to. + */ + public function setThreadId(string $threadId): self + { + $this->initialized['threadId'] = true; + $this->threadId = $threadId; + return $this; + } + + /** + * The entity that produced the message. One of `user` or `assistant`. + */ + public function getRole(): string + { + return $this->role; + } + + /** + * The entity that produced the message. One of `user` or `assistant`. + */ + public function setRole(string $role): self + { + $this->initialized['role'] = true; + $this->role = $role; + return $this; + } + + /** + * The content of the message in array of text and/or images. + * + * @return mixed[] + */ + public function getContent(): array + { + return $this->content; + } + + /** + * The content of the message in array of text and/or images. + * + * @param mixed[] $content + */ + public function setContent(array $content): self + { + $this->initialized['content'] = true; + $this->content = $content; + return $this; + } + + /** + * If applicable, the ID of the [assistant](/docs/api-reference/assistants) that authored this message. + */ + public function getAssistantId(): ?string + { + return $this->assistantId; + } + + /** + * If applicable, the ID of the [assistant](/docs/api-reference/assistants) that authored this message. + */ + public function setAssistantId(?string $assistantId): self + { + $this->initialized['assistantId'] = true; + $this->assistantId = $assistantId; + return $this; + } + + /** + * If applicable, the ID of the [run](/docs/api-reference/runs) associated with the authoring of this message. + */ + public function getRunId(): ?string + { + return $this->runId; + } + + /** + * If applicable, the ID of the [run](/docs/api-reference/runs) associated with the authoring of this message. + */ + public function setRunId(?string $runId): self + { + $this->initialized['runId'] = true; + $this->runId = $runId; + return $this; + } + + /** + * A list of [file](/docs/api-reference/files) IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can access files. A maximum of 10 files can be attached to a message. + * + * @return string[] + */ + public function getFileIds(): array + { + return $this->fileIds; + } + + /** + * A list of [file](/docs/api-reference/files) IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can access files. A maximum of 10 files can be attached to a message. + * + * @param string[] $fileIds + */ + public function setFileIds(array $fileIds): self + { + $this->initialized['fileIds'] = true; + $this->fileIds = $fileIds; + return $this; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @return array|null + */ + public function getMetadata(): ?iterable + { + return $this->metadata; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @param array|null $metadata + */ + public function setMetadata(?iterable $metadata): self + { + $this->initialized['metadata'] = true; + $this->metadata = $metadata; + return $this; + } +} diff --git a/generated/Model/Model.php b/generated/Model/Model.php index 4d9ad37..5d42462 100644 --- a/generated/Model/Model.php +++ b/generated/Model/Model.php @@ -10,31 +10,43 @@ class Model extends ArrayObject { protected array $initialized = []; + /** + * The model identifier, which can be referenced in the API endpoints. + */ protected ?string $id = null; - protected ?string $object = null; - + /** + * The Unix timestamp (in seconds) when the model was created. + */ protected ?int $created = null; + /** + * The object type, which is always "model". + */ + protected ?string $object = null; + + /** + * The organization that owns the model. + */ protected ?string $ownedBy = null; /** - * @param string $id - * @param string $object - * @param int $created - * @param string $ownedBy + * @param string $id The model identifier, which can be referenced in the API endpoints. + * @param int $created The Unix timestamp (in seconds) when the model was created. + * @param string $object The object type, which is always "model". + * @param string $ownedBy The organization that owns the model. */ - public function __construct($id = null, $object = null, $created = null, $ownedBy = null) + public function __construct($id = null, $created = null, $object = null, $ownedBy = null) { if ($id !== null) { $this->setId($id); } - if ($object !== null) { - $this->setObject($object); - } if ($created !== null) { $this->setCreated($created); } + if ($object !== null) { + $this->setObject($object); + } if ($ownedBy !== null) { $this->setOwnedBy($ownedBy); } @@ -45,11 +57,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } + /** + * The model identifier, which can be referenced in the API endpoints. + */ public function getId(): string { return $this->id; } + /** + * The model identifier, which can be referenced in the API endpoints. + */ public function setId(string $id): self { $this->initialized['id'] = true; @@ -57,35 +75,53 @@ public function setId(string $id): self return $this; } - public function getObject(): string + /** + * The Unix timestamp (in seconds) when the model was created. + */ + public function getCreated(): int { - return $this->object; + return $this->created; } - public function setObject(string $object): self + /** + * The Unix timestamp (in seconds) when the model was created. + */ + public function setCreated(int $created): self { - $this->initialized['object'] = true; - $this->object = $object; + $this->initialized['created'] = true; + $this->created = $created; return $this; } - public function getCreated(): int + /** + * The object type, which is always "model". + */ + public function getObject(): string { - return $this->created; + return $this->object; } - public function setCreated(int $created): self + /** + * The object type, which is always "model". + */ + public function setObject(string $object): self { - $this->initialized['created'] = true; - $this->created = $created; + $this->initialized['object'] = true; + $this->object = $object; return $this; } + /** + * The organization that owns the model. + */ public function getOwnedBy(): string { return $this->ownedBy; } + /** + * The organization that owns the model. + */ public function setOwnedBy(string $ownedBy): self { $this->initialized['ownedBy'] = true; diff --git a/generated/Model/ModifyAssistantRequest.php b/generated/Model/ModifyAssistantRequest.php new file mode 100644 index 0000000..3287935 --- /dev/null +++ b/generated/Model/ModifyAssistantRequest.php @@ -0,0 +1,232 @@ +|null + */ + protected $metadata = null; + + /** + * @param mixed $model ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + * @param string|null $name The name of the assistant. The maximum length is 256 characters. + * @param string|null $description The description of the assistant. The maximum length is 512 characters. + * @param string|null $instructions The system instructions that the assistant uses. The maximum length is 32768 characters. + * @param mixed[] $tools A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. + * @param string[] $fileIds A list of [File](/docs/api-reference/files) IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. If a file was previously attached to the list but does not show up in the list, it will be deleted from the assistant. + * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + */ + public function __construct(mixed $model = null, $name = null, $description = null, $instructions = null, $tools = [], $fileIds = [], $metadata = null) + { + if ($model !== null) { + $this->setModel($model); + } + if ($name !== null) { + $this->setName($name); + } + if ($description !== null) { + $this->setDescription($description); + } + if ($instructions !== null) { + $this->setInstructions($instructions); + } + if ($tools !== null) { + $this->setTools($tools); + } + if ($fileIds !== null) { + $this->setFileIds($fileIds); + } + if ($metadata !== null) { + $this->setMetadata($metadata); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + * + * @return mixed + */ + public function getModel() + { + return $this->model; + } + + /** + * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + */ + public function setModel(mixed $model): self + { + $this->initialized['model'] = true; + $this->model = $model; + return $this; + } + + /** + * The name of the assistant. The maximum length is 256 characters. + */ + public function getName(): ?string + { + return $this->name; + } + + /** + * The name of the assistant. The maximum length is 256 characters. + */ + public function setName(?string $name): self + { + $this->initialized['name'] = true; + $this->name = $name; + return $this; + } + + /** + * The description of the assistant. The maximum length is 512 characters. + */ + public function getDescription(): ?string + { + return $this->description; + } + + /** + * The description of the assistant. The maximum length is 512 characters. + */ + public function setDescription(?string $description): self + { + $this->initialized['description'] = true; + $this->description = $description; + return $this; + } + + /** + * The system instructions that the assistant uses. The maximum length is 32768 characters. + */ + public function getInstructions(): ?string + { + return $this->instructions; + } + + /** + * The system instructions that the assistant uses. The maximum length is 32768 characters. + */ + public function setInstructions(?string $instructions): self + { + $this->initialized['instructions'] = true; + $this->instructions = $instructions; + return $this; + } + + /** + * A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. + * + * @return mixed[] + */ + public function getTools(): array + { + return $this->tools; + } + + /** + * A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. + * + * @param mixed[] $tools + */ + public function setTools(array $tools): self + { + $this->initialized['tools'] = true; + $this->tools = $tools; + return $this; + } + + /** + * A list of [File](/docs/api-reference/files) IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. If a file was previously attached to the list but does not show up in the list, it will be deleted from the assistant. + * + * @return string[] + */ + public function getFileIds(): array + { + return $this->fileIds; + } + + /** + * A list of [File](/docs/api-reference/files) IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. If a file was previously attached to the list but does not show up in the list, it will be deleted from the assistant. + * + * @param string[] $fileIds + */ + public function setFileIds(array $fileIds): self + { + $this->initialized['fileIds'] = true; + $this->fileIds = $fileIds; + return $this; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @return array|null + */ + public function getMetadata(): ?iterable + { + return $this->metadata; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @param array|null $metadata + */ + public function setMetadata(?iterable $metadata): self + { + $this->initialized['metadata'] = true; + $this->metadata = $metadata; + return $this; + } +} diff --git a/generated/Model/ModifyMessageRequest.php b/generated/Model/ModifyMessageRequest.php new file mode 100644 index 0000000..34026f0 --- /dev/null +++ b/generated/Model/ModifyMessageRequest.php @@ -0,0 +1,54 @@ +|null + */ + protected $metadata = null; + + /** + * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + */ + public function __construct($metadata = null) + { + if ($metadata !== null) { + $this->setMetadata($metadata); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @return array|null + */ + public function getMetadata(): ?iterable + { + return $this->metadata; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @param array|null $metadata + */ + public function setMetadata(?iterable $metadata): self + { + $this->initialized['metadata'] = true; + $this->metadata = $metadata; + return $this; + } +} diff --git a/generated/Model/ModifyRunRequest.php b/generated/Model/ModifyRunRequest.php new file mode 100644 index 0000000..e3dba08 --- /dev/null +++ b/generated/Model/ModifyRunRequest.php @@ -0,0 +1,54 @@ +|null + */ + protected $metadata = null; + + /** + * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + */ + public function __construct($metadata = null) + { + if ($metadata !== null) { + $this->setMetadata($metadata); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @return array|null + */ + public function getMetadata(): ?iterable + { + return $this->metadata; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @param array|null $metadata + */ + public function setMetadata(?iterable $metadata): self + { + $this->initialized['metadata'] = true; + $this->metadata = $metadata; + return $this; + } +} diff --git a/generated/Model/ModifyThreadRequest.php b/generated/Model/ModifyThreadRequest.php new file mode 100644 index 0000000..1cd11a2 --- /dev/null +++ b/generated/Model/ModifyThreadRequest.php @@ -0,0 +1,54 @@ +|null + */ + protected $metadata = null; + + /** + * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + */ + public function __construct($metadata = null) + { + if ($metadata !== null) { + $this->setMetadata($metadata); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @return array|null + */ + public function getMetadata(): ?iterable + { + return $this->metadata; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @param array|null $metadata + */ + public function setMetadata(?iterable $metadata): self + { + $this->initialized['metadata'] = true; + $this->metadata = $metadata; + return $this; + } +} diff --git a/generated/Model/OpenAIFile.php b/generated/Model/OpenAIFile.php index a229f09..d52948d 100644 --- a/generated/Model/OpenAIFile.php +++ b/generated/Model/OpenAIFile.php @@ -10,43 +10,65 @@ class OpenAIFile extends ArrayObject { protected array $initialized = []; + /** + * The file identifier, which can be referenced in the API endpoints. + */ protected ?string $id = null; - protected ?string $object = null; - + /** + * The size of the file, in bytes. + */ protected ?int $bytes = null; + /** + * The Unix timestamp (in seconds) for when the file was created. + */ protected ?int $createdAt = null; + /** + * The name of the file. + */ protected ?string $filename = null; + /** + * The object type, which is always `file`. + */ + protected ?string $object = null; + + /** + * The intended purpose of the file. Supported values are `fine-tune`, `fine-tune-results`, `assistants`, and `assistants_output`. + */ protected ?string $purpose = null; + /** + * Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. + * + * @deprecated + */ protected ?string $status = null; /** - * @var mixed[]|null + * Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`. + * + * @deprecated */ - protected ?iterable $statusDetails = null; + protected ?string $statusDetails = null; /** - * @param string $id - * @param string $object - * @param int $bytes - * @param int $createdAt - * @param string $filename - * @param string $purpose - * @param string $status - * @param mixed[]|null $statusDetails + * @param string $id The file identifier, which can be referenced in the API endpoints. + * @param int $bytes The size of the file, in bytes. + * @param int $createdAt The Unix timestamp (in seconds) for when the file was created. + * @param string $filename The name of the file. + * @param string $object The object type, which is always `file`. + * @param string $purpose The intended purpose of the file. Supported values are `fine-tune`, `fine-tune-results`, `assistants`, and `assistants_output`. + * @param string $status Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. + * @param string $statusDetails Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`. */ - public function __construct($id = null, $object = null, $bytes = null, $createdAt = null, $filename = null, $purpose = null, $status = null, $statusDetails = null) + public function __construct($id = null, $bytes = null, $createdAt = null, $filename = null, $object = null, $purpose = null, $status = null, $statusDetails = null) { if ($id !== null) { $this->setId($id); } - if ($object !== null) { - $this->setObject($object); - } if ($bytes !== null) { $this->setBytes($bytes); } @@ -56,6 +78,9 @@ public function __construct($id = null, $object = null, $bytes = null, $createdA if ($filename !== null) { $this->setFilename($filename); } + if ($object !== null) { + $this->setObject($object); + } if ($purpose !== null) { $this->setPurpose($purpose); } @@ -72,11 +97,17 @@ public function isInitialized($property): bool return array_key_exists($property, $this->initialized); } + /** + * The file identifier, which can be referenced in the API endpoints. + */ public function getId(): string { return $this->id; } + /** + * The file identifier, which can be referenced in the API endpoints. + */ public function setId(string $id): self { $this->initialized['id'] = true; @@ -84,23 +115,17 @@ public function setId(string $id): self return $this; } - public function getObject(): string - { - return $this->object; - } - - public function setObject(string $object): self - { - $this->initialized['object'] = true; - $this->object = $object; - return $this; - } - + /** + * The size of the file, in bytes. + */ public function getBytes(): int { return $this->bytes; } + /** + * The size of the file, in bytes. + */ public function setBytes(int $bytes): self { $this->initialized['bytes'] = true; @@ -108,11 +133,17 @@ public function setBytes(int $bytes): self return $this; } + /** + * The Unix timestamp (in seconds) for when the file was created. + */ public function getCreatedAt(): int { return $this->createdAt; } + /** + * The Unix timestamp (in seconds) for when the file was created. + */ public function setCreatedAt(int $createdAt): self { $this->initialized['createdAt'] = true; @@ -120,11 +151,17 @@ public function setCreatedAt(int $createdAt): self return $this; } + /** + * The name of the file. + */ public function getFilename(): string { return $this->filename; } + /** + * The name of the file. + */ public function setFilename(string $filename): self { $this->initialized['filename'] = true; @@ -132,11 +169,35 @@ public function setFilename(string $filename): self return $this; } + /** + * The object type, which is always `file`. + */ + public function getObject(): string + { + return $this->object; + } + + /** + * The object type, which is always `file`. + */ + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * The intended purpose of the file. Supported values are `fine-tune`, `fine-tune-results`, `assistants`, and `assistants_output`. + */ public function getPurpose(): string { return $this->purpose; } + /** + * The intended purpose of the file. Supported values are `fine-tune`, `fine-tune-results`, `assistants`, and `assistants_output`. + */ public function setPurpose(string $purpose): self { $this->initialized['purpose'] = true; @@ -144,11 +205,21 @@ public function setPurpose(string $purpose): self return $this; } + /** + * Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. + * + * @deprecated + */ public function getStatus(): string { return $this->status; } + /** + * Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. + * + * @deprecated + */ public function setStatus(string $status): self { $this->initialized['status'] = true; @@ -157,17 +228,21 @@ public function setStatus(string $status): self } /** - * @return mixed[]|null + * Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`. + * + * @deprecated */ - public function getStatusDetails(): ?iterable + public function getStatusDetails(): string { return $this->statusDetails; } /** - * @param mixed[]|null $statusDetails + * Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`. + * + * @deprecated */ - public function setStatusDetails(?iterable $statusDetails): self + public function setStatusDetails(string $statusDetails): self { $this->initialized['statusDetails'] = true; $this->statusDetails = $statusDetails; diff --git a/generated/Model/RunObject.php b/generated/Model/RunObject.php new file mode 100644 index 0000000..cb85fd4 --- /dev/null +++ b/generated/Model/RunObject.php @@ -0,0 +1,527 @@ +|null + */ + protected $metadata = null; + + /** + * @param string $id The identifier, which can be referenced in API endpoints. + * @param string $object The object type, which is always `thread.run`. + * @param int $createdAt The Unix timestamp (in seconds) for when the run was created. + * @param string $threadId The ID of the [thread](/docs/api-reference/threads) that was executed on as a part of this run. + * @param string $assistantId The ID of the [assistant](/docs/api-reference/assistants) used for execution of this run. + * @param string $status The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, or `expired`. + * @param RunObjectRequiredAction|null $requiredAction Details on the action required to continue the run. Will be `null` if no action is required. + * @param RunObjectLastError|null $lastError The last error associated with this run. Will be `null` if there are no errors. + * @param int $expiresAt The Unix timestamp (in seconds) for when the run will expire. + * @param int|null $startedAt The Unix timestamp (in seconds) for when the run was started. + * @param int|null $cancelledAt The Unix timestamp (in seconds) for when the run was cancelled. + * @param int|null $failedAt The Unix timestamp (in seconds) for when the run failed. + * @param int|null $completedAt The Unix timestamp (in seconds) for when the run was completed. + * @param string $model The model that the [assistant](/docs/api-reference/assistants) used for this run. + * @param string $instructions The instructions that the [assistant](/docs/api-reference/assistants) used for this run. + * @param mixed[] $tools The list of tools that the [assistant](/docs/api-reference/assistants) used for this run. + * @param string[] $fileIds The list of [File](/docs/api-reference/files) IDs the [assistant](/docs/api-reference/assistants) used for this run. + * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + */ + public function __construct($id = null, $object = null, $createdAt = null, $threadId = null, $assistantId = null, $status = null, $requiredAction = null, $lastError = null, $expiresAt = null, $startedAt = null, $cancelledAt = null, $failedAt = null, $completedAt = null, $model = null, $instructions = null, $tools = [], $fileIds = [], $metadata = null) + { + if ($id !== null) { + $this->setId($id); + } + if ($object !== null) { + $this->setObject($object); + } + if ($createdAt !== null) { + $this->setCreatedAt($createdAt); + } + if ($threadId !== null) { + $this->setThreadId($threadId); + } + if ($assistantId !== null) { + $this->setAssistantId($assistantId); + } + if ($status !== null) { + $this->setStatus($status); + } + if ($requiredAction !== null) { + $this->setRequiredAction($requiredAction); + } + if ($lastError !== null) { + $this->setLastError($lastError); + } + if ($expiresAt !== null) { + $this->setExpiresAt($expiresAt); + } + if ($startedAt !== null) { + $this->setStartedAt($startedAt); + } + if ($cancelledAt !== null) { + $this->setCancelledAt($cancelledAt); + } + if ($failedAt !== null) { + $this->setFailedAt($failedAt); + } + if ($completedAt !== null) { + $this->setCompletedAt($completedAt); + } + if ($model !== null) { + $this->setModel($model); + } + if ($instructions !== null) { + $this->setInstructions($instructions); + } + if ($tools !== null) { + $this->setTools($tools); + } + if ($fileIds !== null) { + $this->setFileIds($fileIds); + } + if ($metadata !== null) { + $this->setMetadata($metadata); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The identifier, which can be referenced in API endpoints. + */ + public function getId(): string + { + return $this->id; + } + + /** + * The identifier, which can be referenced in API endpoints. + */ + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + /** + * The object type, which is always `thread.run`. + */ + public function getObject(): string + { + return $this->object; + } + + /** + * The object type, which is always `thread.run`. + */ + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * The Unix timestamp (in seconds) for when the run was created. + */ + public function getCreatedAt(): int + { + return $this->createdAt; + } + + /** + * The Unix timestamp (in seconds) for when the run was created. + */ + public function setCreatedAt(int $createdAt): self + { + $this->initialized['createdAt'] = true; + $this->createdAt = $createdAt; + return $this; + } + + /** + * The ID of the [thread](/docs/api-reference/threads) that was executed on as a part of this run. + */ + public function getThreadId(): string + { + return $this->threadId; + } + + /** + * The ID of the [thread](/docs/api-reference/threads) that was executed on as a part of this run. + */ + public function setThreadId(string $threadId): self + { + $this->initialized['threadId'] = true; + $this->threadId = $threadId; + return $this; + } + + /** + * The ID of the [assistant](/docs/api-reference/assistants) used for execution of this run. + */ + public function getAssistantId(): string + { + return $this->assistantId; + } + + /** + * The ID of the [assistant](/docs/api-reference/assistants) used for execution of this run. + */ + public function setAssistantId(string $assistantId): self + { + $this->initialized['assistantId'] = true; + $this->assistantId = $assistantId; + return $this; + } + + /** + * The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, or `expired`. + */ + public function getStatus(): string + { + return $this->status; + } + + /** + * The status of the run, which can be either `queued`, `in_progress`, `requires_action`, `cancelling`, `cancelled`, `failed`, `completed`, or `expired`. + */ + public function setStatus(string $status): self + { + $this->initialized['status'] = true; + $this->status = $status; + return $this; + } + + /** + * Details on the action required to continue the run. Will be `null` if no action is required. + */ + public function getRequiredAction(): ?RunObjectRequiredAction + { + return $this->requiredAction; + } + + /** + * Details on the action required to continue the run. Will be `null` if no action is required. + */ + public function setRequiredAction(?RunObjectRequiredAction $requiredAction): self + { + $this->initialized['requiredAction'] = true; + $this->requiredAction = $requiredAction; + return $this; + } + + /** + * The last error associated with this run. Will be `null` if there are no errors. + */ + public function getLastError(): ?RunObjectLastError + { + return $this->lastError; + } + + /** + * The last error associated with this run. Will be `null` if there are no errors. + */ + public function setLastError(?RunObjectLastError $lastError): self + { + $this->initialized['lastError'] = true; + $this->lastError = $lastError; + return $this; + } + + /** + * The Unix timestamp (in seconds) for when the run will expire. + */ + public function getExpiresAt(): int + { + return $this->expiresAt; + } + + /** + * The Unix timestamp (in seconds) for when the run will expire. + */ + public function setExpiresAt(int $expiresAt): self + { + $this->initialized['expiresAt'] = true; + $this->expiresAt = $expiresAt; + return $this; + } + + /** + * The Unix timestamp (in seconds) for when the run was started. + */ + public function getStartedAt(): ?int + { + return $this->startedAt; + } + + /** + * The Unix timestamp (in seconds) for when the run was started. + */ + public function setStartedAt(?int $startedAt): self + { + $this->initialized['startedAt'] = true; + $this->startedAt = $startedAt; + return $this; + } + + /** + * The Unix timestamp (in seconds) for when the run was cancelled. + */ + public function getCancelledAt(): ?int + { + return $this->cancelledAt; + } + + /** + * The Unix timestamp (in seconds) for when the run was cancelled. + */ + public function setCancelledAt(?int $cancelledAt): self + { + $this->initialized['cancelledAt'] = true; + $this->cancelledAt = $cancelledAt; + return $this; + } + + /** + * The Unix timestamp (in seconds) for when the run failed. + */ + public function getFailedAt(): ?int + { + return $this->failedAt; + } + + /** + * The Unix timestamp (in seconds) for when the run failed. + */ + public function setFailedAt(?int $failedAt): self + { + $this->initialized['failedAt'] = true; + $this->failedAt = $failedAt; + return $this; + } + + /** + * The Unix timestamp (in seconds) for when the run was completed. + */ + public function getCompletedAt(): ?int + { + return $this->completedAt; + } + + /** + * The Unix timestamp (in seconds) for when the run was completed. + */ + public function setCompletedAt(?int $completedAt): self + { + $this->initialized['completedAt'] = true; + $this->completedAt = $completedAt; + return $this; + } + + /** + * The model that the [assistant](/docs/api-reference/assistants) used for this run. + */ + public function getModel(): string + { + return $this->model; + } + + /** + * The model that the [assistant](/docs/api-reference/assistants) used for this run. + */ + public function setModel(string $model): self + { + $this->initialized['model'] = true; + $this->model = $model; + return $this; + } + + /** + * The instructions that the [assistant](/docs/api-reference/assistants) used for this run. + */ + public function getInstructions(): string + { + return $this->instructions; + } + + /** + * The instructions that the [assistant](/docs/api-reference/assistants) used for this run. + */ + public function setInstructions(string $instructions): self + { + $this->initialized['instructions'] = true; + $this->instructions = $instructions; + return $this; + } + + /** + * The list of tools that the [assistant](/docs/api-reference/assistants) used for this run. + * + * @return mixed[] + */ + public function getTools(): array + { + return $this->tools; + } + + /** + * The list of tools that the [assistant](/docs/api-reference/assistants) used for this run. + * + * @param mixed[] $tools + */ + public function setTools(array $tools): self + { + $this->initialized['tools'] = true; + $this->tools = $tools; + return $this; + } + + /** + * The list of [File](/docs/api-reference/files) IDs the [assistant](/docs/api-reference/assistants) used for this run. + * + * @return string[] + */ + public function getFileIds(): array + { + return $this->fileIds; + } + + /** + * The list of [File](/docs/api-reference/files) IDs the [assistant](/docs/api-reference/assistants) used for this run. + * + * @param string[] $fileIds + */ + public function setFileIds(array $fileIds): self + { + $this->initialized['fileIds'] = true; + $this->fileIds = $fileIds; + return $this; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @return array|null + */ + public function getMetadata(): ?iterable + { + return $this->metadata; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @param array|null $metadata + */ + public function setMetadata(?iterable $metadata): self + { + $this->initialized['metadata'] = true; + $this->metadata = $metadata; + return $this; + } +} diff --git a/generated/Model/RunObjectLastError.php b/generated/Model/RunObjectLastError.php new file mode 100644 index 0000000..b087710 --- /dev/null +++ b/generated/Model/RunObjectLastError.php @@ -0,0 +1,77 @@ +setCode($code); + } + if ($message !== null) { + $this->setMessage($message); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * One of `server_error` or `rate_limit_exceeded`. + */ + public function getCode(): string + { + return $this->code; + } + + /** + * One of `server_error` or `rate_limit_exceeded`. + */ + public function setCode(string $code): self + { + $this->initialized['code'] = true; + $this->code = $code; + return $this; + } + + /** + * A human-readable description of the error. + */ + public function getMessage(): string + { + return $this->message; + } + + /** + * A human-readable description of the error. + */ + public function setMessage(string $message): self + { + $this->initialized['message'] = true; + $this->message = $message; + return $this; + } +} diff --git a/generated/Model/RunObjectRequiredAction.php b/generated/Model/RunObjectRequiredAction.php new file mode 100644 index 0000000..b03c9e3 --- /dev/null +++ b/generated/Model/RunObjectRequiredAction.php @@ -0,0 +1,77 @@ +setType($type); + } + if ($submitToolOutputs !== null) { + $this->setSubmitToolOutputs($submitToolOutputs); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * For now, this is always `submit_tool_outputs`. + */ + public function getType(): string + { + return $this->type; + } + + /** + * For now, this is always `submit_tool_outputs`. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + /** + * Details on the tool outputs needed for this run to continue. + */ + public function getSubmitToolOutputs(): RunObjectRequiredActionSubmitToolOutputs + { + return $this->submitToolOutputs; + } + + /** + * Details on the tool outputs needed for this run to continue. + */ + public function setSubmitToolOutputs(RunObjectRequiredActionSubmitToolOutputs $submitToolOutputs): self + { + $this->initialized['submitToolOutputs'] = true; + $this->submitToolOutputs = $submitToolOutputs; + return $this; + } +} diff --git a/generated/Model/RunObjectRequiredActionSubmitToolOutputs.php b/generated/Model/RunObjectRequiredActionSubmitToolOutputs.php new file mode 100644 index 0000000..a243a53 --- /dev/null +++ b/generated/Model/RunObjectRequiredActionSubmitToolOutputs.php @@ -0,0 +1,56 @@ +setToolCalls($toolCalls); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * A list of the relevant tool calls. + * + * @return RunToolCallObject[] + */ + public function getToolCalls(): array + { + return $this->toolCalls; + } + + /** + * A list of the relevant tool calls. + * + * @param RunToolCallObject[] $toolCalls + */ + public function setToolCalls(array $toolCalls): self + { + $this->initialized['toolCalls'] = true; + $this->toolCalls = $toolCalls; + return $this; + } +} diff --git a/generated/Model/RunStepDetailsMessageCreationObject.php b/generated/Model/RunStepDetailsMessageCreationObject.php new file mode 100644 index 0000000..2e96b4a --- /dev/null +++ b/generated/Model/RunStepDetailsMessageCreationObject.php @@ -0,0 +1,68 @@ +setType($type); + } + if ($messageCreation !== null) { + $this->setMessageCreation($messageCreation); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * Always `message_creation`. + */ + public function getType(): string + { + return $this->type; + } + + /** + * Always `message_creation`. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + public function getMessageCreation(): RunStepDetailsMessageCreationObjectMessageCreation + { + return $this->messageCreation; + } + + public function setMessageCreation(RunStepDetailsMessageCreationObjectMessageCreation $messageCreation): self + { + $this->initialized['messageCreation'] = true; + $this->messageCreation = $messageCreation; + return $this; + } +} diff --git a/generated/Model/RunStepDetailsMessageCreationObjectMessageCreation.php b/generated/Model/RunStepDetailsMessageCreationObjectMessageCreation.php new file mode 100644 index 0000000..1b9eca5 --- /dev/null +++ b/generated/Model/RunStepDetailsMessageCreationObjectMessageCreation.php @@ -0,0 +1,50 @@ +setMessageId($messageId); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The ID of the message that was created by this run step. + */ + public function getMessageId(): string + { + return $this->messageId; + } + + /** + * The ID of the message that was created by this run step. + */ + public function setMessageId(string $messageId): self + { + $this->initialized['messageId'] = true; + $this->messageId = $messageId; + return $this; + } +} diff --git a/generated/Model/RunStepDetailsToolCallsCodeObject.php b/generated/Model/RunStepDetailsToolCallsCodeObject.php new file mode 100644 index 0000000..be42e13 --- /dev/null +++ b/generated/Model/RunStepDetailsToolCallsCodeObject.php @@ -0,0 +1,104 @@ +setId($id); + } + if ($type !== null) { + $this->setType($type); + } + if ($codeInterpreter !== null) { + $this->setCodeInterpreter($codeInterpreter); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The ID of the tool call. + */ + public function getId(): string + { + return $this->id; + } + + /** + * The ID of the tool call. + */ + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + /** + * The type of tool call. This is always going to be `code_interpreter` for this type of tool call. + */ + public function getType(): string + { + return $this->type; + } + + /** + * The type of tool call. This is always going to be `code_interpreter` for this type of tool call. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + /** + * The Code Interpreter tool call definition. + */ + public function getCodeInterpreter(): RunStepDetailsToolCallsCodeObjectCodeInterpreter + { + return $this->codeInterpreter; + } + + /** + * The Code Interpreter tool call definition. + */ + public function setCodeInterpreter(RunStepDetailsToolCallsCodeObjectCodeInterpreter $codeInterpreter): self + { + $this->initialized['codeInterpreter'] = true; + $this->codeInterpreter = $codeInterpreter; + return $this; + } +} diff --git a/generated/Model/RunStepDetailsToolCallsCodeObjectCodeInterpreter.php b/generated/Model/RunStepDetailsToolCallsCodeObjectCodeInterpreter.php new file mode 100644 index 0000000..c509122 --- /dev/null +++ b/generated/Model/RunStepDetailsToolCallsCodeObjectCodeInterpreter.php @@ -0,0 +1,83 @@ +[] + */ + protected ?array $outputs = null; + + /** + * @param string $input The input to the Code Interpreter tool call. + * @param array[] $outputs The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type. + */ + public function __construct($input = null, $outputs = null) + { + if ($input !== null) { + $this->setInput($input); + } + if ($outputs !== null) { + $this->setOutputs($outputs); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The input to the Code Interpreter tool call. + */ + public function getInput(): string + { + return $this->input; + } + + /** + * The input to the Code Interpreter tool call. + */ + public function setInput(string $input): self + { + $this->initialized['input'] = true; + $this->input = $input; + return $this; + } + + /** + * The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type. + * + * @return array[] + */ + public function getOutputs(): array + { + return $this->outputs; + } + + /** + * The outputs from the Code Interpreter tool call. Code Interpreter can output one or more items, including text (`logs`) or images (`image`). Each of these are represented by a different object type. + * + * @param array[] $outputs + */ + public function setOutputs(array $outputs): self + { + $this->initialized['outputs'] = true; + $this->outputs = $outputs; + return $this; + } +} diff --git a/generated/Model/RunStepDetailsToolCallsCodeOutputImageObject.php b/generated/Model/RunStepDetailsToolCallsCodeOutputImageObject.php new file mode 100644 index 0000000..75f7931 --- /dev/null +++ b/generated/Model/RunStepDetailsToolCallsCodeOutputImageObject.php @@ -0,0 +1,68 @@ +setType($type); + } + if ($image !== null) { + $this->setImage($image); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * Always `image`. + */ + public function getType(): string + { + return $this->type; + } + + /** + * Always `image`. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + public function getImage(): RunStepDetailsToolCallsCodeOutputImageObjectImage + { + return $this->image; + } + + public function setImage(RunStepDetailsToolCallsCodeOutputImageObjectImage $image): self + { + $this->initialized['image'] = true; + $this->image = $image; + return $this; + } +} diff --git a/generated/Model/RunStepDetailsToolCallsCodeOutputImageObjectImage.php b/generated/Model/RunStepDetailsToolCallsCodeOutputImageObjectImage.php new file mode 100644 index 0000000..f940914 --- /dev/null +++ b/generated/Model/RunStepDetailsToolCallsCodeOutputImageObjectImage.php @@ -0,0 +1,50 @@ +setFileId($fileId); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The [file](/docs/api-reference/files) ID of the image. + */ + public function getFileId(): string + { + return $this->fileId; + } + + /** + * The [file](/docs/api-reference/files) ID of the image. + */ + public function setFileId(string $fileId): self + { + $this->initialized['fileId'] = true; + $this->fileId = $fileId; + return $this; + } +} diff --git a/generated/Model/RunStepDetailsToolCallsCodeOutputLogsObject.php b/generated/Model/RunStepDetailsToolCallsCodeOutputLogsObject.php new file mode 100644 index 0000000..d48258d --- /dev/null +++ b/generated/Model/RunStepDetailsToolCallsCodeOutputLogsObject.php @@ -0,0 +1,77 @@ +setType($type); + } + if ($logs !== null) { + $this->setLogs($logs); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * Always `logs`. + */ + public function getType(): string + { + return $this->type; + } + + /** + * Always `logs`. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + /** + * The text output from the Code Interpreter tool call. + */ + public function getLogs(): string + { + return $this->logs; + } + + /** + * The text output from the Code Interpreter tool call. + */ + public function setLogs(string $logs): self + { + $this->initialized['logs'] = true; + $this->logs = $logs; + return $this; + } +} diff --git a/generated/Model/RunStepDetailsToolCallsFunctionObject.php b/generated/Model/RunStepDetailsToolCallsFunctionObject.php new file mode 100644 index 0000000..62e58bb --- /dev/null +++ b/generated/Model/RunStepDetailsToolCallsFunctionObject.php @@ -0,0 +1,104 @@ +setId($id); + } + if ($type !== null) { + $this->setType($type); + } + if ($function !== null) { + $this->setFunction($function); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The ID of the tool call object. + */ + public function getId(): string + { + return $this->id; + } + + /** + * The ID of the tool call object. + */ + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + /** + * The type of tool call. This is always going to be `function` for this type of tool call. + */ + public function getType(): string + { + return $this->type; + } + + /** + * The type of tool call. This is always going to be `function` for this type of tool call. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + /** + * The definition of the function that was called. + */ + public function getFunction(): RunStepDetailsToolCallsFunctionObjectFunction + { + return $this->function; + } + + /** + * The definition of the function that was called. + */ + public function setFunction(RunStepDetailsToolCallsFunctionObjectFunction $function): self + { + $this->initialized['function'] = true; + $this->function = $function; + return $this; + } +} diff --git a/generated/Model/RunStepDetailsToolCallsFunctionObjectFunction.php b/generated/Model/RunStepDetailsToolCallsFunctionObjectFunction.php new file mode 100644 index 0000000..1869a6b --- /dev/null +++ b/generated/Model/RunStepDetailsToolCallsFunctionObjectFunction.php @@ -0,0 +1,104 @@ +setName($name); + } + if ($arguments !== null) { + $this->setArguments($arguments); + } + if ($output !== null) { + $this->setOutput($output); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The name of the function. + */ + public function getName(): string + { + return $this->name; + } + + /** + * The name of the function. + */ + public function setName(string $name): self + { + $this->initialized['name'] = true; + $this->name = $name; + return $this; + } + + /** + * The arguments passed to the function. + */ + public function getArguments(): string + { + return $this->arguments; + } + + /** + * The arguments passed to the function. + */ + public function setArguments(string $arguments): self + { + $this->initialized['arguments'] = true; + $this->arguments = $arguments; + return $this; + } + + /** + * The output of the function. This will be `null` if the outputs have not been [submitted](/docs/api-reference/runs/submitToolOutputs) yet. + */ + public function getOutput(): ?string + { + return $this->output; + } + + /** + * The output of the function. This will be `null` if the outputs have not been [submitted](/docs/api-reference/runs/submitToolOutputs) yet. + */ + public function setOutput(?string $output): self + { + $this->initialized['output'] = true; + $this->output = $output; + return $this; + } +} diff --git a/generated/Model/RunStepDetailsToolCallsObject.php b/generated/Model/RunStepDetailsToolCallsObject.php new file mode 100644 index 0000000..77847e6 --- /dev/null +++ b/generated/Model/RunStepDetailsToolCallsObject.php @@ -0,0 +1,83 @@ +[] + */ + protected ?array $toolCalls = null; + + /** + * @param string $type Always `tool_calls`. + * @param array[] $toolCalls An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `retrieval`, or `function`. + */ + public function __construct($type = null, $toolCalls = null) + { + if ($type !== null) { + $this->setType($type); + } + if ($toolCalls !== null) { + $this->setToolCalls($toolCalls); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * Always `tool_calls`. + */ + public function getType(): string + { + return $this->type; + } + + /** + * Always `tool_calls`. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + /** + * An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `retrieval`, or `function`. + * + * @return array[] + */ + public function getToolCalls(): array + { + return $this->toolCalls; + } + + /** + * An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `retrieval`, or `function`. + * + * @param array[] $toolCalls + */ + public function setToolCalls(array $toolCalls): self + { + $this->initialized['toolCalls'] = true; + $this->toolCalls = $toolCalls; + return $this; + } +} diff --git a/generated/Model/RunStepDetailsToolCallsRetrievalObject.php b/generated/Model/RunStepDetailsToolCallsRetrievalObject.php new file mode 100644 index 0000000..99eb9f3 --- /dev/null +++ b/generated/Model/RunStepDetailsToolCallsRetrievalObject.php @@ -0,0 +1,110 @@ + + */ + protected ?iterable $retrieval = null; + + /** + * @param string $id The ID of the tool call object. + * @param string $type The type of tool call. This is always going to be `retrieval` for this type of tool call. + * @param array $retrieval For now, this is always going to be an empty object. + */ + public function __construct($id = null, $type = null, $retrieval = null) + { + if ($id !== null) { + $this->setId($id); + } + if ($type !== null) { + $this->setType($type); + } + if ($retrieval !== null) { + $this->setRetrieval($retrieval); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The ID of the tool call object. + */ + public function getId(): string + { + return $this->id; + } + + /** + * The ID of the tool call object. + */ + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + /** + * The type of tool call. This is always going to be `retrieval` for this type of tool call. + */ + public function getType(): string + { + return $this->type; + } + + /** + * The type of tool call. This is always going to be `retrieval` for this type of tool call. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + /** + * For now, this is always going to be an empty object. + * + * @return array + */ + public function getRetrieval(): iterable + { + return $this->retrieval; + } + + /** + * For now, this is always going to be an empty object. + * + * @param array $retrieval + */ + public function setRetrieval(iterable $retrieval): self + { + $this->initialized['retrieval'] = true; + $this->retrieval = $retrieval; + return $this; + } +} diff --git a/generated/Model/RunStepObject.php b/generated/Model/RunStepObject.php new file mode 100644 index 0000000..b8459e7 --- /dev/null +++ b/generated/Model/RunStepObject.php @@ -0,0 +1,440 @@ + + */ + protected ?iterable $stepDetails = null; + + /** + * The last error associated with this run step. Will be `null` if there are no errors. + */ + protected ?RunStepObjectLastError $lastError = null; + + /** + * The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired. + */ + protected ?int $expiredAt = null; + + /** + * The Unix timestamp (in seconds) for when the run step was cancelled. + */ + protected ?int $cancelledAt = null; + + /** + * The Unix timestamp (in seconds) for when the run step failed. + */ + protected ?int $failedAt = null; + + /** + * The Unix timestamp (in seconds) for when the run step completed. + */ + protected ?int $completedAt = null; + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @var array|null + */ + protected $metadata = null; + + /** + * @param string $id The identifier of the run step, which can be referenced in API endpoints. + * @param string $object The object type, which is always `thread.run.step`. + * @param int $createdAt The Unix timestamp (in seconds) for when the run step was created. + * @param string $assistantId The ID of the [assistant](/docs/api-reference/assistants) associated with the run step. + * @param string $threadId The ID of the [thread](/docs/api-reference/threads) that was run. + * @param string $runId The ID of the [run](/docs/api-reference/runs) that this run step is a part of. + * @param string $type The type of run step, which can be either `message_creation` or `tool_calls`. + * @param string $status The status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`. + * @param array $stepDetails The details of the run step. + * @param RunStepObjectLastError|null $lastError The last error associated with this run step. Will be `null` if there are no errors. + * @param int|null $expiredAt The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired. + * @param int|null $cancelledAt The Unix timestamp (in seconds) for when the run step was cancelled. + * @param int|null $failedAt The Unix timestamp (in seconds) for when the run step failed. + * @param int|null $completedAt The Unix timestamp (in seconds) for when the run step completed. + * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + */ + public function __construct($id = null, $object = null, $createdAt = null, $assistantId = null, $threadId = null, $runId = null, $type = null, $status = null, $stepDetails = null, $lastError = null, $expiredAt = null, $cancelledAt = null, $failedAt = null, $completedAt = null, $metadata = null) + { + if ($id !== null) { + $this->setId($id); + } + if ($object !== null) { + $this->setObject($object); + } + if ($createdAt !== null) { + $this->setCreatedAt($createdAt); + } + if ($assistantId !== null) { + $this->setAssistantId($assistantId); + } + if ($threadId !== null) { + $this->setThreadId($threadId); + } + if ($runId !== null) { + $this->setRunId($runId); + } + if ($type !== null) { + $this->setType($type); + } + if ($status !== null) { + $this->setStatus($status); + } + if ($stepDetails !== null) { + $this->setStepDetails($stepDetails); + } + if ($lastError !== null) { + $this->setLastError($lastError); + } + if ($expiredAt !== null) { + $this->setExpiredAt($expiredAt); + } + if ($cancelledAt !== null) { + $this->setCancelledAt($cancelledAt); + } + if ($failedAt !== null) { + $this->setFailedAt($failedAt); + } + if ($completedAt !== null) { + $this->setCompletedAt($completedAt); + } + if ($metadata !== null) { + $this->setMetadata($metadata); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The identifier of the run step, which can be referenced in API endpoints. + */ + public function getId(): string + { + return $this->id; + } + + /** + * The identifier of the run step, which can be referenced in API endpoints. + */ + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + /** + * The object type, which is always `thread.run.step`. + */ + public function getObject(): string + { + return $this->object; + } + + /** + * The object type, which is always `thread.run.step`. + */ + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * The Unix timestamp (in seconds) for when the run step was created. + */ + public function getCreatedAt(): int + { + return $this->createdAt; + } + + /** + * The Unix timestamp (in seconds) for when the run step was created. + */ + public function setCreatedAt(int $createdAt): self + { + $this->initialized['createdAt'] = true; + $this->createdAt = $createdAt; + return $this; + } + + /** + * The ID of the [assistant](/docs/api-reference/assistants) associated with the run step. + */ + public function getAssistantId(): string + { + return $this->assistantId; + } + + /** + * The ID of the [assistant](/docs/api-reference/assistants) associated with the run step. + */ + public function setAssistantId(string $assistantId): self + { + $this->initialized['assistantId'] = true; + $this->assistantId = $assistantId; + return $this; + } + + /** + * The ID of the [thread](/docs/api-reference/threads) that was run. + */ + public function getThreadId(): string + { + return $this->threadId; + } + + /** + * The ID of the [thread](/docs/api-reference/threads) that was run. + */ + public function setThreadId(string $threadId): self + { + $this->initialized['threadId'] = true; + $this->threadId = $threadId; + return $this; + } + + /** + * The ID of the [run](/docs/api-reference/runs) that this run step is a part of. + */ + public function getRunId(): string + { + return $this->runId; + } + + /** + * The ID of the [run](/docs/api-reference/runs) that this run step is a part of. + */ + public function setRunId(string $runId): self + { + $this->initialized['runId'] = true; + $this->runId = $runId; + return $this; + } + + /** + * The type of run step, which can be either `message_creation` or `tool_calls`. + */ + public function getType(): string + { + return $this->type; + } + + /** + * The type of run step, which can be either `message_creation` or `tool_calls`. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + /** + * The status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`. + */ + public function getStatus(): string + { + return $this->status; + } + + /** + * The status of the run step, which can be either `in_progress`, `cancelled`, `failed`, `completed`, or `expired`. + */ + public function setStatus(string $status): self + { + $this->initialized['status'] = true; + $this->status = $status; + return $this; + } + + /** + * The details of the run step. + * + * @return array + */ + public function getStepDetails(): iterable + { + return $this->stepDetails; + } + + /** + * The details of the run step. + * + * @param array $stepDetails + */ + public function setStepDetails(iterable $stepDetails): self + { + $this->initialized['stepDetails'] = true; + $this->stepDetails = $stepDetails; + return $this; + } + + /** + * The last error associated with this run step. Will be `null` if there are no errors. + */ + public function getLastError(): ?RunStepObjectLastError + { + return $this->lastError; + } + + /** + * The last error associated with this run step. Will be `null` if there are no errors. + */ + public function setLastError(?RunStepObjectLastError $lastError): self + { + $this->initialized['lastError'] = true; + $this->lastError = $lastError; + return $this; + } + + /** + * The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired. + */ + public function getExpiredAt(): ?int + { + return $this->expiredAt; + } + + /** + * The Unix timestamp (in seconds) for when the run step expired. A step is considered expired if the parent run is expired. + */ + public function setExpiredAt(?int $expiredAt): self + { + $this->initialized['expiredAt'] = true; + $this->expiredAt = $expiredAt; + return $this; + } + + /** + * The Unix timestamp (in seconds) for when the run step was cancelled. + */ + public function getCancelledAt(): ?int + { + return $this->cancelledAt; + } + + /** + * The Unix timestamp (in seconds) for when the run step was cancelled. + */ + public function setCancelledAt(?int $cancelledAt): self + { + $this->initialized['cancelledAt'] = true; + $this->cancelledAt = $cancelledAt; + return $this; + } + + /** + * The Unix timestamp (in seconds) for when the run step failed. + */ + public function getFailedAt(): ?int + { + return $this->failedAt; + } + + /** + * The Unix timestamp (in seconds) for when the run step failed. + */ + public function setFailedAt(?int $failedAt): self + { + $this->initialized['failedAt'] = true; + $this->failedAt = $failedAt; + return $this; + } + + /** + * The Unix timestamp (in seconds) for when the run step completed. + */ + public function getCompletedAt(): ?int + { + return $this->completedAt; + } + + /** + * The Unix timestamp (in seconds) for when the run step completed. + */ + public function setCompletedAt(?int $completedAt): self + { + $this->initialized['completedAt'] = true; + $this->completedAt = $completedAt; + return $this; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @return array|null + */ + public function getMetadata(): ?iterable + { + return $this->metadata; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @param array|null $metadata + */ + public function setMetadata(?iterable $metadata): self + { + $this->initialized['metadata'] = true; + $this->metadata = $metadata; + return $this; + } +} diff --git a/generated/Model/RunStepObjectLastError.php b/generated/Model/RunStepObjectLastError.php new file mode 100644 index 0000000..cc43b2a --- /dev/null +++ b/generated/Model/RunStepObjectLastError.php @@ -0,0 +1,77 @@ +setCode($code); + } + if ($message !== null) { + $this->setMessage($message); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * One of `server_error` or `rate_limit_exceeded`. + */ + public function getCode(): string + { + return $this->code; + } + + /** + * One of `server_error` or `rate_limit_exceeded`. + */ + public function setCode(string $code): self + { + $this->initialized['code'] = true; + $this->code = $code; + return $this; + } + + /** + * A human-readable description of the error. + */ + public function getMessage(): string + { + return $this->message; + } + + /** + * A human-readable description of the error. + */ + public function setMessage(string $message): self + { + $this->initialized['message'] = true; + $this->message = $message; + return $this; + } +} diff --git a/generated/Model/RunToolCallObject.php b/generated/Model/RunToolCallObject.php new file mode 100644 index 0000000..8b793f5 --- /dev/null +++ b/generated/Model/RunToolCallObject.php @@ -0,0 +1,104 @@ +setId($id); + } + if ($type !== null) { + $this->setType($type); + } + if ($function !== null) { + $this->setFunction($function); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the [Submit tool outputs to run](/docs/api-reference/runs/submitToolOutputs) endpoint. + */ + public function getId(): string + { + return $this->id; + } + + /** + * The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the [Submit tool outputs to run](/docs/api-reference/runs/submitToolOutputs) endpoint. + */ + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + /** + * The type of tool call the output is required for. For now, this is always `function`. + */ + public function getType(): string + { + return $this->type; + } + + /** + * The type of tool call the output is required for. For now, this is always `function`. + */ + public function setType(string $type): self + { + $this->initialized['type'] = true; + $this->type = $type; + return $this; + } + + /** + * The function definition. + */ + public function getFunction(): RunToolCallObjectFunction + { + return $this->function; + } + + /** + * The function definition. + */ + public function setFunction(RunToolCallObjectFunction $function): self + { + $this->initialized['function'] = true; + $this->function = $function; + return $this; + } +} diff --git a/generated/Model/RunToolCallObjectFunction.php b/generated/Model/RunToolCallObjectFunction.php new file mode 100644 index 0000000..81630d8 --- /dev/null +++ b/generated/Model/RunToolCallObjectFunction.php @@ -0,0 +1,77 @@ +setName($name); + } + if ($arguments !== null) { + $this->setArguments($arguments); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The name of the function. + */ + public function getName(): string + { + return $this->name; + } + + /** + * The name of the function. + */ + public function setName(string $name): self + { + $this->initialized['name'] = true; + $this->name = $name; + return $this; + } + + /** + * The arguments that the model expects you to pass to the function. + */ + public function getArguments(): string + { + return $this->arguments; + } + + /** + * The arguments that the model expects you to pass to the function. + */ + public function setArguments(string $arguments): self + { + $this->initialized['arguments'] = true; + $this->arguments = $arguments; + return $this; + } +} diff --git a/generated/Model/SubmitToolOutputsRunRequest.php b/generated/Model/SubmitToolOutputsRunRequest.php new file mode 100644 index 0000000..a25e584 --- /dev/null +++ b/generated/Model/SubmitToolOutputsRunRequest.php @@ -0,0 +1,54 @@ +setToolOutputs($toolOutputs); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * A list of tools for which the outputs are being submitted. + * + * @return SubmitToolOutputsRunRequestToolOutputsItem[] + */ + public function getToolOutputs(): array + { + return $this->toolOutputs; + } + + /** + * A list of tools for which the outputs are being submitted. + * + * @param SubmitToolOutputsRunRequestToolOutputsItem[] $toolOutputs + */ + public function setToolOutputs(array $toolOutputs): self + { + $this->initialized['toolOutputs'] = true; + $this->toolOutputs = $toolOutputs; + return $this; + } +} diff --git a/generated/Model/SubmitToolOutputsRunRequestToolOutputsItem.php b/generated/Model/SubmitToolOutputsRunRequestToolOutputsItem.php new file mode 100644 index 0000000..eedd948 --- /dev/null +++ b/generated/Model/SubmitToolOutputsRunRequestToolOutputsItem.php @@ -0,0 +1,77 @@ +setToolCallId($toolCallId); + } + if ($output !== null) { + $this->setOutput($output); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The ID of the tool call in the `required_action` object within the run object the output is being submitted for. + */ + public function getToolCallId(): string + { + return $this->toolCallId; + } + + /** + * The ID of the tool call in the `required_action` object within the run object the output is being submitted for. + */ + public function setToolCallId(string $toolCallId): self + { + $this->initialized['toolCallId'] = true; + $this->toolCallId = $toolCallId; + return $this; + } + + /** + * The output of the tool call to be submitted to continue the run. + */ + public function getOutput(): string + { + return $this->output; + } + + /** + * The output of the tool call to be submitted to continue the run. + */ + public function setOutput(string $output): self + { + $this->initialized['output'] = true; + $this->output = $output; + return $this; + } +} diff --git a/generated/Model/ThreadObject.php b/generated/Model/ThreadObject.php new file mode 100644 index 0000000..71961a4 --- /dev/null +++ b/generated/Model/ThreadObject.php @@ -0,0 +1,137 @@ +|null + */ + protected $metadata = null; + + /** + * @param string $id The identifier, which can be referenced in API endpoints. + * @param string $object The object type, which is always `thread`. + * @param int $createdAt The Unix timestamp (in seconds) for when the thread was created. + * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + */ + public function __construct($id = null, $object = null, $createdAt = null, $metadata = null) + { + if ($id !== null) { + $this->setId($id); + } + if ($object !== null) { + $this->setObject($object); + } + if ($createdAt !== null) { + $this->setCreatedAt($createdAt); + } + if ($metadata !== null) { + $this->setMetadata($metadata); + } + } + + public function isInitialized($property): bool + { + return array_key_exists($property, $this->initialized); + } + + /** + * The identifier, which can be referenced in API endpoints. + */ + public function getId(): string + { + return $this->id; + } + + /** + * The identifier, which can be referenced in API endpoints. + */ + public function setId(string $id): self + { + $this->initialized['id'] = true; + $this->id = $id; + return $this; + } + + /** + * The object type, which is always `thread`. + */ + public function getObject(): string + { + return $this->object; + } + + /** + * The object type, which is always `thread`. + */ + public function setObject(string $object): self + { + $this->initialized['object'] = true; + $this->object = $object; + return $this; + } + + /** + * The Unix timestamp (in seconds) for when the thread was created. + */ + public function getCreatedAt(): int + { + return $this->createdAt; + } + + /** + * The Unix timestamp (in seconds) for when the thread was created. + */ + public function setCreatedAt(int $createdAt): self + { + $this->initialized['createdAt'] = true; + $this->createdAt = $createdAt; + return $this; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @return array|null + */ + public function getMetadata(): ?iterable + { + return $this->metadata; + } + + /** + * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * + * @param array|null $metadata + */ + public function setMetadata(?iterable $metadata): self + { + $this->initialized['metadata'] = true; + $this->metadata = $metadata; + return $this; + } +} diff --git a/generated/Normalizer/CreateSearchResponseDataItemNormalizer.php b/generated/Normalizer/AssistantFileObjectNormalizer.php similarity index 61% rename from generated/Normalizer/CreateSearchResponseDataItemNormalizer.php rename to generated/Normalizer/AssistantFileObjectNormalizer.php index f63ca31..80bbd53 100644 --- a/generated/Normalizer/CreateSearchResponseDataItemNormalizer.php +++ b/generated/Normalizer/AssistantFileObjectNormalizer.php @@ -6,7 +6,7 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; -use Sourceability\OpenAIClient\Generated\Model\CreateSearchResponseDataItem; +use Sourceability\OpenAIClient\Generated\Model\AssistantFileObject; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -16,21 +16,21 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class CreateSearchResponseDataItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AssistantFileObjectNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { use DenormalizerAwareTrait; use NormalizerAwareTrait; use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { - return $type === CreateSearchResponseDataItem::class; + return $type === AssistantFileObject::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { - return is_object($data) && $data::class === CreateSearchResponseDataItem::class; + return is_object($data) && $data::class === AssistantFileObject::class; } /** @@ -44,24 +44,25 @@ public function denormalize($data, $class, $format = null, array $context = []) if (isset($data['$recursiveRef'])) { return new Reference($data['$recursiveRef'], $context['document-origin']); } - $object = new CreateSearchResponseDataItem(); - if (\array_key_exists('score', $data) && \is_int($data['score'])) { - $data['score'] = (float) $data['score']; - } + $object = new AssistantFileObject(); if ($data === null || \is_array($data) === false) { return $object; } + if (\array_key_exists('id', $data)) { + $object->setId($data['id']); + unset($data['id']); + } if (\array_key_exists('object', $data)) { $object->setObject($data['object']); unset($data['object']); } - if (\array_key_exists('document', $data)) { - $object->setDocument($data['document']); - unset($data['document']); + if (\array_key_exists('created_at', $data)) { + $object->setCreatedAt($data['created_at']); + unset($data['created_at']); } - if (\array_key_exists('score', $data)) { - $object->setScore($data['score']); - unset($data['score']); + if (\array_key_exists('assistant_id', $data)) { + $object->setAssistantId($data['assistant_id']); + unset($data['assistant_id']); } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { @@ -77,15 +78,10 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - if ($object->isInitialized('object') && $object->getObject() !== null) { - $data['object'] = $object->getObject(); - } - if ($object->isInitialized('document') && $object->getDocument() !== null) { - $data['document'] = $object->getDocument(); - } - if ($object->isInitialized('score') && $object->getScore() !== null) { - $data['score'] = $object->getScore(); - } + $data['id'] = $object->getId(); + $data['object'] = $object->getObject(); + $data['created_at'] = $object->getCreatedAt(); + $data['assistant_id'] = $object->getAssistantId(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; @@ -93,4 +89,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + AssistantFileObject::class => false, + ]; + } } diff --git a/generated/Normalizer/AssistantObjectNormalizer.php b/generated/Normalizer/AssistantObjectNormalizer.php new file mode 100644 index 0000000..bae6d07 --- /dev/null +++ b/generated/Normalizer/AssistantObjectNormalizer.php @@ -0,0 +1,161 @@ +setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } + if (\array_key_exists('created_at', $data)) { + $object->setCreatedAt($data['created_at']); + unset($data['created_at']); + } + if (\array_key_exists('name', $data) && $data['name'] !== null) { + $object->setName($data['name']); + unset($data['name']); + } elseif (\array_key_exists('name', $data) && $data['name'] === null) { + $object->setName(null); + } + if (\array_key_exists('description', $data) && $data['description'] !== null) { + $object->setDescription($data['description']); + unset($data['description']); + } elseif (\array_key_exists('description', $data) && $data['description'] === null) { + $object->setDescription(null); + } + if (\array_key_exists('model', $data)) { + $object->setModel($data['model']); + unset($data['model']); + } + if (\array_key_exists('instructions', $data) && $data['instructions'] !== null) { + $object->setInstructions($data['instructions']); + unset($data['instructions']); + } elseif (\array_key_exists('instructions', $data) && $data['instructions'] === null) { + $object->setInstructions(null); + } + if (\array_key_exists('tools', $data)) { + $values = []; + foreach ($data['tools'] as $value) { + $values[] = $value; + } + $object->setTools($values); + unset($data['tools']); + } + if (\array_key_exists('file_ids', $data)) { + $values_1 = []; + foreach ($data['file_ids'] as $value_1) { + $values_1[] = $value_1; + } + $object->setFileIds($values_1); + unset($data['file_ids']); + } + if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { + $values_2 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['metadata'] as $key => $value_2) { + $values_2[$key] = $value_2; + } + $object->setMetadata($values_2); + unset($data['metadata']); + } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { + $object->setMetadata(null); + } + foreach ($data as $key_1 => $value_3) { + if (preg_match('/.*/', (string) $key_1)) { + $object[$key_1] = $value_3; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['id'] = $object->getId(); + $data['object'] = $object->getObject(); + $data['created_at'] = $object->getCreatedAt(); + $data['name'] = $object->getName(); + $data['description'] = $object->getDescription(); + $data['model'] = $object->getModel(); + $data['instructions'] = $object->getInstructions(); + $values = []; + foreach ($object->getTools() as $value) { + $values[] = $value; + } + $data['tools'] = $values; + $values_1 = []; + foreach ($object->getFileIds() as $value_1) { + $values_1[] = $value_1; + } + $data['file_ids'] = $values_1; + $values_2 = []; + foreach ($object->getMetadata() as $key => $value_2) { + $values_2[$key] = $value_2; + } + $data['metadata'] = $values_2; + foreach ($object as $key_1 => $value_3) { + if (preg_match('/.*/', (string) $key_1)) { + $data[$key_1] = $value_3; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + AssistantObject::class => false, + ]; + } +} diff --git a/generated/Normalizer/AssistantToolsCodeNormalizer.php b/generated/Normalizer/AssistantToolsCodeNormalizer.php new file mode 100644 index 0000000..6de0df2 --- /dev/null +++ b/generated/Normalizer/AssistantToolsCodeNormalizer.php @@ -0,0 +1,84 @@ +setType($data['type']); + unset($data['type']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['type'] = $object->getType(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + AssistantToolsCode::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateChatCompletionResponseUsageNormalizer.php b/generated/Normalizer/AssistantToolsFunctionNormalizer.php similarity index 61% rename from generated/Normalizer/CreateChatCompletionResponseUsageNormalizer.php rename to generated/Normalizer/AssistantToolsFunctionNormalizer.php index 2549634..372de91 100644 --- a/generated/Normalizer/CreateChatCompletionResponseUsageNormalizer.php +++ b/generated/Normalizer/AssistantToolsFunctionNormalizer.php @@ -6,7 +6,8 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; -use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionResponseUsage; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsFunction; +use Sourceability\OpenAIClient\Generated\Model\FunctionObject; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -16,21 +17,21 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class CreateChatCompletionResponseUsageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class AssistantToolsFunctionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { use DenormalizerAwareTrait; use NormalizerAwareTrait; use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { - return $type === CreateChatCompletionResponseUsage::class; + return $type === AssistantToolsFunction::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { - return is_object($data) && $data::class === CreateChatCompletionResponseUsage::class; + return is_object($data) && $data::class === AssistantToolsFunction::class; } /** @@ -44,21 +45,17 @@ public function denormalize($data, $class, $format = null, array $context = []) if (isset($data['$recursiveRef'])) { return new Reference($data['$recursiveRef'], $context['document-origin']); } - $object = new CreateChatCompletionResponseUsage(); + $object = new AssistantToolsFunction(); if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('prompt_tokens', $data)) { - $object->setPromptTokens($data['prompt_tokens']); - unset($data['prompt_tokens']); + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); } - if (\array_key_exists('completion_tokens', $data)) { - $object->setCompletionTokens($data['completion_tokens']); - unset($data['completion_tokens']); - } - if (\array_key_exists('total_tokens', $data)) { - $object->setTotalTokens($data['total_tokens']); - unset($data['total_tokens']); + if (\array_key_exists('function', $data)) { + $object->setFunction($this->denormalizer->denormalize($data['function'], FunctionObject::class, 'json', $context)); + unset($data['function']); } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { @@ -74,9 +71,8 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['prompt_tokens'] = $object->getPromptTokens(); - $data['completion_tokens'] = $object->getCompletionTokens(); - $data['total_tokens'] = $object->getTotalTokens(); + $data['type'] = $object->getType(); + $data['function'] = $this->normalizer->normalize($object->getFunction(), 'json', $context); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; @@ -84,4 +80,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + AssistantToolsFunction::class => false, + ]; + } } diff --git a/generated/Normalizer/AssistantToolsRetrievalNormalizer.php b/generated/Normalizer/AssistantToolsRetrievalNormalizer.php new file mode 100644 index 0000000..7abe3eb --- /dev/null +++ b/generated/Normalizer/AssistantToolsRetrievalNormalizer.php @@ -0,0 +1,84 @@ +setType($data['type']); + unset($data['type']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['type'] = $object->getType(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + AssistantToolsRetrieval::class => false, + ]; + } +} diff --git a/generated/Normalizer/ChatCompletionFunctionCallOptionNormalizer.php b/generated/Normalizer/ChatCompletionFunctionCallOptionNormalizer.php new file mode 100644 index 0000000..55c7157 --- /dev/null +++ b/generated/Normalizer/ChatCompletionFunctionCallOptionNormalizer.php @@ -0,0 +1,84 @@ +setName($data['name']); + unset($data['name']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['name'] = $object->getName(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionFunctionCallOption::class => false, + ]; + } +} diff --git a/generated/Normalizer/ChatCompletionFunctionsNormalizer.php b/generated/Normalizer/ChatCompletionFunctionsNormalizer.php index 4d10c35..da7cb5f 100644 --- a/generated/Normalizer/ChatCompletionFunctionsNormalizer.php +++ b/generated/Normalizer/ChatCompletionFunctionsNormalizer.php @@ -23,12 +23,12 @@ class ChatCompletionFunctionsNormalizer implements DenormalizerInterface, Normal use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === ChatCompletionFunctions::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === ChatCompletionFunctions::class; } @@ -48,14 +48,14 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('name', $data)) { - $object->setName($data['name']); - unset($data['name']); - } if (\array_key_exists('description', $data)) { $object->setDescription($data['description']); unset($data['description']); } + if (\array_key_exists('name', $data)) { + $object->setName($data['name']); + unset($data['name']); + } if (\array_key_exists('parameters', $data)) { $values = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); foreach ($data['parameters'] as $key => $value) { @@ -78,10 +78,10 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['name'] = $object->getName(); if ($object->isInitialized('description') && $object->getDescription() !== null) { $data['description'] = $object->getDescription(); } + $data['name'] = $object->getName(); if ($object->isInitialized('parameters') && $object->getParameters() !== null) { $values = []; foreach ($object->getParameters() as $key => $value) { @@ -96,4 +96,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionFunctions::class => false, + ]; + } } diff --git a/generated/Normalizer/ChatCompletionRequestMessageFunctionCallNormalizer.php b/generated/Normalizer/ChatCompletionMessageToolCallChunkFunctionNormalizer.php similarity index 77% rename from generated/Normalizer/ChatCompletionRequestMessageFunctionCallNormalizer.php rename to generated/Normalizer/ChatCompletionMessageToolCallChunkFunctionNormalizer.php index c5536c7..5ab8c32 100644 --- a/generated/Normalizer/ChatCompletionRequestMessageFunctionCallNormalizer.php +++ b/generated/Normalizer/ChatCompletionMessageToolCallChunkFunctionNormalizer.php @@ -6,7 +6,7 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; -use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestMessageFunctionCall; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionMessageToolCallChunkFunction; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -16,21 +16,21 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ChatCompletionRequestMessageFunctionCallNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ChatCompletionMessageToolCallChunkFunctionNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { use DenormalizerAwareTrait; use NormalizerAwareTrait; use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { - return $type === ChatCompletionRequestMessageFunctionCall::class; + return $type === ChatCompletionMessageToolCallChunkFunction::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { - return is_object($data) && $data::class === ChatCompletionRequestMessageFunctionCall::class; + return is_object($data) && $data::class === ChatCompletionMessageToolCallChunkFunction::class; } /** @@ -44,7 +44,7 @@ public function denormalize($data, $class, $format = null, array $context = []) if (isset($data['$recursiveRef'])) { return new Reference($data['$recursiveRef'], $context['document-origin']); } - $object = new ChatCompletionRequestMessageFunctionCall(); + $object = new ChatCompletionMessageToolCallChunkFunction(); if ($data === null || \is_array($data) === false) { return $object; } @@ -83,4 +83,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionMessageToolCallChunkFunction::class => false, + ]; + } } diff --git a/generated/Normalizer/ChatCompletionMessageToolCallChunkNormalizer.php b/generated/Normalizer/ChatCompletionMessageToolCallChunkNormalizer.php new file mode 100644 index 0000000..ed56ec9 --- /dev/null +++ b/generated/Normalizer/ChatCompletionMessageToolCallChunkNormalizer.php @@ -0,0 +1,106 @@ +setIndex($data['index']); + unset($data['index']); + } + if (\array_key_exists('id', $data)) { + $object->setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } + if (\array_key_exists('function', $data)) { + $object->setFunction($this->denormalizer->denormalize($data['function'], ChatCompletionMessageToolCallChunkFunction::class, 'json', $context)); + unset($data['function']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['index'] = $object->getIndex(); + if ($object->isInitialized('id') && $object->getId() !== null) { + $data['id'] = $object->getId(); + } + if ($object->isInitialized('type') && $object->getType() !== null) { + $data['type'] = $object->getType(); + } + if ($object->isInitialized('function') && $object->getFunction() !== null) { + $data['function'] = $this->normalizer->normalize($object->getFunction(), 'json', $context); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionMessageToolCallChunk::class => false, + ]; + } +} diff --git a/generated/Normalizer/ChatCompletionMessageToolCallFunctionNormalizer.php b/generated/Normalizer/ChatCompletionMessageToolCallFunctionNormalizer.php new file mode 100644 index 0000000..fa1b67d --- /dev/null +++ b/generated/Normalizer/ChatCompletionMessageToolCallFunctionNormalizer.php @@ -0,0 +1,89 @@ +setName($data['name']); + unset($data['name']); + } + if (\array_key_exists('arguments', $data)) { + $object->setArguments($data['arguments']); + unset($data['arguments']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['name'] = $object->getName(); + $data['arguments'] = $object->getArguments(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionMessageToolCallFunction::class => false, + ]; + } +} diff --git a/generated/Normalizer/ChatCompletionMessageToolCallNormalizer.php b/generated/Normalizer/ChatCompletionMessageToolCallNormalizer.php new file mode 100644 index 0000000..157540c --- /dev/null +++ b/generated/Normalizer/ChatCompletionMessageToolCallNormalizer.php @@ -0,0 +1,95 @@ +setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } + if (\array_key_exists('function', $data)) { + $object->setFunction($this->denormalizer->denormalize($data['function'], ChatCompletionMessageToolCallFunction::class, 'json', $context)); + unset($data['function']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['id'] = $object->getId(); + $data['type'] = $object->getType(); + $data['function'] = $this->normalizer->normalize($object->getFunction(), 'json', $context); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionMessageToolCall::class => false, + ]; + } +} diff --git a/generated/Normalizer/ChatCompletionNamedToolChoiceFunctionNormalizer.php b/generated/Normalizer/ChatCompletionNamedToolChoiceFunctionNormalizer.php new file mode 100644 index 0000000..42ee28f --- /dev/null +++ b/generated/Normalizer/ChatCompletionNamedToolChoiceFunctionNormalizer.php @@ -0,0 +1,84 @@ +setName($data['name']); + unset($data['name']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['name'] = $object->getName(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionNamedToolChoiceFunction::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateCompletionResponseUsageNormalizer.php b/generated/Normalizer/ChatCompletionNamedToolChoiceNormalizer.php similarity index 62% rename from generated/Normalizer/CreateCompletionResponseUsageNormalizer.php rename to generated/Normalizer/ChatCompletionNamedToolChoiceNormalizer.php index 604c73d..6042426 100644 --- a/generated/Normalizer/CreateCompletionResponseUsageNormalizer.php +++ b/generated/Normalizer/ChatCompletionNamedToolChoiceNormalizer.php @@ -6,7 +6,8 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; -use Sourceability\OpenAIClient\Generated\Model\CreateCompletionResponseUsage; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionNamedToolChoice; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionNamedToolChoiceFunction; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -16,21 +17,21 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class CreateCompletionResponseUsageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ChatCompletionNamedToolChoiceNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { use DenormalizerAwareTrait; use NormalizerAwareTrait; use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { - return $type === CreateCompletionResponseUsage::class; + return $type === ChatCompletionNamedToolChoice::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { - return is_object($data) && $data::class === CreateCompletionResponseUsage::class; + return is_object($data) && $data::class === ChatCompletionNamedToolChoice::class; } /** @@ -44,21 +45,17 @@ public function denormalize($data, $class, $format = null, array $context = []) if (isset($data['$recursiveRef'])) { return new Reference($data['$recursiveRef'], $context['document-origin']); } - $object = new CreateCompletionResponseUsage(); + $object = new ChatCompletionNamedToolChoice(); if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('prompt_tokens', $data)) { - $object->setPromptTokens($data['prompt_tokens']); - unset($data['prompt_tokens']); + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); } - if (\array_key_exists('completion_tokens', $data)) { - $object->setCompletionTokens($data['completion_tokens']); - unset($data['completion_tokens']); - } - if (\array_key_exists('total_tokens', $data)) { - $object->setTotalTokens($data['total_tokens']); - unset($data['total_tokens']); + if (\array_key_exists('function', $data)) { + $object->setFunction($this->denormalizer->denormalize($data['function'], ChatCompletionNamedToolChoiceFunction::class, 'json', $context)); + unset($data['function']); } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { @@ -74,9 +71,8 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['prompt_tokens'] = $object->getPromptTokens(); - $data['completion_tokens'] = $object->getCompletionTokens(); - $data['total_tokens'] = $object->getTotalTokens(); + $data['type'] = $object->getType(); + $data['function'] = $this->normalizer->normalize($object->getFunction(), 'json', $context); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; @@ -84,4 +80,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionNamedToolChoice::class => false, + ]; + } } diff --git a/generated/Normalizer/ChatCompletionRequestAssistantMessageFunctionCallNormalizer.php b/generated/Normalizer/ChatCompletionRequestAssistantMessageFunctionCallNormalizer.php new file mode 100644 index 0000000..fbd0e92 --- /dev/null +++ b/generated/Normalizer/ChatCompletionRequestAssistantMessageFunctionCallNormalizer.php @@ -0,0 +1,89 @@ +setArguments($data['arguments']); + unset($data['arguments']); + } + if (\array_key_exists('name', $data)) { + $object->setName($data['name']); + unset($data['name']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['arguments'] = $object->getArguments(); + $data['name'] = $object->getName(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionRequestAssistantMessageFunctionCall::class => false, + ]; + } +} diff --git a/generated/Normalizer/ChatCompletionRequestAssistantMessageNormalizer.php b/generated/Normalizer/ChatCompletionRequestAssistantMessageNormalizer.php new file mode 100644 index 0000000..71bdd09 --- /dev/null +++ b/generated/Normalizer/ChatCompletionRequestAssistantMessageNormalizer.php @@ -0,0 +1,124 @@ +setContent($data['content']); + unset($data['content']); + } elseif (\array_key_exists('content', $data) && $data['content'] === null) { + $object->setContent(null); + } + if (\array_key_exists('role', $data)) { + $object->setRole($data['role']); + unset($data['role']); + } + if (\array_key_exists('name', $data)) { + $object->setName($data['name']); + unset($data['name']); + } + if (\array_key_exists('tool_calls', $data)) { + $values = []; + foreach ($data['tool_calls'] as $value) { + $values[] = $this->denormalizer->denormalize($value, ChatCompletionMessageToolCall::class, 'json', $context); + } + $object->setToolCalls($values); + unset($data['tool_calls']); + } + if (\array_key_exists('function_call', $data)) { + $object->setFunctionCall($this->denormalizer->denormalize($data['function_call'], ChatCompletionRequestAssistantMessageFunctionCall::class, 'json', $context)); + unset($data['function_call']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('content') && $object->getContent() !== null) { + $data['content'] = $object->getContent(); + } + $data['role'] = $object->getRole(); + if ($object->isInitialized('name') && $object->getName() !== null) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('toolCalls') && $object->getToolCalls() !== null) { + $values = []; + foreach ($object->getToolCalls() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['tool_calls'] = $values; + } + if ($object->isInitialized('functionCall') && $object->getFunctionCall() !== null) { + $data['function_call'] = $this->normalizer->normalize($object->getFunctionCall(), 'json', $context); + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionRequestAssistantMessage::class => false, + ]; + } +} diff --git a/generated/Normalizer/ChatCompletionRequestFunctionMessageNormalizer.php b/generated/Normalizer/ChatCompletionRequestFunctionMessageNormalizer.php new file mode 100644 index 0000000..9e2cc89 --- /dev/null +++ b/generated/Normalizer/ChatCompletionRequestFunctionMessageNormalizer.php @@ -0,0 +1,96 @@ +setRole($data['role']); + unset($data['role']); + } + if (\array_key_exists('content', $data) && $data['content'] !== null) { + $object->setContent($data['content']); + unset($data['content']); + } elseif (\array_key_exists('content', $data) && $data['content'] === null) { + $object->setContent(null); + } + if (\array_key_exists('name', $data)) { + $object->setName($data['name']); + unset($data['name']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['role'] = $object->getRole(); + $data['content'] = $object->getContent(); + $data['name'] = $object->getName(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionRequestFunctionMessage::class => false, + ]; + } +} diff --git a/generated/Normalizer/ChatCompletionRequestMessageContentPartImageImageUrlNormalizer.php b/generated/Normalizer/ChatCompletionRequestMessageContentPartImageImageUrlNormalizer.php new file mode 100644 index 0000000..da3b640 --- /dev/null +++ b/generated/Normalizer/ChatCompletionRequestMessageContentPartImageImageUrlNormalizer.php @@ -0,0 +1,91 @@ +setUrl($data['url']); + unset($data['url']); + } + if (\array_key_exists('detail', $data)) { + $object->setDetail($data['detail']); + unset($data['detail']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['url'] = $object->getUrl(); + if ($object->isInitialized('detail') && $object->getDetail() !== null) { + $data['detail'] = $object->getDetail(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionRequestMessageContentPartImageImageUrl::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateClassificationResponseSelectedExamplesItemNormalizer.php b/generated/Normalizer/ChatCompletionRequestMessageContentPartImageNormalizer.php similarity index 57% rename from generated/Normalizer/CreateClassificationResponseSelectedExamplesItemNormalizer.php rename to generated/Normalizer/ChatCompletionRequestMessageContentPartImageNormalizer.php index 47b71e9..354755f 100644 --- a/generated/Normalizer/CreateClassificationResponseSelectedExamplesItemNormalizer.php +++ b/generated/Normalizer/ChatCompletionRequestMessageContentPartImageNormalizer.php @@ -6,7 +6,8 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; -use Sourceability\OpenAIClient\Generated\Model\CreateClassificationResponseSelectedExamplesItem; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestMessageContentPartImage; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestMessageContentPartImageImageUrl; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -16,21 +17,21 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class CreateClassificationResponseSelectedExamplesItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ChatCompletionRequestMessageContentPartImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { use DenormalizerAwareTrait; use NormalizerAwareTrait; use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { - return $type === CreateClassificationResponseSelectedExamplesItem::class; + return $type === ChatCompletionRequestMessageContentPartImage::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { - return is_object($data) && $data::class === CreateClassificationResponseSelectedExamplesItem::class; + return is_object($data) && $data::class === ChatCompletionRequestMessageContentPartImage::class; } /** @@ -44,21 +45,17 @@ public function denormalize($data, $class, $format = null, array $context = []) if (isset($data['$recursiveRef'])) { return new Reference($data['$recursiveRef'], $context['document-origin']); } - $object = new CreateClassificationResponseSelectedExamplesItem(); + $object = new ChatCompletionRequestMessageContentPartImage(); if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('document', $data)) { - $object->setDocument($data['document']); - unset($data['document']); + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); } - if (\array_key_exists('text', $data)) { - $object->setText($data['text']); - unset($data['text']); - } - if (\array_key_exists('label', $data)) { - $object->setLabel($data['label']); - unset($data['label']); + if (\array_key_exists('image_url', $data)) { + $object->setImageUrl($this->denormalizer->denormalize($data['image_url'], ChatCompletionRequestMessageContentPartImageImageUrl::class, 'json', $context)); + unset($data['image_url']); } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { @@ -74,15 +71,8 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - if ($object->isInitialized('document') && $object->getDocument() !== null) { - $data['document'] = $object->getDocument(); - } - if ($object->isInitialized('text') && $object->getText() !== null) { - $data['text'] = $object->getText(); - } - if ($object->isInitialized('label') && $object->getLabel() !== null) { - $data['label'] = $object->getLabel(); - } + $data['type'] = $object->getType(); + $data['image_url'] = $this->normalizer->normalize($object->getImageUrl(), 'json', $context); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; @@ -90,4 +80,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionRequestMessageContentPartImage::class => false, + ]; + } } diff --git a/generated/Normalizer/ChatCompletionRequestMessageContentPartTextNormalizer.php b/generated/Normalizer/ChatCompletionRequestMessageContentPartTextNormalizer.php new file mode 100644 index 0000000..38c2f73 --- /dev/null +++ b/generated/Normalizer/ChatCompletionRequestMessageContentPartTextNormalizer.php @@ -0,0 +1,89 @@ +setType($data['type']); + unset($data['type']); + } + if (\array_key_exists('text', $data)) { + $object->setText($data['text']); + unset($data['text']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['type'] = $object->getType(); + $data['text'] = $object->getText(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionRequestMessageContentPartText::class => false, + ]; + } +} diff --git a/generated/Normalizer/ChatCompletionRequestMessageNormalizer.php b/generated/Normalizer/ChatCompletionRequestSystemMessageNormalizer.php similarity index 70% rename from generated/Normalizer/ChatCompletionRequestMessageNormalizer.php rename to generated/Normalizer/ChatCompletionRequestSystemMessageNormalizer.php index 101f526..6911393 100644 --- a/generated/Normalizer/ChatCompletionRequestMessageNormalizer.php +++ b/generated/Normalizer/ChatCompletionRequestSystemMessageNormalizer.php @@ -6,8 +6,7 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; -use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestMessage; -use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestMessageFunctionCall; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestSystemMessage; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -17,21 +16,21 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ChatCompletionRequestMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ChatCompletionRequestSystemMessageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { use DenormalizerAwareTrait; use NormalizerAwareTrait; use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { - return $type === ChatCompletionRequestMessage::class; + return $type === ChatCompletionRequestSystemMessage::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { - return is_object($data) && $data::class === ChatCompletionRequestMessage::class; + return is_object($data) && $data::class === ChatCompletionRequestSystemMessage::class; } /** @@ -45,26 +44,22 @@ public function denormalize($data, $class, $format = null, array $context = []) if (isset($data['$recursiveRef'])) { return new Reference($data['$recursiveRef'], $context['document-origin']); } - $object = new ChatCompletionRequestMessage(); + $object = new ChatCompletionRequestSystemMessage(); if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('role', $data)) { - $object->setRole($data['role']); - unset($data['role']); - } if (\array_key_exists('content', $data)) { $object->setContent($data['content']); unset($data['content']); } + if (\array_key_exists('role', $data)) { + $object->setRole($data['role']); + unset($data['role']); + } if (\array_key_exists('name', $data)) { $object->setName($data['name']); unset($data['name']); } - if (\array_key_exists('function_call', $data)) { - $object->setFunctionCall($this->denormalizer->denormalize($data['function_call'], ChatCompletionRequestMessageFunctionCall::class, 'json', $context)); - unset($data['function_call']); - } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -79,16 +74,11 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; + $data['content'] = $object->getContent(); $data['role'] = $object->getRole(); - if ($object->isInitialized('content') && $object->getContent() !== null) { - $data['content'] = $object->getContent(); - } if ($object->isInitialized('name') && $object->getName() !== null) { $data['name'] = $object->getName(); } - if ($object->isInitialized('functionCall') && $object->getFunctionCall() !== null) { - $data['function_call'] = $this->normalizer->normalize($object->getFunctionCall(), 'json', $context); - } foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; @@ -96,4 +86,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionRequestSystemMessage::class => false, + ]; + } } diff --git a/generated/Normalizer/ChatCompletionRequestToolMessageNormalizer.php b/generated/Normalizer/ChatCompletionRequestToolMessageNormalizer.php new file mode 100644 index 0000000..558bcc7 --- /dev/null +++ b/generated/Normalizer/ChatCompletionRequestToolMessageNormalizer.php @@ -0,0 +1,94 @@ +setRole($data['role']); + unset($data['role']); + } + if (\array_key_exists('content', $data)) { + $object->setContent($data['content']); + unset($data['content']); + } + if (\array_key_exists('tool_call_id', $data)) { + $object->setToolCallId($data['tool_call_id']); + unset($data['tool_call_id']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['role'] = $object->getRole(); + $data['content'] = $object->getContent(); + $data['tool_call_id'] = $object->getToolCallId(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionRequestToolMessage::class => false, + ]; + } +} diff --git a/generated/Normalizer/ChatCompletionRequestUserMessageNormalizer.php b/generated/Normalizer/ChatCompletionRequestUserMessageNormalizer.php new file mode 100644 index 0000000..d672299 --- /dev/null +++ b/generated/Normalizer/ChatCompletionRequestUserMessageNormalizer.php @@ -0,0 +1,96 @@ +setContent($data['content']); + unset($data['content']); + } + if (\array_key_exists('role', $data)) { + $object->setRole($data['role']); + unset($data['role']); + } + if (\array_key_exists('name', $data)) { + $object->setName($data['name']); + unset($data['name']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['content'] = $object->getContent(); + $data['role'] = $object->getRole(); + if ($object->isInitialized('name') && $object->getName() !== null) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionRequestUserMessage::class => false, + ]; + } +} diff --git a/generated/Normalizer/ChatCompletionResponseMessageFunctionCallNormalizer.php b/generated/Normalizer/ChatCompletionResponseMessageFunctionCallNormalizer.php index b4b4c77..b2ed55f 100644 --- a/generated/Normalizer/ChatCompletionResponseMessageFunctionCallNormalizer.php +++ b/generated/Normalizer/ChatCompletionResponseMessageFunctionCallNormalizer.php @@ -23,12 +23,12 @@ class ChatCompletionResponseMessageFunctionCallNormalizer implements Denormalize use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === ChatCompletionResponseMessageFunctionCall::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === ChatCompletionResponseMessageFunctionCall::class; } @@ -48,14 +48,14 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('name', $data)) { - $object->setName($data['name']); - unset($data['name']); - } if (\array_key_exists('arguments', $data)) { $object->setArguments($data['arguments']); unset($data['arguments']); } + if (\array_key_exists('name', $data)) { + $object->setName($data['name']); + unset($data['name']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -70,12 +70,8 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - if ($object->isInitialized('name') && $object->getName() !== null) { - $data['name'] = $object->getName(); - } - if ($object->isInitialized('arguments') && $object->getArguments() !== null) { - $data['arguments'] = $object->getArguments(); - } + $data['arguments'] = $object->getArguments(); + $data['name'] = $object->getName(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; @@ -83,4 +79,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionResponseMessageFunctionCall::class => false, + ]; + } } diff --git a/generated/Normalizer/ChatCompletionResponseMessageNormalizer.php b/generated/Normalizer/ChatCompletionResponseMessageNormalizer.php index 9b28483..aeb9462 100644 --- a/generated/Normalizer/ChatCompletionResponseMessageNormalizer.php +++ b/generated/Normalizer/ChatCompletionResponseMessageNormalizer.php @@ -6,6 +6,7 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionMessageToolCall; use Sourceability\OpenAIClient\Generated\Model\ChatCompletionResponseMessage; use Sourceability\OpenAIClient\Generated\Model\ChatCompletionResponseMessageFunctionCall; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; @@ -24,12 +25,12 @@ class ChatCompletionResponseMessageNormalizer implements DenormalizerInterface, use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === ChatCompletionResponseMessage::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === ChatCompletionResponseMessage::class; } @@ -49,25 +50,31 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('role', $data)) { - $object->setRole($data['role']); - unset($data['role']); - } if (\array_key_exists('content', $data) && $data['content'] !== null) { $object->setContent($data['content']); unset($data['content']); } elseif (\array_key_exists('content', $data) && $data['content'] === null) { $object->setContent(null); } - if (\array_key_exists('function_call', $data) && $data['function_call'] !== null) { + if (\array_key_exists('tool_calls', $data)) { + $values = []; + foreach ($data['tool_calls'] as $value) { + $values[] = $this->denormalizer->denormalize($value, ChatCompletionMessageToolCall::class, 'json', $context); + } + $object->setToolCalls($values); + unset($data['tool_calls']); + } + if (\array_key_exists('role', $data)) { + $object->setRole($data['role']); + unset($data['role']); + } + if (\array_key_exists('function_call', $data)) { $object->setFunctionCall($this->denormalizer->denormalize($data['function_call'], ChatCompletionResponseMessageFunctionCall::class, 'json', $context)); unset($data['function_call']); - } elseif (\array_key_exists('function_call', $data) && $data['function_call'] === null) { - $object->setFunctionCall(null); } - foreach ($data as $key => $value) { + foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + $object[$key] = $value_1; } } return $object; @@ -79,18 +86,30 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['role'] = $object->getRole(); - if ($object->isInitialized('content') && $object->getContent() !== null) { - $data['content'] = $object->getContent(); + $data['content'] = $object->getContent(); + if ($object->isInitialized('toolCalls') && $object->getToolCalls() !== null) { + $values = []; + foreach ($object->getToolCalls() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['tool_calls'] = $values; } + $data['role'] = $object->getRole(); if ($object->isInitialized('functionCall') && $object->getFunctionCall() !== null) { $data['function_call'] = $this->normalizer->normalize($object->getFunctionCall(), 'json', $context); } - foreach ($object as $key => $value) { + foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + $data[$key] = $value_1; } } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionResponseMessage::class => false, + ]; + } } diff --git a/generated/Normalizer/ChatCompletionStreamResponseDeltaFunctionCallNormalizer.php b/generated/Normalizer/ChatCompletionStreamResponseDeltaFunctionCallNormalizer.php new file mode 100644 index 0000000..f019ca4 --- /dev/null +++ b/generated/Normalizer/ChatCompletionStreamResponseDeltaFunctionCallNormalizer.php @@ -0,0 +1,93 @@ +setArguments($data['arguments']); + unset($data['arguments']); + } + if (\array_key_exists('name', $data)) { + $object->setName($data['name']); + unset($data['name']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('arguments') && $object->getArguments() !== null) { + $data['arguments'] = $object->getArguments(); + } + if ($object->isInitialized('name') && $object->getName() !== null) { + $data['name'] = $object->getName(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionStreamResponseDeltaFunctionCall::class => false, + ]; + } +} diff --git a/generated/Normalizer/ChatCompletionStreamResponseDeltaNormalizer.php b/generated/Normalizer/ChatCompletionStreamResponseDeltaNormalizer.php new file mode 100644 index 0000000..9fa75ae --- /dev/null +++ b/generated/Normalizer/ChatCompletionStreamResponseDeltaNormalizer.php @@ -0,0 +1,119 @@ +setContent($data['content']); + unset($data['content']); + } elseif (\array_key_exists('content', $data) && $data['content'] === null) { + $object->setContent(null); + } + if (\array_key_exists('function_call', $data)) { + $object->setFunctionCall($this->denormalizer->denormalize($data['function_call'], ChatCompletionStreamResponseDeltaFunctionCall::class, 'json', $context)); + unset($data['function_call']); + } + if (\array_key_exists('tool_calls', $data)) { + $values = []; + foreach ($data['tool_calls'] as $value) { + $values[] = $this->denormalizer->denormalize($value, ChatCompletionMessageToolCallChunk::class, 'json', $context); + } + $object->setToolCalls($values); + unset($data['tool_calls']); + } + if (\array_key_exists('role', $data)) { + $object->setRole($data['role']); + unset($data['role']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('content') && $object->getContent() !== null) { + $data['content'] = $object->getContent(); + } + if ($object->isInitialized('functionCall') && $object->getFunctionCall() !== null) { + $data['function_call'] = $this->normalizer->normalize($object->getFunctionCall(), 'json', $context); + } + if ($object->isInitialized('toolCalls') && $object->getToolCalls() !== null) { + $values = []; + foreach ($object->getToolCalls() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['tool_calls'] = $values; + } + if ($object->isInitialized('role') && $object->getRole() !== null) { + $data['role'] = $object->getRole(); + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionStreamResponseDelta::class => false, + ]; + } +} diff --git a/generated/Normalizer/ChatCompletionTokenLogprobNormalizer.php b/generated/Normalizer/ChatCompletionTokenLogprobNormalizer.php new file mode 100644 index 0000000..1f7c6c0 --- /dev/null +++ b/generated/Normalizer/ChatCompletionTokenLogprobNormalizer.php @@ -0,0 +1,121 @@ +setToken($data['token']); + unset($data['token']); + } + if (\array_key_exists('logprob', $data)) { + $object->setLogprob($data['logprob']); + unset($data['logprob']); + } + if (\array_key_exists('bytes', $data) && $data['bytes'] !== null) { + $values = []; + foreach ($data['bytes'] as $value) { + $values[] = $value; + } + $object->setBytes($values); + unset($data['bytes']); + } elseif (\array_key_exists('bytes', $data) && $data['bytes'] === null) { + $object->setBytes(null); + } + if (\array_key_exists('top_logprobs', $data)) { + $values_1 = []; + foreach ($data['top_logprobs'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, ChatCompletionTokenLogprobTopLogprobsItem::class, 'json', $context); + } + $object->setTopLogprobs($values_1); + unset($data['top_logprobs']); + } + foreach ($data as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_2; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['token'] = $object->getToken(); + $data['logprob'] = $object->getLogprob(); + $values = []; + foreach ($object->getBytes() as $value) { + $values[] = $value; + } + $data['bytes'] = $values; + $values_1 = []; + foreach ($object->getTopLogprobs() as $value_1) { + $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); + } + $data['top_logprobs'] = $values_1; + foreach ($object as $key => $value_2) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_2; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionTokenLogprob::class => false, + ]; + } +} diff --git a/generated/Normalizer/ChatCompletionTokenLogprobTopLogprobsItemNormalizer.php b/generated/Normalizer/ChatCompletionTokenLogprobTopLogprobsItemNormalizer.php new file mode 100644 index 0000000..f39614f --- /dev/null +++ b/generated/Normalizer/ChatCompletionTokenLogprobTopLogprobsItemNormalizer.php @@ -0,0 +1,107 @@ +setToken($data['token']); + unset($data['token']); + } + if (\array_key_exists('logprob', $data)) { + $object->setLogprob($data['logprob']); + unset($data['logprob']); + } + if (\array_key_exists('bytes', $data) && $data['bytes'] !== null) { + $values = []; + foreach ($data['bytes'] as $value) { + $values[] = $value; + } + $object->setBytes($values); + unset($data['bytes']); + } elseif (\array_key_exists('bytes', $data) && $data['bytes'] === null) { + $object->setBytes(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['token'] = $object->getToken(); + $data['logprob'] = $object->getLogprob(); + $values = []; + foreach ($object->getBytes() as $value) { + $values[] = $value; + } + $data['bytes'] = $values; + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionTokenLogprobTopLogprobsItem::class => false, + ]; + } +} diff --git a/generated/Normalizer/ChatCompletionToolNormalizer.php b/generated/Normalizer/ChatCompletionToolNormalizer.php new file mode 100644 index 0000000..f322eac --- /dev/null +++ b/generated/Normalizer/ChatCompletionToolNormalizer.php @@ -0,0 +1,90 @@ +setType($data['type']); + unset($data['type']); + } + if (\array_key_exists('function', $data)) { + $object->setFunction($this->denormalizer->denormalize($data['function'], FunctionObject::class, 'json', $context)); + unset($data['function']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['type'] = $object->getType(); + $data['function'] = $this->normalizer->normalize($object->getFunction(), 'json', $context); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ChatCompletionTool::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateEditResponseUsageNormalizer.php b/generated/Normalizer/CompletionUsageNormalizer.php similarity index 80% rename from generated/Normalizer/CreateEditResponseUsageNormalizer.php rename to generated/Normalizer/CompletionUsageNormalizer.php index 0454454..b1124a8 100644 --- a/generated/Normalizer/CreateEditResponseUsageNormalizer.php +++ b/generated/Normalizer/CompletionUsageNormalizer.php @@ -6,7 +6,7 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; -use Sourceability\OpenAIClient\Generated\Model\CreateEditResponseUsage; +use Sourceability\OpenAIClient\Generated\Model\CompletionUsage; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -16,21 +16,21 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class CreateEditResponseUsageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CompletionUsageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { use DenormalizerAwareTrait; use NormalizerAwareTrait; use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { - return $type === CreateEditResponseUsage::class; + return $type === CompletionUsage::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { - return is_object($data) && $data::class === CreateEditResponseUsage::class; + return is_object($data) && $data::class === CompletionUsage::class; } /** @@ -44,18 +44,18 @@ public function denormalize($data, $class, $format = null, array $context = []) if (isset($data['$recursiveRef'])) { return new Reference($data['$recursiveRef'], $context['document-origin']); } - $object = new CreateEditResponseUsage(); + $object = new CompletionUsage(); if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('prompt_tokens', $data)) { - $object->setPromptTokens($data['prompt_tokens']); - unset($data['prompt_tokens']); - } if (\array_key_exists('completion_tokens', $data)) { $object->setCompletionTokens($data['completion_tokens']); unset($data['completion_tokens']); } + if (\array_key_exists('prompt_tokens', $data)) { + $object->setPromptTokens($data['prompt_tokens']); + unset($data['prompt_tokens']); + } if (\array_key_exists('total_tokens', $data)) { $object->setTotalTokens($data['total_tokens']); unset($data['total_tokens']); @@ -74,8 +74,8 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['prompt_tokens'] = $object->getPromptTokens(); $data['completion_tokens'] = $object->getCompletionTokens(); + $data['prompt_tokens'] = $object->getPromptTokens(); $data['total_tokens'] = $object->getTotalTokens(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { @@ -84,4 +84,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CompletionUsage::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateAnswerRequestNormalizer.php b/generated/Normalizer/CreateAnswerRequestNormalizer.php deleted file mode 100644 index 56160e3..0000000 --- a/generated/Normalizer/CreateAnswerRequestNormalizer.php +++ /dev/null @@ -1,231 +0,0 @@ -setModel($data['model']); - } - if (\array_key_exists('question', $data)) { - $object->setQuestion($data['question']); - } - if (\array_key_exists('examples', $data)) { - $values = []; - foreach ($data['examples'] as $value) { - $values_1 = []; - foreach ($value as $value_1) { - $values_1[] = $value_1; - } - $values[] = $values_1; - } - $object->setExamples($values); - } - if (\array_key_exists('examples_context', $data)) { - $object->setExamplesContext($data['examples_context']); - } - if (\array_key_exists('documents', $data) && $data['documents'] !== null) { - $values_2 = []; - foreach ($data['documents'] as $value_2) { - $values_2[] = $value_2; - } - $object->setDocuments($values_2); - } elseif (\array_key_exists('documents', $data) && $data['documents'] === null) { - $object->setDocuments(null); - } - if (\array_key_exists('file', $data) && $data['file'] !== null) { - $object->setFile($data['file']); - } elseif (\array_key_exists('file', $data) && $data['file'] === null) { - $object->setFile(null); - } - if (\array_key_exists('search_model', $data) && $data['search_model'] !== null) { - $object->setSearchModel($data['search_model']); - } elseif (\array_key_exists('search_model', $data) && $data['search_model'] === null) { - $object->setSearchModel(null); - } - if (\array_key_exists('max_rerank', $data) && $data['max_rerank'] !== null) { - $object->setMaxRerank($data['max_rerank']); - } elseif (\array_key_exists('max_rerank', $data) && $data['max_rerank'] === null) { - $object->setMaxRerank(null); - } - if (\array_key_exists('temperature', $data) && $data['temperature'] !== null) { - $object->setTemperature($data['temperature']); - } elseif (\array_key_exists('temperature', $data) && $data['temperature'] === null) { - $object->setTemperature(null); - } - if (\array_key_exists('logprobs', $data) && $data['logprobs'] !== null) { - $object->setLogprobs($data['logprobs']); - } elseif (\array_key_exists('logprobs', $data) && $data['logprobs'] === null) { - $object->setLogprobs(null); - } - if (\array_key_exists('max_tokens', $data) && $data['max_tokens'] !== null) { - $object->setMaxTokens($data['max_tokens']); - } elseif (\array_key_exists('max_tokens', $data) && $data['max_tokens'] === null) { - $object->setMaxTokens(null); - } - if (\array_key_exists('stop', $data) && $data['stop'] !== null) { - $object->setStop($data['stop']); - } elseif (\array_key_exists('stop', $data) && $data['stop'] === null) { - $object->setStop(null); - } - if (\array_key_exists('n', $data) && $data['n'] !== null) { - $object->setN($data['n']); - } elseif (\array_key_exists('n', $data) && $data['n'] === null) { - $object->setN(null); - } - if (\array_key_exists('logit_bias', $data) && $data['logit_bias'] !== null) { - $values_3 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - foreach ($data['logit_bias'] as $key => $value_3) { - $values_3[$key] = $value_3; - } - $object->setLogitBias($values_3); - } elseif (\array_key_exists('logit_bias', $data) && $data['logit_bias'] === null) { - $object->setLogitBias(null); - } - if (\array_key_exists('return_metadata', $data) && $data['return_metadata'] !== null) { - $object->setReturnMetadata($data['return_metadata']); - } elseif (\array_key_exists('return_metadata', $data) && $data['return_metadata'] === null) { - $object->setReturnMetadata(null); - } - if (\array_key_exists('return_prompt', $data) && $data['return_prompt'] !== null) { - $object->setReturnPrompt($data['return_prompt']); - } elseif (\array_key_exists('return_prompt', $data) && $data['return_prompt'] === null) { - $object->setReturnPrompt(null); - } - if (\array_key_exists('expand', $data) && $data['expand'] !== null) { - $values_4 = []; - foreach ($data['expand'] as $value_4) { - $values_4[] = $value_4; - } - $object->setExpand($values_4); - } elseif (\array_key_exists('expand', $data) && $data['expand'] === null) { - $object->setExpand(null); - } - if (\array_key_exists('user', $data)) { - $object->setUser($data['user']); - } - return $object; - } - - /** - * @return array{model: mixed, question: mixed, examples: array, examples_context: mixed, documents?: mixed[], file?: mixed, search_model?: mixed, max_rerank?: mixed, temperature?: mixed, logprobs?: mixed, max_tokens?: mixed, stop?: mixed, n?: mixed, logit_bias?: array, return_metadata?: mixed, return_prompt?: mixed, expand?: mixed[], user?: mixed} - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['model'] = $object->getModel(); - $data['question'] = $object->getQuestion(); - $values = []; - foreach ($object->getExamples() as $value) { - $values_1 = []; - foreach ($value as $value_1) { - $values_1[] = $value_1; - } - $values[] = $values_1; - } - $data['examples'] = $values; - $data['examples_context'] = $object->getExamplesContext(); - if ($object->isInitialized('documents') && $object->getDocuments() !== null) { - $values_2 = []; - foreach ($object->getDocuments() as $value_2) { - $values_2[] = $value_2; - } - $data['documents'] = $values_2; - } - if ($object->isInitialized('file') && $object->getFile() !== null) { - $data['file'] = $object->getFile(); - } - if ($object->isInitialized('searchModel') && $object->getSearchModel() !== null) { - $data['search_model'] = $object->getSearchModel(); - } - if ($object->isInitialized('maxRerank') && $object->getMaxRerank() !== null) { - $data['max_rerank'] = $object->getMaxRerank(); - } - if ($object->isInitialized('temperature') && $object->getTemperature() !== null) { - $data['temperature'] = $object->getTemperature(); - } - if ($object->isInitialized('logprobs') && $object->getLogprobs() !== null) { - $data['logprobs'] = $object->getLogprobs(); - } - if ($object->isInitialized('maxTokens') && $object->getMaxTokens() !== null) { - $data['max_tokens'] = $object->getMaxTokens(); - } - if ($object->isInitialized('stop') && $object->getStop() !== null) { - $data['stop'] = $object->getStop(); - } - if ($object->isInitialized('n') && $object->getN() !== null) { - $data['n'] = $object->getN(); - } - if ($object->isInitialized('logitBias') && $object->getLogitBias() !== null) { - $values_3 = []; - foreach ($object->getLogitBias() as $key => $value_3) { - $values_3[$key] = $value_3; - } - $data['logit_bias'] = $values_3; - } - if ($object->isInitialized('returnMetadata') && $object->getReturnMetadata() !== null) { - $data['return_metadata'] = $object->getReturnMetadata(); - } - if ($object->isInitialized('returnPrompt') && $object->getReturnPrompt() !== null) { - $data['return_prompt'] = $object->getReturnPrompt(); - } - if ($object->isInitialized('expand') && $object->getExpand() !== null) { - $values_4 = []; - foreach ($object->getExpand() as $value_4) { - $values_4[] = $value_4; - } - $data['expand'] = $values_4; - } - if ($object->isInitialized('user') && $object->getUser() !== null) { - $data['user'] = $object->getUser(); - } - return $data; - } -} diff --git a/generated/Normalizer/CreateAnswerResponseNormalizer.php b/generated/Normalizer/CreateAnswerResponseNormalizer.php deleted file mode 100644 index 8eeac43..0000000 --- a/generated/Normalizer/CreateAnswerResponseNormalizer.php +++ /dev/null @@ -1,131 +0,0 @@ -setObject($data['object']); - unset($data['object']); - } - if (\array_key_exists('model', $data)) { - $object->setModel($data['model']); - unset($data['model']); - } - if (\array_key_exists('search_model', $data)) { - $object->setSearchModel($data['search_model']); - unset($data['search_model']); - } - if (\array_key_exists('completion', $data)) { - $object->setCompletion($data['completion']); - unset($data['completion']); - } - if (\array_key_exists('answers', $data)) { - $values = []; - foreach ($data['answers'] as $value) { - $values[] = $value; - } - $object->setAnswers($values); - unset($data['answers']); - } - if (\array_key_exists('selected_documents', $data)) { - $values_1 = []; - foreach ($data['selected_documents'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, CreateAnswerResponseSelectedDocumentsItem::class, 'json', $context); - } - $object->setSelectedDocuments($values_1); - unset($data['selected_documents']); - } - foreach ($data as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_2; - } - } - return $object; - } - - /** - * @return array|string|int|float|bool|ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('object') && $object->getObject() !== null) { - $data['object'] = $object->getObject(); - } - if ($object->isInitialized('model') && $object->getModel() !== null) { - $data['model'] = $object->getModel(); - } - if ($object->isInitialized('searchModel') && $object->getSearchModel() !== null) { - $data['search_model'] = $object->getSearchModel(); - } - if ($object->isInitialized('completion') && $object->getCompletion() !== null) { - $data['completion'] = $object->getCompletion(); - } - if ($object->isInitialized('answers') && $object->getAnswers() !== null) { - $values = []; - foreach ($object->getAnswers() as $value) { - $values[] = $value; - } - $data['answers'] = $values; - } - if ($object->isInitialized('selectedDocuments') && $object->getSelectedDocuments() !== null) { - $values_1 = []; - foreach ($object->getSelectedDocuments() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); - } - $data['selected_documents'] = $values_1; - } - foreach ($object as $key => $value_2) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_2; - } - } - return $data; - } -} diff --git a/generated/Normalizer/CreateAssistantFileRequestNormalizer.php b/generated/Normalizer/CreateAssistantFileRequestNormalizer.php new file mode 100644 index 0000000..6bd7a1a --- /dev/null +++ b/generated/Normalizer/CreateAssistantFileRequestNormalizer.php @@ -0,0 +1,73 @@ +setFileId($data['file_id']); + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['file_id'] = $object->getFileId(); + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateAssistantFileRequest::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateAssistantRequestNormalizer.php b/generated/Normalizer/CreateAssistantRequestNormalizer.php new file mode 100644 index 0000000..8db6689 --- /dev/null +++ b/generated/Normalizer/CreateAssistantRequestNormalizer.php @@ -0,0 +1,141 @@ +setModel($data['model']); + } + if (\array_key_exists('name', $data) && $data['name'] !== null) { + $object->setName($data['name']); + } elseif (\array_key_exists('name', $data) && $data['name'] === null) { + $object->setName(null); + } + if (\array_key_exists('description', $data) && $data['description'] !== null) { + $object->setDescription($data['description']); + } elseif (\array_key_exists('description', $data) && $data['description'] === null) { + $object->setDescription(null); + } + if (\array_key_exists('instructions', $data) && $data['instructions'] !== null) { + $object->setInstructions($data['instructions']); + } elseif (\array_key_exists('instructions', $data) && $data['instructions'] === null) { + $object->setInstructions(null); + } + if (\array_key_exists('tools', $data)) { + $values = []; + foreach ($data['tools'] as $value) { + $values[] = $value; + } + $object->setTools($values); + } + if (\array_key_exists('file_ids', $data)) { + $values_1 = []; + foreach ($data['file_ids'] as $value_1) { + $values_1[] = $value_1; + } + $object->setFileIds($values_1); + } + if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { + $values_2 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['metadata'] as $key => $value_2) { + $values_2[$key] = $value_2; + } + $object->setMetadata($values_2); + } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { + $object->setMetadata(null); + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['model'] = $object->getModel(); + if ($object->isInitialized('name') && $object->getName() !== null) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('description') && $object->getDescription() !== null) { + $data['description'] = $object->getDescription(); + } + if ($object->isInitialized('instructions') && $object->getInstructions() !== null) { + $data['instructions'] = $object->getInstructions(); + } + if ($object->isInitialized('tools') && $object->getTools() !== null) { + $values = []; + foreach ($object->getTools() as $value) { + $values[] = $value; + } + $data['tools'] = $values; + } + if ($object->isInitialized('fileIds') && $object->getFileIds() !== null) { + $values_1 = []; + foreach ($object->getFileIds() as $value_1) { + $values_1[] = $value_1; + } + $data['file_ids'] = $values_1; + } + if ($object->isInitialized('metadata') && $object->getMetadata() !== null) { + $values_2 = []; + foreach ($object->getMetadata() as $key => $value_2) { + $values_2[$key] = $value_2; + } + $data['metadata'] = $values_2; + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateAssistantRequest::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateChatCompletionFunctionResponseChoicesItemNormalizer.php b/generated/Normalizer/CreateChatCompletionFunctionResponseChoicesItemNormalizer.php new file mode 100644 index 0000000..e57bbb6 --- /dev/null +++ b/generated/Normalizer/CreateChatCompletionFunctionResponseChoicesItemNormalizer.php @@ -0,0 +1,95 @@ +setFinishReason($data['finish_reason']); + unset($data['finish_reason']); + } + if (\array_key_exists('index', $data)) { + $object->setIndex($data['index']); + unset($data['index']); + } + if (\array_key_exists('message', $data)) { + $object->setMessage($this->denormalizer->denormalize($data['message'], ChatCompletionResponseMessage::class, 'json', $context)); + unset($data['message']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['finish_reason'] = $object->getFinishReason(); + $data['index'] = $object->getIndex(); + $data['message'] = $this->normalizer->normalize($object->getMessage(), 'json', $context); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateChatCompletionFunctionResponseChoicesItem::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateChatCompletionFunctionResponseNormalizer.php b/generated/Normalizer/CreateChatCompletionFunctionResponseNormalizer.php new file mode 100644 index 0000000..db8f68a --- /dev/null +++ b/generated/Normalizer/CreateChatCompletionFunctionResponseNormalizer.php @@ -0,0 +1,128 @@ +setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('choices', $data)) { + $values = []; + foreach ($data['choices'] as $value) { + $values[] = $this->denormalizer->denormalize($value, CreateChatCompletionFunctionResponseChoicesItem::class, 'json', $context); + } + $object->setChoices($values); + unset($data['choices']); + } + if (\array_key_exists('created', $data)) { + $object->setCreated($data['created']); + unset($data['created']); + } + if (\array_key_exists('model', $data)) { + $object->setModel($data['model']); + unset($data['model']); + } + if (\array_key_exists('system_fingerprint', $data)) { + $object->setSystemFingerprint($data['system_fingerprint']); + unset($data['system_fingerprint']); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } + if (\array_key_exists('usage', $data)) { + $object->setUsage($this->denormalizer->denormalize($data['usage'], CompletionUsage::class, 'json', $context)); + unset($data['usage']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['id'] = $object->getId(); + $values = []; + foreach ($object->getChoices() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['choices'] = $values; + $data['created'] = $object->getCreated(); + $data['model'] = $object->getModel(); + if ($object->isInitialized('systemFingerprint') && $object->getSystemFingerprint() !== null) { + $data['system_fingerprint'] = $object->getSystemFingerprint(); + } + $data['object'] = $object->getObject(); + if ($object->isInitialized('usage') && $object->getUsage() !== null) { + $data['usage'] = $this->normalizer->normalize($object->getUsage(), 'json', $context); + } + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateChatCompletionFunctionResponse::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateChatCompletionRequestNormalizer.php b/generated/Normalizer/CreateChatCompletionRequestNormalizer.php index 0748b91..b985268 100644 --- a/generated/Normalizer/CreateChatCompletionRequestNormalizer.php +++ b/generated/Normalizer/CreateChatCompletionRequestNormalizer.php @@ -7,8 +7,9 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; use Sourceability\OpenAIClient\Generated\Model\ChatCompletionFunctions; -use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestMessage; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionTool; use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionRequest; +use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionRequestResponseFormat; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -25,12 +26,12 @@ class CreateChatCompletionRequestNormalizer implements DenormalizerInterface, No use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateChatCompletionRequest::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateChatCompletionRequest::class; } @@ -47,56 +48,66 @@ public function denormalize($data, $class, $format = null, array $context = []) return new Reference($data['$recursiveRef'], $context['document-origin']); } $object = new CreateChatCompletionRequest(); + if (\array_key_exists('frequency_penalty', $data) && \is_int($data['frequency_penalty'])) { + $data['frequency_penalty'] = (float) $data['frequency_penalty']; + } + if (\array_key_exists('presence_penalty', $data) && \is_int($data['presence_penalty'])) { + $data['presence_penalty'] = (float) $data['presence_penalty']; + } if (\array_key_exists('temperature', $data) && \is_int($data['temperature'])) { $data['temperature'] = (float) $data['temperature']; } if (\array_key_exists('top_p', $data) && \is_int($data['top_p'])) { $data['top_p'] = (float) $data['top_p']; } - if (\array_key_exists('presence_penalty', $data) && \is_int($data['presence_penalty'])) { - $data['presence_penalty'] = (float) $data['presence_penalty']; - } - if (\array_key_exists('frequency_penalty', $data) && \is_int($data['frequency_penalty'])) { - $data['frequency_penalty'] = (float) $data['frequency_penalty']; - } if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('model', $data)) { - $object->setModel($data['model']); - unset($data['model']); - } if (\array_key_exists('messages', $data)) { $values = []; foreach ($data['messages'] as $value) { - $values[] = $this->denormalizer->denormalize($value, ChatCompletionRequestMessage::class, 'json', $context); + $values[] = $value; } $object->setMessages($values); unset($data['messages']); } - if (\array_key_exists('functions', $data)) { - $values_1 = []; - foreach ($data['functions'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, ChatCompletionFunctions::class, 'json', $context); + if (\array_key_exists('model', $data)) { + $object->setModel($data['model']); + unset($data['model']); + } + if (\array_key_exists('frequency_penalty', $data) && $data['frequency_penalty'] !== null) { + $object->setFrequencyPenalty($data['frequency_penalty']); + unset($data['frequency_penalty']); + } elseif (\array_key_exists('frequency_penalty', $data) && $data['frequency_penalty'] === null) { + $object->setFrequencyPenalty(null); + } + if (\array_key_exists('logit_bias', $data) && $data['logit_bias'] !== null) { + $values_1 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['logit_bias'] as $key => $value_1) { + $values_1[$key] = $value_1; } - $object->setFunctions($values_1); - unset($data['functions']); + $object->setLogitBias($values_1); + unset($data['logit_bias']); + } elseif (\array_key_exists('logit_bias', $data) && $data['logit_bias'] === null) { + $object->setLogitBias(null); } - if (\array_key_exists('function_call', $data)) { - $object->setFunctionCall($data['function_call']); - unset($data['function_call']); + if (\array_key_exists('logprobs', $data) && $data['logprobs'] !== null) { + $object->setLogprobs($data['logprobs']); + unset($data['logprobs']); + } elseif (\array_key_exists('logprobs', $data) && $data['logprobs'] === null) { + $object->setLogprobs(null); } - if (\array_key_exists('temperature', $data) && $data['temperature'] !== null) { - $object->setTemperature($data['temperature']); - unset($data['temperature']); - } elseif (\array_key_exists('temperature', $data) && $data['temperature'] === null) { - $object->setTemperature(null); + if (\array_key_exists('top_logprobs', $data) && $data['top_logprobs'] !== null) { + $object->setTopLogprobs($data['top_logprobs']); + unset($data['top_logprobs']); + } elseif (\array_key_exists('top_logprobs', $data) && $data['top_logprobs'] === null) { + $object->setTopLogprobs(null); } - if (\array_key_exists('top_p', $data) && $data['top_p'] !== null) { - $object->setTopP($data['top_p']); - unset($data['top_p']); - } elseif (\array_key_exists('top_p', $data) && $data['top_p'] === null) { - $object->setTopP(null); + if (\array_key_exists('max_tokens', $data) && $data['max_tokens'] !== null) { + $object->setMaxTokens($data['max_tokens']); + unset($data['max_tokens']); + } elseif (\array_key_exists('max_tokens', $data) && $data['max_tokens'] === null) { + $object->setMaxTokens(null); } if (\array_key_exists('n', $data) && $data['n'] !== null) { $object->setN($data['n']); @@ -104,51 +115,75 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('n', $data) && $data['n'] === null) { $object->setN(null); } - if (\array_key_exists('stream', $data) && $data['stream'] !== null) { - $object->setStream($data['stream']); - unset($data['stream']); - } elseif (\array_key_exists('stream', $data) && $data['stream'] === null) { - $object->setStream(null); + if (\array_key_exists('presence_penalty', $data) && $data['presence_penalty'] !== null) { + $object->setPresencePenalty($data['presence_penalty']); + unset($data['presence_penalty']); + } elseif (\array_key_exists('presence_penalty', $data) && $data['presence_penalty'] === null) { + $object->setPresencePenalty(null); + } + if (\array_key_exists('response_format', $data)) { + $object->setResponseFormat($this->denormalizer->denormalize($data['response_format'], CreateChatCompletionRequestResponseFormat::class, 'json', $context)); + unset($data['response_format']); + } + if (\array_key_exists('seed', $data) && $data['seed'] !== null) { + $object->setSeed($data['seed']); + unset($data['seed']); + } elseif (\array_key_exists('seed', $data) && $data['seed'] === null) { + $object->setSeed(null); } if (\array_key_exists('stop', $data)) { $object->setStop($data['stop']); unset($data['stop']); } - if (\array_key_exists('max_tokens', $data) && $data['max_tokens'] !== null) { - $object->setMaxTokens($data['max_tokens']); - unset($data['max_tokens']); - } elseif (\array_key_exists('max_tokens', $data) && $data['max_tokens'] === null) { - $object->setMaxTokens(null); + if (\array_key_exists('stream', $data) && $data['stream'] !== null) { + $object->setStream($data['stream']); + unset($data['stream']); + } elseif (\array_key_exists('stream', $data) && $data['stream'] === null) { + $object->setStream(null); } - if (\array_key_exists('presence_penalty', $data) && $data['presence_penalty'] !== null) { - $object->setPresencePenalty($data['presence_penalty']); - unset($data['presence_penalty']); - } elseif (\array_key_exists('presence_penalty', $data) && $data['presence_penalty'] === null) { - $object->setPresencePenalty(null); + if (\array_key_exists('temperature', $data) && $data['temperature'] !== null) { + $object->setTemperature($data['temperature']); + unset($data['temperature']); + } elseif (\array_key_exists('temperature', $data) && $data['temperature'] === null) { + $object->setTemperature(null); } - if (\array_key_exists('frequency_penalty', $data) && $data['frequency_penalty'] !== null) { - $object->setFrequencyPenalty($data['frequency_penalty']); - unset($data['frequency_penalty']); - } elseif (\array_key_exists('frequency_penalty', $data) && $data['frequency_penalty'] === null) { - $object->setFrequencyPenalty(null); + if (\array_key_exists('top_p', $data) && $data['top_p'] !== null) { + $object->setTopP($data['top_p']); + unset($data['top_p']); + } elseif (\array_key_exists('top_p', $data) && $data['top_p'] === null) { + $object->setTopP(null); } - if (\array_key_exists('logit_bias', $data) && $data['logit_bias'] !== null) { - $values_2 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - foreach ($data['logit_bias'] as $key => $value_2) { - $values_2[$key] = $value_2; + if (\array_key_exists('tools', $data)) { + $values_2 = []; + foreach ($data['tools'] as $value_2) { + $values_2[] = $this->denormalizer->denormalize($value_2, ChatCompletionTool::class, 'json', $context); } - $object->setLogitBias($values_2); - unset($data['logit_bias']); - } elseif (\array_key_exists('logit_bias', $data) && $data['logit_bias'] === null) { - $object->setLogitBias(null); + $object->setTools($values_2); + unset($data['tools']); + } + if (\array_key_exists('tool_choice', $data)) { + $object->setToolChoice($data['tool_choice']); + unset($data['tool_choice']); } if (\array_key_exists('user', $data)) { $object->setUser($data['user']); unset($data['user']); } - foreach ($data as $key_1 => $value_3) { + if (\array_key_exists('function_call', $data)) { + $object->setFunctionCall($data['function_call']); + unset($data['function_call']); + } + if (\array_key_exists('functions', $data)) { + $values_3 = []; + foreach ($data['functions'] as $value_3) { + $values_3[] = $this->denormalizer->denormalize($value_3, ChatCompletionFunctions::class, 'json', $context); + } + $object->setFunctions($values_3); + unset($data['functions']); + } + foreach ($data as $key_1 => $value_4) { if (preg_match('/.*/', (string) $key_1)) { - $object[$key_1] = $value_3; + $object[$key_1] = $value_4; } } return $object; @@ -160,61 +195,90 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['model'] = $object->getModel(); $values = []; foreach ($object->getMessages() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); + $values[] = $value; } $data['messages'] = $values; - if ($object->isInitialized('functions') && $object->getFunctions() !== null) { + $data['model'] = $object->getModel(); + if ($object->isInitialized('frequencyPenalty') && $object->getFrequencyPenalty() !== null) { + $data['frequency_penalty'] = $object->getFrequencyPenalty(); + } + if ($object->isInitialized('logitBias') && $object->getLogitBias() !== null) { $values_1 = []; - foreach ($object->getFunctions() as $value_1) { - $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); + foreach ($object->getLogitBias() as $key => $value_1) { + $values_1[$key] = $value_1; } - $data['functions'] = $values_1; + $data['logit_bias'] = $values_1; } - if ($object->isInitialized('functionCall') && $object->getFunctionCall() !== null) { - $data['function_call'] = $object->getFunctionCall(); + if ($object->isInitialized('logprobs') && $object->getLogprobs() !== null) { + $data['logprobs'] = $object->getLogprobs(); } - if ($object->isInitialized('temperature') && $object->getTemperature() !== null) { - $data['temperature'] = $object->getTemperature(); + if ($object->isInitialized('topLogprobs') && $object->getTopLogprobs() !== null) { + $data['top_logprobs'] = $object->getTopLogprobs(); } - if ($object->isInitialized('topP') && $object->getTopP() !== null) { - $data['top_p'] = $object->getTopP(); + if ($object->isInitialized('maxTokens') && $object->getMaxTokens() !== null) { + $data['max_tokens'] = $object->getMaxTokens(); } if ($object->isInitialized('n') && $object->getN() !== null) { $data['n'] = $object->getN(); } - if ($object->isInitialized('stream') && $object->getStream() !== null) { - $data['stream'] = $object->getStream(); + if ($object->isInitialized('presencePenalty') && $object->getPresencePenalty() !== null) { + $data['presence_penalty'] = $object->getPresencePenalty(); + } + if ($object->isInitialized('responseFormat') && $object->getResponseFormat() !== null) { + $data['response_format'] = $this->normalizer->normalize($object->getResponseFormat(), 'json', $context); + } + if ($object->isInitialized('seed') && $object->getSeed() !== null) { + $data['seed'] = $object->getSeed(); } if ($object->isInitialized('stop') && $object->getStop() !== null) { $data['stop'] = $object->getStop(); } - if ($object->isInitialized('maxTokens') && $object->getMaxTokens() !== null) { - $data['max_tokens'] = $object->getMaxTokens(); + if ($object->isInitialized('stream') && $object->getStream() !== null) { + $data['stream'] = $object->getStream(); } - if ($object->isInitialized('presencePenalty') && $object->getPresencePenalty() !== null) { - $data['presence_penalty'] = $object->getPresencePenalty(); + if ($object->isInitialized('temperature') && $object->getTemperature() !== null) { + $data['temperature'] = $object->getTemperature(); } - if ($object->isInitialized('frequencyPenalty') && $object->getFrequencyPenalty() !== null) { - $data['frequency_penalty'] = $object->getFrequencyPenalty(); + if ($object->isInitialized('topP') && $object->getTopP() !== null) { + $data['top_p'] = $object->getTopP(); } - if ($object->isInitialized('logitBias') && $object->getLogitBias() !== null) { + if ($object->isInitialized('tools') && $object->getTools() !== null) { $values_2 = []; - foreach ($object->getLogitBias() as $key => $value_2) { - $values_2[$key] = $value_2; + foreach ($object->getTools() as $value_2) { + $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); } - $data['logit_bias'] = $values_2; + $data['tools'] = $values_2; + } + if ($object->isInitialized('toolChoice') && $object->getToolChoice() !== null) { + $data['tool_choice'] = $object->getToolChoice(); } if ($object->isInitialized('user') && $object->getUser() !== null) { $data['user'] = $object->getUser(); } - foreach ($object as $key_1 => $value_3) { + if ($object->isInitialized('functionCall') && $object->getFunctionCall() !== null) { + $data['function_call'] = $object->getFunctionCall(); + } + if ($object->isInitialized('functions') && $object->getFunctions() !== null) { + $values_3 = []; + foreach ($object->getFunctions() as $value_3) { + $values_3[] = $this->normalizer->normalize($value_3, 'json', $context); + } + $data['functions'] = $values_3; + } + foreach ($object as $key_1 => $value_4) { if (preg_match('/.*/', (string) $key_1)) { - $data[$key_1] = $value_3; + $data[$key_1] = $value_4; } } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateChatCompletionRequest::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateAnswerResponseSelectedDocumentsItemNormalizer.php b/generated/Normalizer/CreateChatCompletionRequestResponseFormatNormalizer.php similarity index 67% rename from generated/Normalizer/CreateAnswerResponseSelectedDocumentsItemNormalizer.php rename to generated/Normalizer/CreateChatCompletionRequestResponseFormatNormalizer.php index 5b44d87..669f611 100644 --- a/generated/Normalizer/CreateAnswerResponseSelectedDocumentsItemNormalizer.php +++ b/generated/Normalizer/CreateChatCompletionRequestResponseFormatNormalizer.php @@ -6,7 +6,7 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; -use Sourceability\OpenAIClient\Generated\Model\CreateAnswerResponseSelectedDocumentsItem; +use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionRequestResponseFormat; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -16,21 +16,21 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class CreateAnswerResponseSelectedDocumentsItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class CreateChatCompletionRequestResponseFormatNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { use DenormalizerAwareTrait; use NormalizerAwareTrait; use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { - return $type === CreateAnswerResponseSelectedDocumentsItem::class; + return $type === CreateChatCompletionRequestResponseFormat::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { - return is_object($data) && $data::class === CreateAnswerResponseSelectedDocumentsItem::class; + return is_object($data) && $data::class === CreateChatCompletionRequestResponseFormat::class; } /** @@ -44,17 +44,13 @@ public function denormalize($data, $class, $format = null, array $context = []) if (isset($data['$recursiveRef'])) { return new Reference($data['$recursiveRef'], $context['document-origin']); } - $object = new CreateAnswerResponseSelectedDocumentsItem(); + $object = new CreateChatCompletionRequestResponseFormat(); if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('document', $data)) { - $object->setDocument($data['document']); - unset($data['document']); - } - if (\array_key_exists('text', $data)) { - $object->setText($data['text']); - unset($data['text']); + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { @@ -70,11 +66,8 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - if ($object->isInitialized('document') && $object->getDocument() !== null) { - $data['document'] = $object->getDocument(); - } - if ($object->isInitialized('text') && $object->getText() !== null) { - $data['text'] = $object->getText(); + if ($object->isInitialized('type') && $object->getType() !== null) { + $data['type'] = $object->getType(); } foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { @@ -83,4 +76,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateChatCompletionRequestResponseFormat::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateChatCompletionResponseChoicesItemLogprobsNormalizer.php b/generated/Normalizer/CreateChatCompletionResponseChoicesItemLogprobsNormalizer.php new file mode 100644 index 0000000..f6cc01c --- /dev/null +++ b/generated/Normalizer/CreateChatCompletionResponseChoicesItemLogprobsNormalizer.php @@ -0,0 +1,95 @@ +denormalizer->denormalize($value, ChatCompletionTokenLogprob::class, 'json', $context); + } + $object->setContent($values); + unset($data['content']); + } elseif (\array_key_exists('content', $data) && $data['content'] === null) { + $object->setContent(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getContent() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['content'] = $values; + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateChatCompletionResponseChoicesItemLogprobs::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateChatCompletionResponseChoicesItemNormalizer.php b/generated/Normalizer/CreateChatCompletionResponseChoicesItemNormalizer.php index b58fe22..57333f5 100644 --- a/generated/Normalizer/CreateChatCompletionResponseChoicesItemNormalizer.php +++ b/generated/Normalizer/CreateChatCompletionResponseChoicesItemNormalizer.php @@ -8,6 +8,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use Sourceability\OpenAIClient\Generated\Model\ChatCompletionResponseMessage; use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionResponseChoicesItem; +use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionResponseChoicesItemLogprobs; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -24,12 +25,12 @@ class CreateChatCompletionResponseChoicesItemNormalizer implements DenormalizerI use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateChatCompletionResponseChoicesItem::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateChatCompletionResponseChoicesItem::class; } @@ -49,6 +50,10 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } + if (\array_key_exists('finish_reason', $data)) { + $object->setFinishReason($data['finish_reason']); + unset($data['finish_reason']); + } if (\array_key_exists('index', $data)) { $object->setIndex($data['index']); unset($data['index']); @@ -57,11 +62,11 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setMessage($this->denormalizer->denormalize($data['message'], ChatCompletionResponseMessage::class, 'json', $context)); unset($data['message']); } - if (\array_key_exists('finish_reason', $data) && $data['finish_reason'] !== null) { - $object->setFinishReason($data['finish_reason']); - unset($data['finish_reason']); - } elseif (\array_key_exists('finish_reason', $data) && $data['finish_reason'] === null) { - $object->setFinishReason(null); + if (\array_key_exists('logprobs', $data) && $data['logprobs'] !== null) { + $object->setLogprobs($this->denormalizer->denormalize($data['logprobs'], CreateChatCompletionResponseChoicesItemLogprobs::class, 'json', $context)); + unset($data['logprobs']); + } elseif (\array_key_exists('logprobs', $data) && $data['logprobs'] === null) { + $object->setLogprobs(null); } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { @@ -77,15 +82,10 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - if ($object->isInitialized('index') && $object->getIndex() !== null) { - $data['index'] = $object->getIndex(); - } - if ($object->isInitialized('message') && $object->getMessage() !== null) { - $data['message'] = $this->normalizer->normalize($object->getMessage(), 'json', $context); - } - if ($object->isInitialized('finishReason') && $object->getFinishReason() !== null) { - $data['finish_reason'] = $object->getFinishReason(); - } + $data['finish_reason'] = $object->getFinishReason(); + $data['index'] = $object->getIndex(); + $data['message'] = $this->normalizer->normalize($object->getMessage(), 'json', $context); + $data['logprobs'] = $this->normalizer->normalize($object->getLogprobs(), 'json', $context); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; @@ -93,4 +93,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateChatCompletionResponseChoicesItem::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateChatCompletionResponseNormalizer.php b/generated/Normalizer/CreateChatCompletionResponseNormalizer.php index 1668651..093f329 100644 --- a/generated/Normalizer/CreateChatCompletionResponseNormalizer.php +++ b/generated/Normalizer/CreateChatCompletionResponseNormalizer.php @@ -6,9 +6,9 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; +use Sourceability\OpenAIClient\Generated\Model\CompletionUsage; use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionResponse; use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionResponseChoicesItem; -use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionResponseUsage; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -25,12 +25,12 @@ class CreateChatCompletionResponseNormalizer implements DenormalizerInterface, N use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateChatCompletionResponse::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateChatCompletionResponse::class; } @@ -54,9 +54,13 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); + if (\array_key_exists('choices', $data)) { + $values = []; + foreach ($data['choices'] as $value) { + $values[] = $this->denormalizer->denormalize($value, CreateChatCompletionResponseChoicesItem::class, 'json', $context); + } + $object->setChoices($values); + unset($data['choices']); } if (\array_key_exists('created', $data)) { $object->setCreated($data['created']); @@ -66,16 +70,16 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setModel($data['model']); unset($data['model']); } - if (\array_key_exists('choices', $data)) { - $values = []; - foreach ($data['choices'] as $value) { - $values[] = $this->denormalizer->denormalize($value, CreateChatCompletionResponseChoicesItem::class, 'json', $context); - } - $object->setChoices($values); - unset($data['choices']); + if (\array_key_exists('system_fingerprint', $data)) { + $object->setSystemFingerprint($data['system_fingerprint']); + unset($data['system_fingerprint']); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); } if (\array_key_exists('usage', $data)) { - $object->setUsage($this->denormalizer->denormalize($data['usage'], CreateChatCompletionResponseUsage::class, 'json', $context)); + $object->setUsage($this->denormalizer->denormalize($data['usage'], CompletionUsage::class, 'json', $context)); unset($data['usage']); } foreach ($data as $key => $value_1) { @@ -93,14 +97,17 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['object'] = $object->getObject(); - $data['created'] = $object->getCreated(); - $data['model'] = $object->getModel(); $values = []; foreach ($object->getChoices() as $value) { $values[] = $this->normalizer->normalize($value, 'json', $context); } $data['choices'] = $values; + $data['created'] = $object->getCreated(); + $data['model'] = $object->getModel(); + if ($object->isInitialized('systemFingerprint') && $object->getSystemFingerprint() !== null) { + $data['system_fingerprint'] = $object->getSystemFingerprint(); + } + $data['object'] = $object->getObject(); if ($object->isInitialized('usage') && $object->getUsage() !== null) { $data['usage'] = $this->normalizer->normalize($object->getUsage(), 'json', $context); } @@ -111,4 +118,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateChatCompletionResponse::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateChatCompletionStreamResponseChoicesItemLogprobsNormalizer.php b/generated/Normalizer/CreateChatCompletionStreamResponseChoicesItemLogprobsNormalizer.php new file mode 100644 index 0000000..c6fe4b1 --- /dev/null +++ b/generated/Normalizer/CreateChatCompletionStreamResponseChoicesItemLogprobsNormalizer.php @@ -0,0 +1,95 @@ +denormalizer->denormalize($value, ChatCompletionTokenLogprob::class, 'json', $context); + } + $object->setContent($values); + unset($data['content']); + } elseif (\array_key_exists('content', $data) && $data['content'] === null) { + $object->setContent(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getContent() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['content'] = $values; + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateChatCompletionStreamResponseChoicesItemLogprobs::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateChatCompletionStreamResponseChoicesItemNormalizer.php b/generated/Normalizer/CreateChatCompletionStreamResponseChoicesItemNormalizer.php new file mode 100644 index 0000000..4e481aa --- /dev/null +++ b/generated/Normalizer/CreateChatCompletionStreamResponseChoicesItemNormalizer.php @@ -0,0 +1,107 @@ +setDelta($this->denormalizer->denormalize($data['delta'], ChatCompletionStreamResponseDelta::class, 'json', $context)); + unset($data['delta']); + } + if (\array_key_exists('logprobs', $data) && $data['logprobs'] !== null) { + $object->setLogprobs($this->denormalizer->denormalize($data['logprobs'], CreateChatCompletionStreamResponseChoicesItemLogprobs::class, 'json', $context)); + unset($data['logprobs']); + } elseif (\array_key_exists('logprobs', $data) && $data['logprobs'] === null) { + $object->setLogprobs(null); + } + if (\array_key_exists('finish_reason', $data) && $data['finish_reason'] !== null) { + $object->setFinishReason($data['finish_reason']); + unset($data['finish_reason']); + } elseif (\array_key_exists('finish_reason', $data) && $data['finish_reason'] === null) { + $object->setFinishReason(null); + } + if (\array_key_exists('index', $data)) { + $object->setIndex($data['index']); + unset($data['index']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['delta'] = $this->normalizer->normalize($object->getDelta(), 'json', $context); + if ($object->isInitialized('logprobs') && $object->getLogprobs() !== null) { + $data['logprobs'] = $this->normalizer->normalize($object->getLogprobs(), 'json', $context); + } + $data['finish_reason'] = $object->getFinishReason(); + $data['index'] = $object->getIndex(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateChatCompletionStreamResponseChoicesItem::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateChatCompletionStreamResponseNormalizer.php b/generated/Normalizer/CreateChatCompletionStreamResponseNormalizer.php new file mode 100644 index 0000000..ac364f2 --- /dev/null +++ b/generated/Normalizer/CreateChatCompletionStreamResponseNormalizer.php @@ -0,0 +1,120 @@ +setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('choices', $data)) { + $values = []; + foreach ($data['choices'] as $value) { + $values[] = $this->denormalizer->denormalize($value, CreateChatCompletionStreamResponseChoicesItem::class, 'json', $context); + } + $object->setChoices($values); + unset($data['choices']); + } + if (\array_key_exists('created', $data)) { + $object->setCreated($data['created']); + unset($data['created']); + } + if (\array_key_exists('model', $data)) { + $object->setModel($data['model']); + unset($data['model']); + } + if (\array_key_exists('system_fingerprint', $data)) { + $object->setSystemFingerprint($data['system_fingerprint']); + unset($data['system_fingerprint']); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['id'] = $object->getId(); + $values = []; + foreach ($object->getChoices() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['choices'] = $values; + $data['created'] = $object->getCreated(); + $data['model'] = $object->getModel(); + if ($object->isInitialized('systemFingerprint') && $object->getSystemFingerprint() !== null) { + $data['system_fingerprint'] = $object->getSystemFingerprint(); + } + $data['object'] = $object->getObject(); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateChatCompletionStreamResponse::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateClassificationRequestNormalizer.php b/generated/Normalizer/CreateClassificationRequestNormalizer.php deleted file mode 100644 index 025a813..0000000 --- a/generated/Normalizer/CreateClassificationRequestNormalizer.php +++ /dev/null @@ -1,207 +0,0 @@ -setModel($data['model']); - } - if (\array_key_exists('query', $data)) { - $object->setQuery($data['query']); - } - if (\array_key_exists('examples', $data) && $data['examples'] !== null) { - $values = []; - foreach ($data['examples'] as $value) { - $values_1 = []; - foreach ($value as $value_1) { - $values_1[] = $value_1; - } - $values[] = $values_1; - } - $object->setExamples($values); - } elseif (\array_key_exists('examples', $data) && $data['examples'] === null) { - $object->setExamples(null); - } - if (\array_key_exists('file', $data) && $data['file'] !== null) { - $object->setFile($data['file']); - } elseif (\array_key_exists('file', $data) && $data['file'] === null) { - $object->setFile(null); - } - if (\array_key_exists('labels', $data) && $data['labels'] !== null) { - $values_2 = []; - foreach ($data['labels'] as $value_2) { - $values_2[] = $value_2; - } - $object->setLabels($values_2); - } elseif (\array_key_exists('labels', $data) && $data['labels'] === null) { - $object->setLabels(null); - } - if (\array_key_exists('search_model', $data) && $data['search_model'] !== null) { - $object->setSearchModel($data['search_model']); - } elseif (\array_key_exists('search_model', $data) && $data['search_model'] === null) { - $object->setSearchModel(null); - } - if (\array_key_exists('temperature', $data) && $data['temperature'] !== null) { - $object->setTemperature($data['temperature']); - } elseif (\array_key_exists('temperature', $data) && $data['temperature'] === null) { - $object->setTemperature(null); - } - if (\array_key_exists('logprobs', $data) && $data['logprobs'] !== null) { - $object->setLogprobs($data['logprobs']); - } elseif (\array_key_exists('logprobs', $data) && $data['logprobs'] === null) { - $object->setLogprobs(null); - } - if (\array_key_exists('max_examples', $data) && $data['max_examples'] !== null) { - $object->setMaxExamples($data['max_examples']); - } elseif (\array_key_exists('max_examples', $data) && $data['max_examples'] === null) { - $object->setMaxExamples(null); - } - if (\array_key_exists('logit_bias', $data) && $data['logit_bias'] !== null) { - $values_3 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - foreach ($data['logit_bias'] as $key => $value_3) { - $values_3[$key] = $value_3; - } - $object->setLogitBias($values_3); - } elseif (\array_key_exists('logit_bias', $data) && $data['logit_bias'] === null) { - $object->setLogitBias(null); - } - if (\array_key_exists('return_prompt', $data) && $data['return_prompt'] !== null) { - $object->setReturnPrompt($data['return_prompt']); - } elseif (\array_key_exists('return_prompt', $data) && $data['return_prompt'] === null) { - $object->setReturnPrompt(null); - } - if (\array_key_exists('return_metadata', $data) && $data['return_metadata'] !== null) { - $object->setReturnMetadata($data['return_metadata']); - } elseif (\array_key_exists('return_metadata', $data) && $data['return_metadata'] === null) { - $object->setReturnMetadata(null); - } - if (\array_key_exists('expand', $data) && $data['expand'] !== null) { - $values_4 = []; - foreach ($data['expand'] as $value_4) { - $values_4[] = $value_4; - } - $object->setExpand($values_4); - } elseif (\array_key_exists('expand', $data) && $data['expand'] === null) { - $object->setExpand(null); - } - if (\array_key_exists('user', $data)) { - $object->setUser($data['user']); - } - return $object; - } - - /** - * @return array{model: mixed, query: mixed, examples?: array, file?: mixed, labels?: mixed[], search_model?: mixed, temperature?: mixed, logprobs?: mixed, max_examples?: mixed, logit_bias?: array, return_prompt?: mixed, return_metadata?: mixed, expand?: mixed[], user?: mixed} - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['model'] = $object->getModel(); - $data['query'] = $object->getQuery(); - if ($object->isInitialized('examples') && $object->getExamples() !== null) { - $values = []; - foreach ($object->getExamples() as $value) { - $values_1 = []; - foreach ($value as $value_1) { - $values_1[] = $value_1; - } - $values[] = $values_1; - } - $data['examples'] = $values; - } - if ($object->isInitialized('file') && $object->getFile() !== null) { - $data['file'] = $object->getFile(); - } - if ($object->isInitialized('labels') && $object->getLabels() !== null) { - $values_2 = []; - foreach ($object->getLabels() as $value_2) { - $values_2[] = $value_2; - } - $data['labels'] = $values_2; - } - if ($object->isInitialized('searchModel') && $object->getSearchModel() !== null) { - $data['search_model'] = $object->getSearchModel(); - } - if ($object->isInitialized('temperature') && $object->getTemperature() !== null) { - $data['temperature'] = $object->getTemperature(); - } - if ($object->isInitialized('logprobs') && $object->getLogprobs() !== null) { - $data['logprobs'] = $object->getLogprobs(); - } - if ($object->isInitialized('maxExamples') && $object->getMaxExamples() !== null) { - $data['max_examples'] = $object->getMaxExamples(); - } - if ($object->isInitialized('logitBias') && $object->getLogitBias() !== null) { - $values_3 = []; - foreach ($object->getLogitBias() as $key => $value_3) { - $values_3[$key] = $value_3; - } - $data['logit_bias'] = $values_3; - } - if ($object->isInitialized('returnPrompt') && $object->getReturnPrompt() !== null) { - $data['return_prompt'] = $object->getReturnPrompt(); - } - if ($object->isInitialized('returnMetadata') && $object->getReturnMetadata() !== null) { - $data['return_metadata'] = $object->getReturnMetadata(); - } - if ($object->isInitialized('expand') && $object->getExpand() !== null) { - $values_4 = []; - foreach ($object->getExpand() as $value_4) { - $values_4[] = $value_4; - } - $data['expand'] = $values_4; - } - if ($object->isInitialized('user') && $object->getUser() !== null) { - $data['user'] = $object->getUser(); - } - return $data; - } -} diff --git a/generated/Normalizer/CreateClassificationResponseNormalizer.php b/generated/Normalizer/CreateClassificationResponseNormalizer.php deleted file mode 100644 index d6699c7..0000000 --- a/generated/Normalizer/CreateClassificationResponseNormalizer.php +++ /dev/null @@ -1,123 +0,0 @@ -setObject($data['object']); - unset($data['object']); - } - if (\array_key_exists('model', $data)) { - $object->setModel($data['model']); - unset($data['model']); - } - if (\array_key_exists('search_model', $data)) { - $object->setSearchModel($data['search_model']); - unset($data['search_model']); - } - if (\array_key_exists('completion', $data)) { - $object->setCompletion($data['completion']); - unset($data['completion']); - } - if (\array_key_exists('label', $data)) { - $object->setLabel($data['label']); - unset($data['label']); - } - if (\array_key_exists('selected_examples', $data)) { - $values = []; - foreach ($data['selected_examples'] as $value) { - $values[] = $this->denormalizer->denormalize($value, CreateClassificationResponseSelectedExamplesItem::class, 'json', $context); - } - $object->setSelectedExamples($values); - unset($data['selected_examples']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - - /** - * @return array|string|int|float|bool|ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('object') && $object->getObject() !== null) { - $data['object'] = $object->getObject(); - } - if ($object->isInitialized('model') && $object->getModel() !== null) { - $data['model'] = $object->getModel(); - } - if ($object->isInitialized('searchModel') && $object->getSearchModel() !== null) { - $data['search_model'] = $object->getSearchModel(); - } - if ($object->isInitialized('completion') && $object->getCompletion() !== null) { - $data['completion'] = $object->getCompletion(); - } - if ($object->isInitialized('label') && $object->getLabel() !== null) { - $data['label'] = $object->getLabel(); - } - if ($object->isInitialized('selectedExamples') && $object->getSelectedExamples() !== null) { - $values = []; - foreach ($object->getSelectedExamples() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['selected_examples'] = $values; - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } -} diff --git a/generated/Normalizer/CreateCompletionRequestNormalizer.php b/generated/Normalizer/CreateCompletionRequestNormalizer.php index 1638557..9dc0ab4 100644 --- a/generated/Normalizer/CreateCompletionRequestNormalizer.php +++ b/generated/Normalizer/CreateCompletionRequestNormalizer.php @@ -23,12 +23,12 @@ class CreateCompletionRequestNormalizer implements DenormalizerInterface, Normal use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateCompletionRequest::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateCompletionRequest::class; } @@ -45,18 +45,18 @@ public function denormalize($data, $class, $format = null, array $context = []) return new Reference($data['$recursiveRef'], $context['document-origin']); } $object = new CreateCompletionRequest(); + if (\array_key_exists('frequency_penalty', $data) && \is_int($data['frequency_penalty'])) { + $data['frequency_penalty'] = (float) $data['frequency_penalty']; + } + if (\array_key_exists('presence_penalty', $data) && \is_int($data['presence_penalty'])) { + $data['presence_penalty'] = (float) $data['presence_penalty']; + } if (\array_key_exists('temperature', $data) && \is_int($data['temperature'])) { $data['temperature'] = (float) $data['temperature']; } if (\array_key_exists('top_p', $data) && \is_int($data['top_p'])) { $data['top_p'] = (float) $data['top_p']; } - if (\array_key_exists('presence_penalty', $data) && \is_int($data['presence_penalty'])) { - $data['presence_penalty'] = (float) $data['presence_penalty']; - } - if (\array_key_exists('frequency_penalty', $data) && \is_int($data['frequency_penalty'])) { - $data['frequency_penalty'] = (float) $data['frequency_penalty']; - } if ($data === null || \is_array($data) === false) { return $object; } @@ -70,11 +70,39 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('prompt', $data) && $data['prompt'] === null) { $object->setPrompt(null); } - if (\array_key_exists('suffix', $data) && $data['suffix'] !== null) { - $object->setSuffix($data['suffix']); - unset($data['suffix']); - } elseif (\array_key_exists('suffix', $data) && $data['suffix'] === null) { - $object->setSuffix(null); + if (\array_key_exists('best_of', $data) && $data['best_of'] !== null) { + $object->setBestOf($data['best_of']); + unset($data['best_of']); + } elseif (\array_key_exists('best_of', $data) && $data['best_of'] === null) { + $object->setBestOf(null); + } + if (\array_key_exists('echo', $data) && $data['echo'] !== null) { + $object->setEcho($data['echo']); + unset($data['echo']); + } elseif (\array_key_exists('echo', $data) && $data['echo'] === null) { + $object->setEcho(null); + } + if (\array_key_exists('frequency_penalty', $data) && $data['frequency_penalty'] !== null) { + $object->setFrequencyPenalty($data['frequency_penalty']); + unset($data['frequency_penalty']); + } elseif (\array_key_exists('frequency_penalty', $data) && $data['frequency_penalty'] === null) { + $object->setFrequencyPenalty(null); + } + if (\array_key_exists('logit_bias', $data) && $data['logit_bias'] !== null) { + $values = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['logit_bias'] as $key => $value) { + $values[$key] = $value; + } + $object->setLogitBias($values); + unset($data['logit_bias']); + } elseif (\array_key_exists('logit_bias', $data) && $data['logit_bias'] === null) { + $object->setLogitBias(null); + } + if (\array_key_exists('logprobs', $data) && $data['logprobs'] !== null) { + $object->setLogprobs($data['logprobs']); + unset($data['logprobs']); + } elseif (\array_key_exists('logprobs', $data) && $data['logprobs'] === null) { + $object->setLogprobs(null); } if (\array_key_exists('max_tokens', $data) && $data['max_tokens'] !== null) { $object->setMaxTokens($data['max_tokens']); @@ -82,41 +110,23 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('max_tokens', $data) && $data['max_tokens'] === null) { $object->setMaxTokens(null); } - if (\array_key_exists('temperature', $data) && $data['temperature'] !== null) { - $object->setTemperature($data['temperature']); - unset($data['temperature']); - } elseif (\array_key_exists('temperature', $data) && $data['temperature'] === null) { - $object->setTemperature(null); - } - if (\array_key_exists('top_p', $data) && $data['top_p'] !== null) { - $object->setTopP($data['top_p']); - unset($data['top_p']); - } elseif (\array_key_exists('top_p', $data) && $data['top_p'] === null) { - $object->setTopP(null); - } if (\array_key_exists('n', $data) && $data['n'] !== null) { $object->setN($data['n']); unset($data['n']); } elseif (\array_key_exists('n', $data) && $data['n'] === null) { $object->setN(null); } - if (\array_key_exists('stream', $data) && $data['stream'] !== null) { - $object->setStream($data['stream']); - unset($data['stream']); - } elseif (\array_key_exists('stream', $data) && $data['stream'] === null) { - $object->setStream(null); - } - if (\array_key_exists('logprobs', $data) && $data['logprobs'] !== null) { - $object->setLogprobs($data['logprobs']); - unset($data['logprobs']); - } elseif (\array_key_exists('logprobs', $data) && $data['logprobs'] === null) { - $object->setLogprobs(null); + if (\array_key_exists('presence_penalty', $data) && $data['presence_penalty'] !== null) { + $object->setPresencePenalty($data['presence_penalty']); + unset($data['presence_penalty']); + } elseif (\array_key_exists('presence_penalty', $data) && $data['presence_penalty'] === null) { + $object->setPresencePenalty(null); } - if (\array_key_exists('echo', $data) && $data['echo'] !== null) { - $object->setEcho($data['echo']); - unset($data['echo']); - } elseif (\array_key_exists('echo', $data) && $data['echo'] === null) { - $object->setEcho(null); + if (\array_key_exists('seed', $data) && $data['seed'] !== null) { + $object->setSeed($data['seed']); + unset($data['seed']); + } elseif (\array_key_exists('seed', $data) && $data['seed'] === null) { + $object->setSeed(null); } if (\array_key_exists('stop', $data) && $data['stop'] !== null) { $object->setStop($data['stop']); @@ -124,33 +134,29 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('stop', $data) && $data['stop'] === null) { $object->setStop(null); } - if (\array_key_exists('presence_penalty', $data) && $data['presence_penalty'] !== null) { - $object->setPresencePenalty($data['presence_penalty']); - unset($data['presence_penalty']); - } elseif (\array_key_exists('presence_penalty', $data) && $data['presence_penalty'] === null) { - $object->setPresencePenalty(null); + if (\array_key_exists('stream', $data) && $data['stream'] !== null) { + $object->setStream($data['stream']); + unset($data['stream']); + } elseif (\array_key_exists('stream', $data) && $data['stream'] === null) { + $object->setStream(null); } - if (\array_key_exists('frequency_penalty', $data) && $data['frequency_penalty'] !== null) { - $object->setFrequencyPenalty($data['frequency_penalty']); - unset($data['frequency_penalty']); - } elseif (\array_key_exists('frequency_penalty', $data) && $data['frequency_penalty'] === null) { - $object->setFrequencyPenalty(null); + if (\array_key_exists('suffix', $data) && $data['suffix'] !== null) { + $object->setSuffix($data['suffix']); + unset($data['suffix']); + } elseif (\array_key_exists('suffix', $data) && $data['suffix'] === null) { + $object->setSuffix(null); } - if (\array_key_exists('best_of', $data) && $data['best_of'] !== null) { - $object->setBestOf($data['best_of']); - unset($data['best_of']); - } elseif (\array_key_exists('best_of', $data) && $data['best_of'] === null) { - $object->setBestOf(null); + if (\array_key_exists('temperature', $data) && $data['temperature'] !== null) { + $object->setTemperature($data['temperature']); + unset($data['temperature']); + } elseif (\array_key_exists('temperature', $data) && $data['temperature'] === null) { + $object->setTemperature(null); } - if (\array_key_exists('logit_bias', $data) && $data['logit_bias'] !== null) { - $values = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - foreach ($data['logit_bias'] as $key => $value) { - $values[$key] = $value; - } - $object->setLogitBias($values); - unset($data['logit_bias']); - } elseif (\array_key_exists('logit_bias', $data) && $data['logit_bias'] === null) { - $object->setLogitBias(null); + if (\array_key_exists('top_p', $data) && $data['top_p'] !== null) { + $object->setTopP($data['top_p']); + unset($data['top_p']); + } elseif (\array_key_exists('top_p', $data) && $data['top_p'] === null) { + $object->setTopP(null); } if (\array_key_exists('user', $data)) { $object->setUser($data['user']); @@ -171,51 +177,52 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['model'] = $object->getModel(); - if ($object->isInitialized('prompt') && $object->getPrompt() !== null) { - $data['prompt'] = $object->getPrompt(); + $data['prompt'] = $object->getPrompt(); + if ($object->isInitialized('bestOf') && $object->getBestOf() !== null) { + $data['best_of'] = $object->getBestOf(); } - if ($object->isInitialized('suffix') && $object->getSuffix() !== null) { - $data['suffix'] = $object->getSuffix(); + if ($object->isInitialized('echo') && $object->getEcho() !== null) { + $data['echo'] = $object->getEcho(); } - if ($object->isInitialized('maxTokens') && $object->getMaxTokens() !== null) { - $data['max_tokens'] = $object->getMaxTokens(); + if ($object->isInitialized('frequencyPenalty') && $object->getFrequencyPenalty() !== null) { + $data['frequency_penalty'] = $object->getFrequencyPenalty(); } - if ($object->isInitialized('temperature') && $object->getTemperature() !== null) { - $data['temperature'] = $object->getTemperature(); + if ($object->isInitialized('logitBias') && $object->getLogitBias() !== null) { + $values = []; + foreach ($object->getLogitBias() as $key => $value) { + $values[$key] = $value; + } + $data['logit_bias'] = $values; } - if ($object->isInitialized('topP') && $object->getTopP() !== null) { - $data['top_p'] = $object->getTopP(); + if ($object->isInitialized('logprobs') && $object->getLogprobs() !== null) { + $data['logprobs'] = $object->getLogprobs(); + } + if ($object->isInitialized('maxTokens') && $object->getMaxTokens() !== null) { + $data['max_tokens'] = $object->getMaxTokens(); } if ($object->isInitialized('n') && $object->getN() !== null) { $data['n'] = $object->getN(); } - if ($object->isInitialized('stream') && $object->getStream() !== null) { - $data['stream'] = $object->getStream(); - } - if ($object->isInitialized('logprobs') && $object->getLogprobs() !== null) { - $data['logprobs'] = $object->getLogprobs(); + if ($object->isInitialized('presencePenalty') && $object->getPresencePenalty() !== null) { + $data['presence_penalty'] = $object->getPresencePenalty(); } - if ($object->isInitialized('echo') && $object->getEcho() !== null) { - $data['echo'] = $object->getEcho(); + if ($object->isInitialized('seed') && $object->getSeed() !== null) { + $data['seed'] = $object->getSeed(); } if ($object->isInitialized('stop') && $object->getStop() !== null) { $data['stop'] = $object->getStop(); } - if ($object->isInitialized('presencePenalty') && $object->getPresencePenalty() !== null) { - $data['presence_penalty'] = $object->getPresencePenalty(); + if ($object->isInitialized('stream') && $object->getStream() !== null) { + $data['stream'] = $object->getStream(); } - if ($object->isInitialized('frequencyPenalty') && $object->getFrequencyPenalty() !== null) { - $data['frequency_penalty'] = $object->getFrequencyPenalty(); + if ($object->isInitialized('suffix') && $object->getSuffix() !== null) { + $data['suffix'] = $object->getSuffix(); } - if ($object->isInitialized('bestOf') && $object->getBestOf() !== null) { - $data['best_of'] = $object->getBestOf(); + if ($object->isInitialized('temperature') && $object->getTemperature() !== null) { + $data['temperature'] = $object->getTemperature(); } - if ($object->isInitialized('logitBias') && $object->getLogitBias() !== null) { - $values = []; - foreach ($object->getLogitBias() as $key => $value) { - $values[$key] = $value; - } - $data['logit_bias'] = $values; + if ($object->isInitialized('topP') && $object->getTopP() !== null) { + $data['top_p'] = $object->getTopP(); } if ($object->isInitialized('user') && $object->getUser() !== null) { $data['user'] = $object->getUser(); @@ -227,4 +234,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateCompletionRequest::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateCompletionResponseChoicesItemLogprobsNormalizer.php b/generated/Normalizer/CreateCompletionResponseChoicesItemLogprobsNormalizer.php index 8be2d9d..76e3a1b 100644 --- a/generated/Normalizer/CreateCompletionResponseChoicesItemLogprobsNormalizer.php +++ b/generated/Normalizer/CreateCompletionResponseChoicesItemLogprobsNormalizer.php @@ -23,12 +23,12 @@ class CreateCompletionResponseChoicesItemLogprobsNormalizer implements Denormali use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateCompletionResponseChoicesItemLogprobs::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateCompletionResponseChoicesItemLogprobs::class; } @@ -48,13 +48,13 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('tokens', $data)) { + if (\array_key_exists('text_offset', $data)) { $values = []; - foreach ($data['tokens'] as $value) { + foreach ($data['text_offset'] as $value) { $values[] = $value; } - $object->setTokens($values); - unset($data['tokens']); + $object->setTextOffset($values); + unset($data['text_offset']); } if (\array_key_exists('token_logprobs', $data)) { $values_1 = []; @@ -64,25 +64,25 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setTokenLogprobs($values_1); unset($data['token_logprobs']); } - if (\array_key_exists('top_logprobs', $data)) { + if (\array_key_exists('tokens', $data)) { $values_2 = []; - foreach ($data['top_logprobs'] as $value_2) { - $values_3 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - foreach ($value_2 as $key => $value_3) { - $values_3[$key] = $value_3; - } - $values_2[] = $values_3; + foreach ($data['tokens'] as $value_2) { + $values_2[] = $value_2; } - $object->setTopLogprobs($values_2); - unset($data['top_logprobs']); + $object->setTokens($values_2); + unset($data['tokens']); } - if (\array_key_exists('text_offset', $data)) { - $values_4 = []; - foreach ($data['text_offset'] as $value_4) { - $values_4[] = $value_4; + if (\array_key_exists('top_logprobs', $data)) { + $values_3 = []; + foreach ($data['top_logprobs'] as $value_3) { + $values_4 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($value_3 as $key => $value_4) { + $values_4[$key] = $value_4; + } + $values_3[] = $values_4; } - $object->setTextOffset($values_4); - unset($data['text_offset']); + $object->setTopLogprobs($values_3); + unset($data['top_logprobs']); } foreach ($data as $key_1 => $value_5) { if (preg_match('/.*/', (string) $key_1)) { @@ -98,12 +98,12 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - if ($object->isInitialized('tokens') && $object->getTokens() !== null) { + if ($object->isInitialized('textOffset') && $object->getTextOffset() !== null) { $values = []; - foreach ($object->getTokens() as $value) { + foreach ($object->getTextOffset() as $value) { $values[] = $value; } - $data['tokens'] = $values; + $data['text_offset'] = $values; } if ($object->isInitialized('tokenLogprobs') && $object->getTokenLogprobs() !== null) { $values_1 = []; @@ -112,23 +112,23 @@ public function normalize($object, $format = null, array $context = []) } $data['token_logprobs'] = $values_1; } - if ($object->isInitialized('topLogprobs') && $object->getTopLogprobs() !== null) { + if ($object->isInitialized('tokens') && $object->getTokens() !== null) { $values_2 = []; - foreach ($object->getTopLogprobs() as $value_2) { - $values_3 = []; - foreach ($value_2 as $key => $value_3) { - $values_3[$key] = $value_3; - } - $values_2[] = $values_3; + foreach ($object->getTokens() as $value_2) { + $values_2[] = $value_2; } - $data['top_logprobs'] = $values_2; + $data['tokens'] = $values_2; } - if ($object->isInitialized('textOffset') && $object->getTextOffset() !== null) { - $values_4 = []; - foreach ($object->getTextOffset() as $value_4) { - $values_4[] = $value_4; + if ($object->isInitialized('topLogprobs') && $object->getTopLogprobs() !== null) { + $values_3 = []; + foreach ($object->getTopLogprobs() as $value_3) { + $values_4 = []; + foreach ($value_3 as $key => $value_4) { + $values_4[$key] = $value_4; + } + $values_3[] = $values_4; } - $data['text_offset'] = $values_4; + $data['top_logprobs'] = $values_3; } foreach ($object as $key_1 => $value_5) { if (preg_match('/.*/', (string) $key_1)) { @@ -137,4 +137,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateCompletionResponseChoicesItemLogprobs::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateCompletionResponseChoicesItemNormalizer.php b/generated/Normalizer/CreateCompletionResponseChoicesItemNormalizer.php index 4c9648a..63c5eaf 100644 --- a/generated/Normalizer/CreateCompletionResponseChoicesItemNormalizer.php +++ b/generated/Normalizer/CreateCompletionResponseChoicesItemNormalizer.php @@ -24,12 +24,12 @@ class CreateCompletionResponseChoicesItemNormalizer implements DenormalizerInter use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateCompletionResponseChoicesItem::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateCompletionResponseChoicesItem::class; } @@ -49,9 +49,9 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('text', $data)) { - $object->setText($data['text']); - unset($data['text']); + if (\array_key_exists('finish_reason', $data)) { + $object->setFinishReason($data['finish_reason']); + unset($data['finish_reason']); } if (\array_key_exists('index', $data)) { $object->setIndex($data['index']); @@ -63,11 +63,9 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('logprobs', $data) && $data['logprobs'] === null) { $object->setLogprobs(null); } - if (\array_key_exists('finish_reason', $data) && $data['finish_reason'] !== null) { - $object->setFinishReason($data['finish_reason']); - unset($data['finish_reason']); - } elseif (\array_key_exists('finish_reason', $data) && $data['finish_reason'] === null) { - $object->setFinishReason(null); + if (\array_key_exists('text', $data)) { + $object->setText($data['text']); + unset($data['text']); } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { @@ -83,18 +81,10 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - if ($object->isInitialized('text') && $object->getText() !== null) { - $data['text'] = $object->getText(); - } - if ($object->isInitialized('index') && $object->getIndex() !== null) { - $data['index'] = $object->getIndex(); - } - if ($object->isInitialized('logprobs') && $object->getLogprobs() !== null) { - $data['logprobs'] = $this->normalizer->normalize($object->getLogprobs(), 'json', $context); - } - if ($object->isInitialized('finishReason') && $object->getFinishReason() !== null) { - $data['finish_reason'] = $object->getFinishReason(); - } + $data['finish_reason'] = $object->getFinishReason(); + $data['index'] = $object->getIndex(); + $data['logprobs'] = $this->normalizer->normalize($object->getLogprobs(), 'json', $context); + $data['text'] = $object->getText(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; @@ -102,4 +92,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateCompletionResponseChoicesItem::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateCompletionResponseNormalizer.php b/generated/Normalizer/CreateCompletionResponseNormalizer.php index 7b25f89..cb895af 100644 --- a/generated/Normalizer/CreateCompletionResponseNormalizer.php +++ b/generated/Normalizer/CreateCompletionResponseNormalizer.php @@ -6,9 +6,9 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; +use Sourceability\OpenAIClient\Generated\Model\CompletionUsage; use Sourceability\OpenAIClient\Generated\Model\CreateCompletionResponse; use Sourceability\OpenAIClient\Generated\Model\CreateCompletionResponseChoicesItem; -use Sourceability\OpenAIClient\Generated\Model\CreateCompletionResponseUsage; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -25,12 +25,12 @@ class CreateCompletionResponseNormalizer implements DenormalizerInterface, Norma use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateCompletionResponse::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateCompletionResponse::class; } @@ -54,9 +54,13 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); + if (\array_key_exists('choices', $data)) { + $values = []; + foreach ($data['choices'] as $value) { + $values[] = $this->denormalizer->denormalize($value, CreateCompletionResponseChoicesItem::class, 'json', $context); + } + $object->setChoices($values); + unset($data['choices']); } if (\array_key_exists('created', $data)) { $object->setCreated($data['created']); @@ -66,16 +70,16 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setModel($data['model']); unset($data['model']); } - if (\array_key_exists('choices', $data)) { - $values = []; - foreach ($data['choices'] as $value) { - $values[] = $this->denormalizer->denormalize($value, CreateCompletionResponseChoicesItem::class, 'json', $context); - } - $object->setChoices($values); - unset($data['choices']); + if (\array_key_exists('system_fingerprint', $data)) { + $object->setSystemFingerprint($data['system_fingerprint']); + unset($data['system_fingerprint']); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); } if (\array_key_exists('usage', $data)) { - $object->setUsage($this->denormalizer->denormalize($data['usage'], CreateCompletionResponseUsage::class, 'json', $context)); + $object->setUsage($this->denormalizer->denormalize($data['usage'], CompletionUsage::class, 'json', $context)); unset($data['usage']); } foreach ($data as $key => $value_1) { @@ -93,14 +97,17 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['object'] = $object->getObject(); - $data['created'] = $object->getCreated(); - $data['model'] = $object->getModel(); $values = []; foreach ($object->getChoices() as $value) { $values[] = $this->normalizer->normalize($value, 'json', $context); } $data['choices'] = $values; + $data['created'] = $object->getCreated(); + $data['model'] = $object->getModel(); + if ($object->isInitialized('systemFingerprint') && $object->getSystemFingerprint() !== null) { + $data['system_fingerprint'] = $object->getSystemFingerprint(); + } + $data['object'] = $object->getObject(); if ($object->isInitialized('usage') && $object->getUsage() !== null) { $data['usage'] = $this->normalizer->normalize($object->getUsage(), 'json', $context); } @@ -111,4 +118,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateCompletionResponse::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateEditRequestNormalizer.php b/generated/Normalizer/CreateEditRequestNormalizer.php index 5ff4184..ce53ac7 100644 --- a/generated/Normalizer/CreateEditRequestNormalizer.php +++ b/generated/Normalizer/CreateEditRequestNormalizer.php @@ -23,12 +23,12 @@ class CreateEditRequestNormalizer implements DenormalizerInterface, NormalizerIn use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateEditRequest::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateEditRequest::class; } @@ -54,6 +54,10 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } + if (\array_key_exists('instruction', $data)) { + $object->setInstruction($data['instruction']); + unset($data['instruction']); + } if (\array_key_exists('model', $data)) { $object->setModel($data['model']); unset($data['model']); @@ -64,10 +68,6 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('input', $data) && $data['input'] === null) { $object->setInput(null); } - if (\array_key_exists('instruction', $data)) { - $object->setInstruction($data['instruction']); - unset($data['instruction']); - } if (\array_key_exists('n', $data) && $data['n'] !== null) { $object->setN($data['n']); unset($data['n']); @@ -100,11 +100,11 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; + $data['instruction'] = $object->getInstruction(); $data['model'] = $object->getModel(); if ($object->isInitialized('input') && $object->getInput() !== null) { $data['input'] = $object->getInput(); } - $data['instruction'] = $object->getInstruction(); if ($object->isInitialized('n') && $object->getN() !== null) { $data['n'] = $object->getN(); } @@ -121,4 +121,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateEditRequest::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateEditResponseChoicesItemLogprobsNormalizer.php b/generated/Normalizer/CreateEditResponseChoicesItemLogprobsNormalizer.php deleted file mode 100644 index 592e9e7..0000000 --- a/generated/Normalizer/CreateEditResponseChoicesItemLogprobsNormalizer.php +++ /dev/null @@ -1,140 +0,0 @@ -setTokens($values); - unset($data['tokens']); - } - if (\array_key_exists('token_logprobs', $data)) { - $values_1 = []; - foreach ($data['token_logprobs'] as $value_1) { - $values_1[] = $value_1; - } - $object->setTokenLogprobs($values_1); - unset($data['token_logprobs']); - } - if (\array_key_exists('top_logprobs', $data)) { - $values_2 = []; - foreach ($data['top_logprobs'] as $value_2) { - $values_3 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - foreach ($value_2 as $key => $value_3) { - $values_3[$key] = $value_3; - } - $values_2[] = $values_3; - } - $object->setTopLogprobs($values_2); - unset($data['top_logprobs']); - } - if (\array_key_exists('text_offset', $data)) { - $values_4 = []; - foreach ($data['text_offset'] as $value_4) { - $values_4[] = $value_4; - } - $object->setTextOffset($values_4); - unset($data['text_offset']); - } - foreach ($data as $key_1 => $value_5) { - if (preg_match('/.*/', (string) $key_1)) { - $object[$key_1] = $value_5; - } - } - return $object; - } - - /** - * @return array|string|int|float|bool|ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - if ($object->isInitialized('tokens') && $object->getTokens() !== null) { - $values = []; - foreach ($object->getTokens() as $value) { - $values[] = $value; - } - $data['tokens'] = $values; - } - if ($object->isInitialized('tokenLogprobs') && $object->getTokenLogprobs() !== null) { - $values_1 = []; - foreach ($object->getTokenLogprobs() as $value_1) { - $values_1[] = $value_1; - } - $data['token_logprobs'] = $values_1; - } - if ($object->isInitialized('topLogprobs') && $object->getTopLogprobs() !== null) { - $values_2 = []; - foreach ($object->getTopLogprobs() as $value_2) { - $values_3 = []; - foreach ($value_2 as $key => $value_3) { - $values_3[$key] = $value_3; - } - $values_2[] = $values_3; - } - $data['top_logprobs'] = $values_2; - } - if ($object->isInitialized('textOffset') && $object->getTextOffset() !== null) { - $values_4 = []; - foreach ($object->getTextOffset() as $value_4) { - $values_4[] = $value_4; - } - $data['text_offset'] = $values_4; - } - foreach ($object as $key_1 => $value_5) { - if (preg_match('/.*/', (string) $key_1)) { - $data[$key_1] = $value_5; - } - } - return $data; - } -} diff --git a/generated/Normalizer/CreateEditResponseChoicesItemNormalizer.php b/generated/Normalizer/CreateEditResponseChoicesItemNormalizer.php index 6efcab1..8747da3 100644 --- a/generated/Normalizer/CreateEditResponseChoicesItemNormalizer.php +++ b/generated/Normalizer/CreateEditResponseChoicesItemNormalizer.php @@ -7,7 +7,6 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; use Sourceability\OpenAIClient\Generated\Model\CreateEditResponseChoicesItem; -use Sourceability\OpenAIClient\Generated\Model\CreateEditResponseChoicesItemLogprobs; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -24,12 +23,12 @@ class CreateEditResponseChoicesItemNormalizer implements DenormalizerInterface, use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateEditResponseChoicesItem::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateEditResponseChoicesItem::class; } @@ -49,23 +48,17 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('text', $data)) { - $object->setText($data['text']); - unset($data['text']); + if (\array_key_exists('finish_reason', $data)) { + $object->setFinishReason($data['finish_reason']); + unset($data['finish_reason']); } if (\array_key_exists('index', $data)) { $object->setIndex($data['index']); unset($data['index']); } - if (\array_key_exists('logprobs', $data) && $data['logprobs'] !== null) { - $object->setLogprobs($this->denormalizer->denormalize($data['logprobs'], CreateEditResponseChoicesItemLogprobs::class, 'json', $context)); - unset($data['logprobs']); - } elseif (\array_key_exists('logprobs', $data) && $data['logprobs'] === null) { - $object->setLogprobs(null); - } - if (\array_key_exists('finish_reason', $data)) { - $object->setFinishReason($data['finish_reason']); - unset($data['finish_reason']); + if (\array_key_exists('text', $data)) { + $object->setText($data['text']); + unset($data['text']); } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { @@ -81,18 +74,9 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - if ($object->isInitialized('text') && $object->getText() !== null) { - $data['text'] = $object->getText(); - } - if ($object->isInitialized('index') && $object->getIndex() !== null) { - $data['index'] = $object->getIndex(); - } - if ($object->isInitialized('logprobs') && $object->getLogprobs() !== null) { - $data['logprobs'] = $this->normalizer->normalize($object->getLogprobs(), 'json', $context); - } - if ($object->isInitialized('finishReason') && $object->getFinishReason() !== null) { - $data['finish_reason'] = $object->getFinishReason(); - } + $data['finish_reason'] = $object->getFinishReason(); + $data['index'] = $object->getIndex(); + $data['text'] = $object->getText(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; @@ -100,4 +84,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateEditResponseChoicesItem::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateEditResponseNormalizer.php b/generated/Normalizer/CreateEditResponseNormalizer.php index a4e39fd..b2800e4 100644 --- a/generated/Normalizer/CreateEditResponseNormalizer.php +++ b/generated/Normalizer/CreateEditResponseNormalizer.php @@ -6,9 +6,9 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; +use Sourceability\OpenAIClient\Generated\Model\CompletionUsage; use Sourceability\OpenAIClient\Generated\Model\CreateEditResponse; use Sourceability\OpenAIClient\Generated\Model\CreateEditResponseChoicesItem; -use Sourceability\OpenAIClient\Generated\Model\CreateEditResponseUsage; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -25,12 +25,12 @@ class CreateEditResponseNormalizer implements DenormalizerInterface, NormalizerI use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateEditResponse::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateEditResponse::class; } @@ -50,14 +50,6 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } - if (\array_key_exists('created', $data)) { - $object->setCreated($data['created']); - unset($data['created']); - } if (\array_key_exists('choices', $data)) { $values = []; foreach ($data['choices'] as $value) { @@ -66,8 +58,16 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setChoices($values); unset($data['choices']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } + if (\array_key_exists('created', $data)) { + $object->setCreated($data['created']); + unset($data['created']); + } if (\array_key_exists('usage', $data)) { - $object->setUsage($this->denormalizer->denormalize($data['usage'], CreateEditResponseUsage::class, 'json', $context)); + $object->setUsage($this->denormalizer->denormalize($data['usage'], CompletionUsage::class, 'json', $context)); unset($data['usage']); } foreach ($data as $key => $value_1) { @@ -84,13 +84,13 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['object'] = $object->getObject(); - $data['created'] = $object->getCreated(); $values = []; foreach ($object->getChoices() as $value) { $values[] = $this->normalizer->normalize($value, 'json', $context); } $data['choices'] = $values; + $data['object'] = $object->getObject(); + $data['created'] = $object->getCreated(); $data['usage'] = $this->normalizer->normalize($object->getUsage(), 'json', $context); foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { @@ -99,4 +99,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateEditResponse::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateEmbeddingRequestNormalizer.php b/generated/Normalizer/CreateEmbeddingRequestNormalizer.php index 7a773bc..917d906 100644 --- a/generated/Normalizer/CreateEmbeddingRequestNormalizer.php +++ b/generated/Normalizer/CreateEmbeddingRequestNormalizer.php @@ -4,6 +4,7 @@ namespace Sourceability\OpenAIClient\Generated\Normalizer; +use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; use Sourceability\OpenAIClient\Generated\Model\CreateEmbeddingRequest; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; @@ -22,12 +23,12 @@ class CreateEmbeddingRequestNormalizer implements DenormalizerInterface, Normali use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateEmbeddingRequest::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateEmbeddingRequest::class; } @@ -47,11 +48,14 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } + if (\array_key_exists('input', $data)) { + $object->setInput($data['input']); + } if (\array_key_exists('model', $data)) { $object->setModel($data['model']); } - if (\array_key_exists('input', $data)) { - $object->setInput($data['input']); + if (\array_key_exists('encoding_format', $data)) { + $object->setEncodingFormat($data['encoding_format']); } if (\array_key_exists('user', $data)) { $object->setUser($data['user']); @@ -60,16 +64,26 @@ public function denormalize($data, $class, $format = null, array $context = []) } /** - * @return array{model: mixed, input: mixed, user?: mixed} + * @return array|string|int|float|bool|ArrayObject|null */ public function normalize($object, $format = null, array $context = []) { $data = []; - $data['model'] = $object->getModel(); $data['input'] = $object->getInput(); + $data['model'] = $object->getModel(); + if ($object->isInitialized('encodingFormat') && $object->getEncodingFormat() !== null) { + $data['encoding_format'] = $object->getEncodingFormat(); + } if ($object->isInitialized('user') && $object->getUser() !== null) { $data['user'] = $object->getUser(); } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateEmbeddingRequest::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateEmbeddingResponseNormalizer.php b/generated/Normalizer/CreateEmbeddingResponseNormalizer.php index 5fba057..1e87949 100644 --- a/generated/Normalizer/CreateEmbeddingResponseNormalizer.php +++ b/generated/Normalizer/CreateEmbeddingResponseNormalizer.php @@ -7,8 +7,8 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; use Sourceability\OpenAIClient\Generated\Model\CreateEmbeddingResponse; -use Sourceability\OpenAIClient\Generated\Model\CreateEmbeddingResponseDataItem; use Sourceability\OpenAIClient\Generated\Model\CreateEmbeddingResponseUsage; +use Sourceability\OpenAIClient\Generated\Model\Embedding; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -25,12 +25,12 @@ class CreateEmbeddingResponseNormalizer implements DenormalizerInterface, Normal use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateEmbeddingResponse::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateEmbeddingResponse::class; } @@ -50,22 +50,22 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } - if (\array_key_exists('model', $data)) { - $object->setModel($data['model']); - unset($data['model']); - } if (\array_key_exists('data', $data)) { $values = []; foreach ($data['data'] as $value) { - $values[] = $this->denormalizer->denormalize($value, CreateEmbeddingResponseDataItem::class, 'json', $context); + $values[] = $this->denormalizer->denormalize($value, Embedding::class, 'json', $context); } $object->setData($values); unset($data['data']); } + if (\array_key_exists('model', $data)) { + $object->setModel($data['model']); + unset($data['model']); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } if (\array_key_exists('usage', $data)) { $object->setUsage($this->denormalizer->denormalize($data['usage'], CreateEmbeddingResponseUsage::class, 'json', $context)); unset($data['usage']); @@ -84,13 +84,13 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['object'] = $object->getObject(); - $data['model'] = $object->getModel(); $values = []; foreach ($object->getData() as $value) { $values[] = $this->normalizer->normalize($value, 'json', $context); } $data['data'] = $values; + $data['model'] = $object->getModel(); + $data['object'] = $object->getObject(); $data['usage'] = $this->normalizer->normalize($object->getUsage(), 'json', $context); foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { @@ -99,4 +99,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateEmbeddingResponse::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateEmbeddingResponseUsageNormalizer.php b/generated/Normalizer/CreateEmbeddingResponseUsageNormalizer.php index 53e1e6f..e3ec9dd 100644 --- a/generated/Normalizer/CreateEmbeddingResponseUsageNormalizer.php +++ b/generated/Normalizer/CreateEmbeddingResponseUsageNormalizer.php @@ -23,12 +23,12 @@ class CreateEmbeddingResponseUsageNormalizer implements DenormalizerInterface, N use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateEmbeddingResponseUsage::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateEmbeddingResponseUsage::class; } @@ -79,4 +79,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateEmbeddingResponseUsage::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateFileRequestNormalizer.php b/generated/Normalizer/CreateFileRequestNormalizer.php index ad35a63..63846af 100644 --- a/generated/Normalizer/CreateFileRequestNormalizer.php +++ b/generated/Normalizer/CreateFileRequestNormalizer.php @@ -4,6 +4,7 @@ namespace Sourceability\OpenAIClient\Generated\Normalizer; +use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; use Sourceability\OpenAIClient\Generated\Model\CreateFileRequest; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; @@ -22,12 +23,12 @@ class CreateFileRequestNormalizer implements DenormalizerInterface, NormalizerIn use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateFileRequest::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateFileRequest::class; } @@ -57,7 +58,7 @@ public function denormalize($data, $class, $format = null, array $context = []) } /** - * @return array{file: mixed, purpose: mixed} + * @return array|string|int|float|bool|ArrayObject|null */ public function normalize($object, $format = null, array $context = []) { @@ -66,4 +67,11 @@ public function normalize($object, $format = null, array $context = []) $data['purpose'] = $object->getPurpose(); return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateFileRequest::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateFineTuneRequestHyperparametersNormalizer.php b/generated/Normalizer/CreateFineTuneRequestHyperparametersNormalizer.php new file mode 100644 index 0000000..aa38e08 --- /dev/null +++ b/generated/Normalizer/CreateFineTuneRequestHyperparametersNormalizer.php @@ -0,0 +1,86 @@ +setNEpochs($data['n_epochs']); + unset($data['n_epochs']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('nEpochs') && $object->getNEpochs() !== null) { + $data['n_epochs'] = $object->getNEpochs(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateFineTuneRequestHyperparameters::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateFineTuneRequestNormalizer.php b/generated/Normalizer/CreateFineTuneRequestNormalizer.php index 86dd6e1..e21dea8 100644 --- a/generated/Normalizer/CreateFineTuneRequestNormalizer.php +++ b/generated/Normalizer/CreateFineTuneRequestNormalizer.php @@ -7,6 +7,7 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; use Sourceability\OpenAIClient\Generated\Model\CreateFineTuneRequest; +use Sourceability\OpenAIClient\Generated\Model\CreateFineTuneRequestHyperparameters; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -23,12 +24,12 @@ class CreateFineTuneRequestNormalizer implements DenormalizerInterface, Normaliz use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateFineTuneRequest::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateFineTuneRequest::class; } @@ -58,47 +59,21 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setTrainingFile($data['training_file']); unset($data['training_file']); } - if (\array_key_exists('validation_file', $data) && $data['validation_file'] !== null) { - $object->setValidationFile($data['validation_file']); - unset($data['validation_file']); - } elseif (\array_key_exists('validation_file', $data) && $data['validation_file'] === null) { - $object->setValidationFile(null); - } - if (\array_key_exists('model', $data) && $data['model'] !== null) { - $object->setModel($data['model']); - unset($data['model']); - } elseif (\array_key_exists('model', $data) && $data['model'] === null) { - $object->setModel(null); - } - if (\array_key_exists('n_epochs', $data) && $data['n_epochs'] !== null) { - $object->setNEpochs($data['n_epochs']); - unset($data['n_epochs']); - } elseif (\array_key_exists('n_epochs', $data) && $data['n_epochs'] === null) { - $object->setNEpochs(null); - } if (\array_key_exists('batch_size', $data) && $data['batch_size'] !== null) { $object->setBatchSize($data['batch_size']); unset($data['batch_size']); } elseif (\array_key_exists('batch_size', $data) && $data['batch_size'] === null) { $object->setBatchSize(null); } - if (\array_key_exists('learning_rate_multiplier', $data) && $data['learning_rate_multiplier'] !== null) { - $object->setLearningRateMultiplier($data['learning_rate_multiplier']); - unset($data['learning_rate_multiplier']); - } elseif (\array_key_exists('learning_rate_multiplier', $data) && $data['learning_rate_multiplier'] === null) { - $object->setLearningRateMultiplier(null); - } - if (\array_key_exists('prompt_loss_weight', $data) && $data['prompt_loss_weight'] !== null) { - $object->setPromptLossWeight($data['prompt_loss_weight']); - unset($data['prompt_loss_weight']); - } elseif (\array_key_exists('prompt_loss_weight', $data) && $data['prompt_loss_weight'] === null) { - $object->setPromptLossWeight(null); - } - if (\array_key_exists('compute_classification_metrics', $data) && $data['compute_classification_metrics'] !== null) { - $object->setComputeClassificationMetrics($data['compute_classification_metrics']); - unset($data['compute_classification_metrics']); - } elseif (\array_key_exists('compute_classification_metrics', $data) && $data['compute_classification_metrics'] === null) { - $object->setComputeClassificationMetrics(null); + if (\array_key_exists('classification_betas', $data) && $data['classification_betas'] !== null) { + $values = []; + foreach ($data['classification_betas'] as $value) { + $values[] = $value; + } + $object->setClassificationBetas($values); + unset($data['classification_betas']); + } elseif (\array_key_exists('classification_betas', $data) && $data['classification_betas'] === null) { + $object->setClassificationBetas(null); } if (\array_key_exists('classification_n_classes', $data) && $data['classification_n_classes'] !== null) { $object->setClassificationNClasses($data['classification_n_classes']); @@ -112,15 +87,33 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('classification_positive_class', $data) && $data['classification_positive_class'] === null) { $object->setClassificationPositiveClass(null); } - if (\array_key_exists('classification_betas', $data) && $data['classification_betas'] !== null) { - $values = []; - foreach ($data['classification_betas'] as $value) { - $values[] = $value; - } - $object->setClassificationBetas($values); - unset($data['classification_betas']); - } elseif (\array_key_exists('classification_betas', $data) && $data['classification_betas'] === null) { - $object->setClassificationBetas(null); + if (\array_key_exists('compute_classification_metrics', $data) && $data['compute_classification_metrics'] !== null) { + $object->setComputeClassificationMetrics($data['compute_classification_metrics']); + unset($data['compute_classification_metrics']); + } elseif (\array_key_exists('compute_classification_metrics', $data) && $data['compute_classification_metrics'] === null) { + $object->setComputeClassificationMetrics(null); + } + if (\array_key_exists('hyperparameters', $data)) { + $object->setHyperparameters($this->denormalizer->denormalize($data['hyperparameters'], CreateFineTuneRequestHyperparameters::class, 'json', $context)); + unset($data['hyperparameters']); + } + if (\array_key_exists('learning_rate_multiplier', $data) && $data['learning_rate_multiplier'] !== null) { + $object->setLearningRateMultiplier($data['learning_rate_multiplier']); + unset($data['learning_rate_multiplier']); + } elseif (\array_key_exists('learning_rate_multiplier', $data) && $data['learning_rate_multiplier'] === null) { + $object->setLearningRateMultiplier(null); + } + if (\array_key_exists('model', $data) && $data['model'] !== null) { + $object->setModel($data['model']); + unset($data['model']); + } elseif (\array_key_exists('model', $data) && $data['model'] === null) { + $object->setModel(null); + } + if (\array_key_exists('prompt_loss_weight', $data) && $data['prompt_loss_weight'] !== null) { + $object->setPromptLossWeight($data['prompt_loss_weight']); + unset($data['prompt_loss_weight']); + } elseif (\array_key_exists('prompt_loss_weight', $data) && $data['prompt_loss_weight'] === null) { + $object->setPromptLossWeight(null); } if (\array_key_exists('suffix', $data) && $data['suffix'] !== null) { $object->setSuffix($data['suffix']); @@ -128,6 +121,12 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('suffix', $data) && $data['suffix'] === null) { $object->setSuffix(null); } + if (\array_key_exists('validation_file', $data) && $data['validation_file'] !== null) { + $object->setValidationFile($data['validation_file']); + unset($data['validation_file']); + } elseif (\array_key_exists('validation_file', $data) && $data['validation_file'] === null) { + $object->setValidationFile(null); + } foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value_1; @@ -143,26 +142,15 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['training_file'] = $object->getTrainingFile(); - if ($object->isInitialized('validationFile') && $object->getValidationFile() !== null) { - $data['validation_file'] = $object->getValidationFile(); - } - if ($object->isInitialized('model') && $object->getModel() !== null) { - $data['model'] = $object->getModel(); - } - if ($object->isInitialized('nEpochs') && $object->getNEpochs() !== null) { - $data['n_epochs'] = $object->getNEpochs(); - } if ($object->isInitialized('batchSize') && $object->getBatchSize() !== null) { $data['batch_size'] = $object->getBatchSize(); } - if ($object->isInitialized('learningRateMultiplier') && $object->getLearningRateMultiplier() !== null) { - $data['learning_rate_multiplier'] = $object->getLearningRateMultiplier(); - } - if ($object->isInitialized('promptLossWeight') && $object->getPromptLossWeight() !== null) { - $data['prompt_loss_weight'] = $object->getPromptLossWeight(); - } - if ($object->isInitialized('computeClassificationMetrics') && $object->getComputeClassificationMetrics() !== null) { - $data['compute_classification_metrics'] = $object->getComputeClassificationMetrics(); + if ($object->isInitialized('classificationBetas') && $object->getClassificationBetas() !== null) { + $values = []; + foreach ($object->getClassificationBetas() as $value) { + $values[] = $value; + } + $data['classification_betas'] = $values; } if ($object->isInitialized('classificationNClasses') && $object->getClassificationNClasses() !== null) { $data['classification_n_classes'] = $object->getClassificationNClasses(); @@ -170,16 +158,27 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('classificationPositiveClass') && $object->getClassificationPositiveClass() !== null) { $data['classification_positive_class'] = $object->getClassificationPositiveClass(); } - if ($object->isInitialized('classificationBetas') && $object->getClassificationBetas() !== null) { - $values = []; - foreach ($object->getClassificationBetas() as $value) { - $values[] = $value; - } - $data['classification_betas'] = $values; + if ($object->isInitialized('computeClassificationMetrics') && $object->getComputeClassificationMetrics() !== null) { + $data['compute_classification_metrics'] = $object->getComputeClassificationMetrics(); + } + if ($object->isInitialized('hyperparameters') && $object->getHyperparameters() !== null) { + $data['hyperparameters'] = $this->normalizer->normalize($object->getHyperparameters(), 'json', $context); + } + if ($object->isInitialized('learningRateMultiplier') && $object->getLearningRateMultiplier() !== null) { + $data['learning_rate_multiplier'] = $object->getLearningRateMultiplier(); + } + if ($object->isInitialized('model') && $object->getModel() !== null) { + $data['model'] = $object->getModel(); + } + if ($object->isInitialized('promptLossWeight') && $object->getPromptLossWeight() !== null) { + $data['prompt_loss_weight'] = $object->getPromptLossWeight(); } if ($object->isInitialized('suffix') && $object->getSuffix() !== null) { $data['suffix'] = $object->getSuffix(); } + if ($object->isInitialized('validationFile') && $object->getValidationFile() !== null) { + $data['validation_file'] = $object->getValidationFile(); + } foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value_1; @@ -187,4 +186,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateFineTuneRequest::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateFineTuningJobRequestHyperparametersNormalizer.php b/generated/Normalizer/CreateFineTuningJobRequestHyperparametersNormalizer.php new file mode 100644 index 0000000..e4291dc --- /dev/null +++ b/generated/Normalizer/CreateFineTuningJobRequestHyperparametersNormalizer.php @@ -0,0 +1,100 @@ +setBatchSize($data['batch_size']); + unset($data['batch_size']); + } + if (\array_key_exists('learning_rate_multiplier', $data)) { + $object->setLearningRateMultiplier($data['learning_rate_multiplier']); + unset($data['learning_rate_multiplier']); + } + if (\array_key_exists('n_epochs', $data)) { + $object->setNEpochs($data['n_epochs']); + unset($data['n_epochs']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('batchSize') && $object->getBatchSize() !== null) { + $data['batch_size'] = $object->getBatchSize(); + } + if ($object->isInitialized('learningRateMultiplier') && $object->getLearningRateMultiplier() !== null) { + $data['learning_rate_multiplier'] = $object->getLearningRateMultiplier(); + } + if ($object->isInitialized('nEpochs') && $object->getNEpochs() !== null) { + $data['n_epochs'] = $object->getNEpochs(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateFineTuningJobRequestHyperparameters::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateFineTuningJobRequestNormalizer.php b/generated/Normalizer/CreateFineTuningJobRequestNormalizer.php new file mode 100644 index 0000000..3d44aa5 --- /dev/null +++ b/generated/Normalizer/CreateFineTuningJobRequestNormalizer.php @@ -0,0 +1,115 @@ +setModel($data['model']); + unset($data['model']); + } + if (\array_key_exists('training_file', $data)) { + $object->setTrainingFile($data['training_file']); + unset($data['training_file']); + } + if (\array_key_exists('hyperparameters', $data)) { + $object->setHyperparameters($this->denormalizer->denormalize($data['hyperparameters'], CreateFineTuningJobRequestHyperparameters::class, 'json', $context)); + unset($data['hyperparameters']); + } + if (\array_key_exists('suffix', $data) && $data['suffix'] !== null) { + $object->setSuffix($data['suffix']); + unset($data['suffix']); + } elseif (\array_key_exists('suffix', $data) && $data['suffix'] === null) { + $object->setSuffix(null); + } + if (\array_key_exists('validation_file', $data) && $data['validation_file'] !== null) { + $object->setValidationFile($data['validation_file']); + unset($data['validation_file']); + } elseif (\array_key_exists('validation_file', $data) && $data['validation_file'] === null) { + $object->setValidationFile(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['model'] = $object->getModel(); + $data['training_file'] = $object->getTrainingFile(); + if ($object->isInitialized('hyperparameters') && $object->getHyperparameters() !== null) { + $data['hyperparameters'] = $this->normalizer->normalize($object->getHyperparameters(), 'json', $context); + } + if ($object->isInitialized('suffix') && $object->getSuffix() !== null) { + $data['suffix'] = $object->getSuffix(); + } + if ($object->isInitialized('validationFile') && $object->getValidationFile() !== null) { + $data['validation_file'] = $object->getValidationFile(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateFineTuningJobRequest::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateImageEditRequestNormalizer.php b/generated/Normalizer/CreateImageEditRequestNormalizer.php index 152858e..ae7a557 100644 --- a/generated/Normalizer/CreateImageEditRequestNormalizer.php +++ b/generated/Normalizer/CreateImageEditRequestNormalizer.php @@ -23,12 +23,12 @@ class CreateImageEditRequestNormalizer implements DenormalizerInterface, Normali use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateImageEditRequest::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateImageEditRequest::class; } @@ -52,13 +52,19 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setImage($data['image']); unset($data['image']); } + if (\array_key_exists('prompt', $data)) { + $object->setPrompt($data['prompt']); + unset($data['prompt']); + } if (\array_key_exists('mask', $data)) { $object->setMask($data['mask']); unset($data['mask']); } - if (\array_key_exists('prompt', $data)) { - $object->setPrompt($data['prompt']); - unset($data['prompt']); + if (\array_key_exists('model', $data) && $data['model'] !== null) { + $object->setModel($data['model']); + unset($data['model']); + } elseif (\array_key_exists('model', $data) && $data['model'] === null) { + $object->setModel(null); } if (\array_key_exists('n', $data) && $data['n'] !== null) { $object->setN($data['n']); @@ -97,10 +103,13 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['image'] = $object->getImage(); + $data['prompt'] = $object->getPrompt(); if ($object->isInitialized('mask') && $object->getMask() !== null) { $data['mask'] = $object->getMask(); } - $data['prompt'] = $object->getPrompt(); + if ($object->isInitialized('model') && $object->getModel() !== null) { + $data['model'] = $object->getModel(); + } if ($object->isInitialized('n') && $object->getN() !== null) { $data['n'] = $object->getN(); } @@ -120,4 +129,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateImageEditRequest::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateImageRequestNormalizer.php b/generated/Normalizer/CreateImageRequestNormalizer.php index 438753a..db13f16 100644 --- a/generated/Normalizer/CreateImageRequestNormalizer.php +++ b/generated/Normalizer/CreateImageRequestNormalizer.php @@ -23,12 +23,12 @@ class CreateImageRequestNormalizer implements DenormalizerInterface, NormalizerI use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateImageRequest::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateImageRequest::class; } @@ -52,17 +52,21 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setPrompt($data['prompt']); unset($data['prompt']); } + if (\array_key_exists('model', $data) && $data['model'] !== null) { + $object->setModel($data['model']); + unset($data['model']); + } elseif (\array_key_exists('model', $data) && $data['model'] === null) { + $object->setModel(null); + } if (\array_key_exists('n', $data) && $data['n'] !== null) { $object->setN($data['n']); unset($data['n']); } elseif (\array_key_exists('n', $data) && $data['n'] === null) { $object->setN(null); } - if (\array_key_exists('size', $data) && $data['size'] !== null) { - $object->setSize($data['size']); - unset($data['size']); - } elseif (\array_key_exists('size', $data) && $data['size'] === null) { - $object->setSize(null); + if (\array_key_exists('quality', $data)) { + $object->setQuality($data['quality']); + unset($data['quality']); } if (\array_key_exists('response_format', $data) && $data['response_format'] !== null) { $object->setResponseFormat($data['response_format']); @@ -70,6 +74,18 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('response_format', $data) && $data['response_format'] === null) { $object->setResponseFormat(null); } + if (\array_key_exists('size', $data) && $data['size'] !== null) { + $object->setSize($data['size']); + unset($data['size']); + } elseif (\array_key_exists('size', $data) && $data['size'] === null) { + $object->setSize(null); + } + if (\array_key_exists('style', $data) && $data['style'] !== null) { + $object->setStyle($data['style']); + unset($data['style']); + } elseif (\array_key_exists('style', $data) && $data['style'] === null) { + $object->setStyle(null); + } if (\array_key_exists('user', $data)) { $object->setUser($data['user']); unset($data['user']); @@ -89,15 +105,24 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['prompt'] = $object->getPrompt(); + if ($object->isInitialized('model') && $object->getModel() !== null) { + $data['model'] = $object->getModel(); + } if ($object->isInitialized('n') && $object->getN() !== null) { $data['n'] = $object->getN(); } - if ($object->isInitialized('size') && $object->getSize() !== null) { - $data['size'] = $object->getSize(); + if ($object->isInitialized('quality') && $object->getQuality() !== null) { + $data['quality'] = $object->getQuality(); } if ($object->isInitialized('responseFormat') && $object->getResponseFormat() !== null) { $data['response_format'] = $object->getResponseFormat(); } + if ($object->isInitialized('size') && $object->getSize() !== null) { + $data['size'] = $object->getSize(); + } + if ($object->isInitialized('style') && $object->getStyle() !== null) { + $data['style'] = $object->getStyle(); + } if ($object->isInitialized('user') && $object->getUser() !== null) { $data['user'] = $object->getUser(); } @@ -108,4 +133,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateImageRequest::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateImageVariationRequestNormalizer.php b/generated/Normalizer/CreateImageVariationRequestNormalizer.php index a968122..4915aef 100644 --- a/generated/Normalizer/CreateImageVariationRequestNormalizer.php +++ b/generated/Normalizer/CreateImageVariationRequestNormalizer.php @@ -23,12 +23,12 @@ class CreateImageVariationRequestNormalizer implements DenormalizerInterface, No use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateImageVariationRequest::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateImageVariationRequest::class; } @@ -52,24 +52,30 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setImage($data['image']); unset($data['image']); } + if (\array_key_exists('model', $data) && $data['model'] !== null) { + $object->setModel($data['model']); + unset($data['model']); + } elseif (\array_key_exists('model', $data) && $data['model'] === null) { + $object->setModel(null); + } if (\array_key_exists('n', $data) && $data['n'] !== null) { $object->setN($data['n']); unset($data['n']); } elseif (\array_key_exists('n', $data) && $data['n'] === null) { $object->setN(null); } - if (\array_key_exists('size', $data) && $data['size'] !== null) { - $object->setSize($data['size']); - unset($data['size']); - } elseif (\array_key_exists('size', $data) && $data['size'] === null) { - $object->setSize(null); - } if (\array_key_exists('response_format', $data) && $data['response_format'] !== null) { $object->setResponseFormat($data['response_format']); unset($data['response_format']); } elseif (\array_key_exists('response_format', $data) && $data['response_format'] === null) { $object->setResponseFormat(null); } + if (\array_key_exists('size', $data) && $data['size'] !== null) { + $object->setSize($data['size']); + unset($data['size']); + } elseif (\array_key_exists('size', $data) && $data['size'] === null) { + $object->setSize(null); + } if (\array_key_exists('user', $data)) { $object->setUser($data['user']); unset($data['user']); @@ -89,15 +95,18 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['image'] = $object->getImage(); + if ($object->isInitialized('model') && $object->getModel() !== null) { + $data['model'] = $object->getModel(); + } if ($object->isInitialized('n') && $object->getN() !== null) { $data['n'] = $object->getN(); } - if ($object->isInitialized('size') && $object->getSize() !== null) { - $data['size'] = $object->getSize(); - } if ($object->isInitialized('responseFormat') && $object->getResponseFormat() !== null) { $data['response_format'] = $object->getResponseFormat(); } + if ($object->isInitialized('size') && $object->getSize() !== null) { + $data['size'] = $object->getSize(); + } if ($object->isInitialized('user') && $object->getUser() !== null) { $data['user'] = $object->getUser(); } @@ -108,4 +117,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateImageVariationRequest::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateMessageRequestNormalizer.php b/generated/Normalizer/CreateMessageRequestNormalizer.php new file mode 100644 index 0000000..f129aa6 --- /dev/null +++ b/generated/Normalizer/CreateMessageRequestNormalizer.php @@ -0,0 +1,107 @@ +setRole($data['role']); + } + if (\array_key_exists('content', $data)) { + $object->setContent($data['content']); + } + if (\array_key_exists('file_ids', $data)) { + $values = []; + foreach ($data['file_ids'] as $value) { + $values[] = $value; + } + $object->setFileIds($values); + } + if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { + $values_1 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['metadata'] as $key => $value_1) { + $values_1[$key] = $value_1; + } + $object->setMetadata($values_1); + } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { + $object->setMetadata(null); + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['role'] = $object->getRole(); + $data['content'] = $object->getContent(); + if ($object->isInitialized('fileIds') && $object->getFileIds() !== null) { + $values = []; + foreach ($object->getFileIds() as $value) { + $values[] = $value; + } + $data['file_ids'] = $values; + } + if ($object->isInitialized('metadata') && $object->getMetadata() !== null) { + $values_1 = []; + foreach ($object->getMetadata() as $key => $value_1) { + $values_1[$key] = $value_1; + } + $data['metadata'] = $values_1; + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateMessageRequest::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateModerationRequestNormalizer.php b/generated/Normalizer/CreateModerationRequestNormalizer.php index 0c598a0..b768f51 100644 --- a/generated/Normalizer/CreateModerationRequestNormalizer.php +++ b/generated/Normalizer/CreateModerationRequestNormalizer.php @@ -23,12 +23,12 @@ class CreateModerationRequestNormalizer implements DenormalizerInterface, Normal use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateModerationRequest::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateModerationRequest::class; } @@ -81,4 +81,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateModerationRequest::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateModerationResponseNormalizer.php b/generated/Normalizer/CreateModerationResponseNormalizer.php index 2d57164..3e198ab 100644 --- a/generated/Normalizer/CreateModerationResponseNormalizer.php +++ b/generated/Normalizer/CreateModerationResponseNormalizer.php @@ -24,12 +24,12 @@ class CreateModerationResponseNormalizer implements DenormalizerInterface, Norma use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateModerationResponse::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateModerationResponse::class; } @@ -93,4 +93,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateModerationResponse::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateModerationResponseResultsItemCategoriesNormalizer.php b/generated/Normalizer/CreateModerationResponseResultsItemCategoriesNormalizer.php index 943db97..e569460 100644 --- a/generated/Normalizer/CreateModerationResponseResultsItemCategoriesNormalizer.php +++ b/generated/Normalizer/CreateModerationResponseResultsItemCategoriesNormalizer.php @@ -23,12 +23,12 @@ class CreateModerationResponseResultsItemCategoriesNormalizer implements Denorma use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateModerationResponseResultsItemCategories::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateModerationResponseResultsItemCategories::class; } @@ -56,10 +56,26 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setHateThreatening($data['hate/threatening']); unset($data['hate/threatening']); } + if (\array_key_exists('harassment', $data)) { + $object->setHarassment($data['harassment']); + unset($data['harassment']); + } + if (\array_key_exists('harassment/threatening', $data)) { + $object->setHarassmentThreatening($data['harassment/threatening']); + unset($data['harassment/threatening']); + } if (\array_key_exists('self-harm', $data)) { $object->setSelfHarm($data['self-harm']); unset($data['self-harm']); } + if (\array_key_exists('self-harm/intent', $data)) { + $object->setSelfHarmIntent($data['self-harm/intent']); + unset($data['self-harm/intent']); + } + if (\array_key_exists('self-harm/instructions', $data)) { + $object->setSelfHarmInstructions($data['self-harm/instructions']); + unset($data['self-harm/instructions']); + } if (\array_key_exists('sexual', $data)) { $object->setSexual($data['sexual']); unset($data['sexual']); @@ -92,7 +108,11 @@ public function normalize($object, $format = null, array $context = []) $data = []; $data['hate'] = $object->getHate(); $data['hate/threatening'] = $object->getHateThreatening(); + $data['harassment'] = $object->getHarassment(); + $data['harassment/threatening'] = $object->getHarassmentThreatening(); $data['self-harm'] = $object->getSelfHarm(); + $data['self-harm/intent'] = $object->getSelfHarmIntent(); + $data['self-harm/instructions'] = $object->getSelfHarmInstructions(); $data['sexual'] = $object->getSexual(); $data['sexual/minors'] = $object->getSexualMinors(); $data['violence'] = $object->getViolence(); @@ -104,4 +124,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateModerationResponseResultsItemCategories::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateModerationResponseResultsItemCategoryScoresNormalizer.php b/generated/Normalizer/CreateModerationResponseResultsItemCategoryScoresNormalizer.php index ea98a27..409233f 100644 --- a/generated/Normalizer/CreateModerationResponseResultsItemCategoryScoresNormalizer.php +++ b/generated/Normalizer/CreateModerationResponseResultsItemCategoryScoresNormalizer.php @@ -23,12 +23,12 @@ class CreateModerationResponseResultsItemCategoryScoresNormalizer implements Den use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateModerationResponseResultsItemCategoryScores::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateModerationResponseResultsItemCategoryScores::class; } @@ -51,9 +51,21 @@ public function denormalize($data, $class, $format = null, array $context = []) if (\array_key_exists('hate/threatening', $data) && \is_int($data['hate/threatening'])) { $data['hate/threatening'] = (float) $data['hate/threatening']; } + if (\array_key_exists('harassment', $data) && \is_int($data['harassment'])) { + $data['harassment'] = (float) $data['harassment']; + } + if (\array_key_exists('harassment/threatening', $data) && \is_int($data['harassment/threatening'])) { + $data['harassment/threatening'] = (float) $data['harassment/threatening']; + } if (\array_key_exists('self-harm', $data) && \is_int($data['self-harm'])) { $data['self-harm'] = (float) $data['self-harm']; } + if (\array_key_exists('self-harm/intent', $data) && \is_int($data['self-harm/intent'])) { + $data['self-harm/intent'] = (float) $data['self-harm/intent']; + } + if (\array_key_exists('self-harm/instructions', $data) && \is_int($data['self-harm/instructions'])) { + $data['self-harm/instructions'] = (float) $data['self-harm/instructions']; + } if (\array_key_exists('sexual', $data) && \is_int($data['sexual'])) { $data['sexual'] = (float) $data['sexual']; } @@ -77,10 +89,26 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setHateThreatening($data['hate/threatening']); unset($data['hate/threatening']); } + if (\array_key_exists('harassment', $data)) { + $object->setHarassment($data['harassment']); + unset($data['harassment']); + } + if (\array_key_exists('harassment/threatening', $data)) { + $object->setHarassmentThreatening($data['harassment/threatening']); + unset($data['harassment/threatening']); + } if (\array_key_exists('self-harm', $data)) { $object->setSelfHarm($data['self-harm']); unset($data['self-harm']); } + if (\array_key_exists('self-harm/intent', $data)) { + $object->setSelfHarmIntent($data['self-harm/intent']); + unset($data['self-harm/intent']); + } + if (\array_key_exists('self-harm/instructions', $data)) { + $object->setSelfHarmInstructions($data['self-harm/instructions']); + unset($data['self-harm/instructions']); + } if (\array_key_exists('sexual', $data)) { $object->setSexual($data['sexual']); unset($data['sexual']); @@ -113,7 +141,11 @@ public function normalize($object, $format = null, array $context = []) $data = []; $data['hate'] = $object->getHate(); $data['hate/threatening'] = $object->getHateThreatening(); + $data['harassment'] = $object->getHarassment(); + $data['harassment/threatening'] = $object->getHarassmentThreatening(); $data['self-harm'] = $object->getSelfHarm(); + $data['self-harm/intent'] = $object->getSelfHarmIntent(); + $data['self-harm/instructions'] = $object->getSelfHarmInstructions(); $data['sexual'] = $object->getSexual(); $data['sexual/minors'] = $object->getSexualMinors(); $data['violence'] = $object->getViolence(); @@ -125,4 +157,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateModerationResponseResultsItemCategoryScores::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateModerationResponseResultsItemNormalizer.php b/generated/Normalizer/CreateModerationResponseResultsItemNormalizer.php index eb3fed9..459e939 100644 --- a/generated/Normalizer/CreateModerationResponseResultsItemNormalizer.php +++ b/generated/Normalizer/CreateModerationResponseResultsItemNormalizer.php @@ -25,12 +25,12 @@ class CreateModerationResponseResultsItemNormalizer implements DenormalizerInter use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateModerationResponseResultsItem::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateModerationResponseResultsItem::class; } @@ -86,4 +86,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateModerationResponseResultsItem::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateRunRequestNormalizer.php b/generated/Normalizer/CreateRunRequestNormalizer.php new file mode 100644 index 0000000..8ff4083 --- /dev/null +++ b/generated/Normalizer/CreateRunRequestNormalizer.php @@ -0,0 +1,129 @@ +setAssistantId($data['assistant_id']); + } + if (\array_key_exists('model', $data) && $data['model'] !== null) { + $object->setModel($data['model']); + } elseif (\array_key_exists('model', $data) && $data['model'] === null) { + $object->setModel(null); + } + if (\array_key_exists('instructions', $data) && $data['instructions'] !== null) { + $object->setInstructions($data['instructions']); + } elseif (\array_key_exists('instructions', $data) && $data['instructions'] === null) { + $object->setInstructions(null); + } + if (\array_key_exists('additional_instructions', $data) && $data['additional_instructions'] !== null) { + $object->setAdditionalInstructions($data['additional_instructions']); + } elseif (\array_key_exists('additional_instructions', $data) && $data['additional_instructions'] === null) { + $object->setAdditionalInstructions(null); + } + if (\array_key_exists('tools', $data) && $data['tools'] !== null) { + $values = []; + foreach ($data['tools'] as $value) { + $values[] = $value; + } + $object->setTools($values); + } elseif (\array_key_exists('tools', $data) && $data['tools'] === null) { + $object->setTools(null); + } + if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { + $values_1 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['metadata'] as $key => $value_1) { + $values_1[$key] = $value_1; + } + $object->setMetadata($values_1); + } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { + $object->setMetadata(null); + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['assistant_id'] = $object->getAssistantId(); + if ($object->isInitialized('model') && $object->getModel() !== null) { + $data['model'] = $object->getModel(); + } + if ($object->isInitialized('instructions') && $object->getInstructions() !== null) { + $data['instructions'] = $object->getInstructions(); + } + if ($object->isInitialized('additionalInstructions') && $object->getAdditionalInstructions() !== null) { + $data['additional_instructions'] = $object->getAdditionalInstructions(); + } + if ($object->isInitialized('tools') && $object->getTools() !== null) { + $values = []; + foreach ($object->getTools() as $value) { + $values[] = $value; + } + $data['tools'] = $values; + } + if ($object->isInitialized('metadata') && $object->getMetadata() !== null) { + $values_1 = []; + foreach ($object->getMetadata() as $key => $value_1) { + $values_1[$key] = $value_1; + } + $data['metadata'] = $values_1; + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateRunRequest::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateSearchRequestNormalizer.php b/generated/Normalizer/CreateSearchRequestNormalizer.php deleted file mode 100644 index 792a792..0000000 --- a/generated/Normalizer/CreateSearchRequestNormalizer.php +++ /dev/null @@ -1,128 +0,0 @@ -setQuery($data['query']); - unset($data['query']); - } - if (\array_key_exists('documents', $data) && $data['documents'] !== null) { - $values = []; - foreach ($data['documents'] as $value) { - $values[] = $value; - } - $object->setDocuments($values); - unset($data['documents']); - } elseif (\array_key_exists('documents', $data) && $data['documents'] === null) { - $object->setDocuments(null); - } - if (\array_key_exists('file', $data) && $data['file'] !== null) { - $object->setFile($data['file']); - unset($data['file']); - } elseif (\array_key_exists('file', $data) && $data['file'] === null) { - $object->setFile(null); - } - if (\array_key_exists('max_rerank', $data) && $data['max_rerank'] !== null) { - $object->setMaxRerank($data['max_rerank']); - unset($data['max_rerank']); - } elseif (\array_key_exists('max_rerank', $data) && $data['max_rerank'] === null) { - $object->setMaxRerank(null); - } - if (\array_key_exists('return_metadata', $data) && $data['return_metadata'] !== null) { - $object->setReturnMetadata($data['return_metadata']); - unset($data['return_metadata']); - } elseif (\array_key_exists('return_metadata', $data) && $data['return_metadata'] === null) { - $object->setReturnMetadata(null); - } - if (\array_key_exists('user', $data)) { - $object->setUser($data['user']); - unset($data['user']); - } - foreach ($data as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; - } - } - return $object; - } - - /** - * @return array|string|int|float|bool|ArrayObject|null - */ - public function normalize($object, $format = null, array $context = []) - { - $data = []; - $data['query'] = $object->getQuery(); - if ($object->isInitialized('documents') && $object->getDocuments() !== null) { - $values = []; - foreach ($object->getDocuments() as $value) { - $values[] = $value; - } - $data['documents'] = $values; - } - if ($object->isInitialized('file') && $object->getFile() !== null) { - $data['file'] = $object->getFile(); - } - if ($object->isInitialized('maxRerank') && $object->getMaxRerank() !== null) { - $data['max_rerank'] = $object->getMaxRerank(); - } - if ($object->isInitialized('returnMetadata') && $object->getReturnMetadata() !== null) { - $data['return_metadata'] = $object->getReturnMetadata(); - } - if ($object->isInitialized('user') && $object->getUser() !== null) { - $data['user'] = $object->getUser(); - } - foreach ($object as $key => $value_1) { - if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; - } - } - return $data; - } -} diff --git a/generated/Normalizer/CreateSpeechRequestNormalizer.php b/generated/Normalizer/CreateSpeechRequestNormalizer.php new file mode 100644 index 0000000..ed6b0b1 --- /dev/null +++ b/generated/Normalizer/CreateSpeechRequestNormalizer.php @@ -0,0 +1,96 @@ +setModel($data['model']); + } + if (\array_key_exists('input', $data)) { + $object->setInput($data['input']); + } + if (\array_key_exists('voice', $data)) { + $object->setVoice($data['voice']); + } + if (\array_key_exists('response_format', $data)) { + $object->setResponseFormat($data['response_format']); + } + if (\array_key_exists('speed', $data)) { + $object->setSpeed($data['speed']); + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['model'] = $object->getModel(); + $data['input'] = $object->getInput(); + $data['voice'] = $object->getVoice(); + if ($object->isInitialized('responseFormat') && $object->getResponseFormat() !== null) { + $data['response_format'] = $object->getResponseFormat(); + } + if ($object->isInitialized('speed') && $object->getSpeed() !== null) { + $data['speed'] = $object->getSpeed(); + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateSpeechRequest::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateThreadAndRunRequestNormalizer.php b/generated/Normalizer/CreateThreadAndRunRequestNormalizer.php new file mode 100644 index 0000000..ec0f7fa --- /dev/null +++ b/generated/Normalizer/CreateThreadAndRunRequestNormalizer.php @@ -0,0 +1,128 @@ +setAssistantId($data['assistant_id']); + } + if (\array_key_exists('thread', $data)) { + $object->setThread($this->denormalizer->denormalize($data['thread'], CreateThreadRequest::class, 'json', $context)); + } + if (\array_key_exists('model', $data) && $data['model'] !== null) { + $object->setModel($data['model']); + } elseif (\array_key_exists('model', $data) && $data['model'] === null) { + $object->setModel(null); + } + if (\array_key_exists('instructions', $data) && $data['instructions'] !== null) { + $object->setInstructions($data['instructions']); + } elseif (\array_key_exists('instructions', $data) && $data['instructions'] === null) { + $object->setInstructions(null); + } + if (\array_key_exists('tools', $data) && $data['tools'] !== null) { + $values = []; + foreach ($data['tools'] as $value) { + $values[] = $value; + } + $object->setTools($values); + } elseif (\array_key_exists('tools', $data) && $data['tools'] === null) { + $object->setTools(null); + } + if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { + $values_1 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['metadata'] as $key => $value_1) { + $values_1[$key] = $value_1; + } + $object->setMetadata($values_1); + } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { + $object->setMetadata(null); + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['assistant_id'] = $object->getAssistantId(); + if ($object->isInitialized('thread') && $object->getThread() !== null) { + $data['thread'] = $this->normalizer->normalize($object->getThread(), 'json', $context); + } + if ($object->isInitialized('model') && $object->getModel() !== null) { + $data['model'] = $object->getModel(); + } + if ($object->isInitialized('instructions') && $object->getInstructions() !== null) { + $data['instructions'] = $object->getInstructions(); + } + if ($object->isInitialized('tools') && $object->getTools() !== null) { + $values = []; + foreach ($object->getTools() as $value) { + $values[] = $value; + } + $data['tools'] = $values; + } + if ($object->isInitialized('metadata') && $object->getMetadata() !== null) { + $values_1 = []; + foreach ($object->getMetadata() as $key => $value_1) { + $values_1[$key] = $value_1; + } + $data['metadata'] = $values_1; + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateThreadAndRunRequest::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateThreadRequestNormalizer.php b/generated/Normalizer/CreateThreadRequestNormalizer.php new file mode 100644 index 0000000..0a41ecd --- /dev/null +++ b/generated/Normalizer/CreateThreadRequestNormalizer.php @@ -0,0 +1,100 @@ +denormalizer->denormalize($value, CreateMessageRequest::class, 'json', $context); + } + $object->setMessages($values); + } + if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { + $values_1 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['metadata'] as $key => $value_1) { + $values_1[$key] = $value_1; + } + $object->setMetadata($values_1); + } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { + $object->setMetadata(null); + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('messages') && $object->getMessages() !== null) { + $values = []; + foreach ($object->getMessages() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['messages'] = $values; + } + if ($object->isInitialized('metadata') && $object->getMetadata() !== null) { + $values_1 = []; + foreach ($object->getMetadata() as $key => $value_1) { + $values_1[$key] = $value_1; + } + $data['metadata'] = $values_1; + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateThreadRequest::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateTranscriptionRequestNormalizer.php b/generated/Normalizer/CreateTranscriptionRequestNormalizer.php index 831e48d..2b452b8 100644 --- a/generated/Normalizer/CreateTranscriptionRequestNormalizer.php +++ b/generated/Normalizer/CreateTranscriptionRequestNormalizer.php @@ -4,6 +4,7 @@ namespace Sourceability\OpenAIClient\Generated\Normalizer; +use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; use Sourceability\OpenAIClient\Generated\Model\CreateTranscriptionRequest; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; @@ -22,12 +23,12 @@ class CreateTranscriptionRequestNormalizer implements DenormalizerInterface, Nor use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateTranscriptionRequest::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateTranscriptionRequest::class; } @@ -56,6 +57,9 @@ public function denormalize($data, $class, $format = null, array $context = []) if (\array_key_exists('model', $data)) { $object->setModel($data['model']); } + if (\array_key_exists('language', $data)) { + $object->setLanguage($data['language']); + } if (\array_key_exists('prompt', $data)) { $object->setPrompt($data['prompt']); } @@ -65,20 +69,20 @@ public function denormalize($data, $class, $format = null, array $context = []) if (\array_key_exists('temperature', $data)) { $object->setTemperature($data['temperature']); } - if (\array_key_exists('language', $data)) { - $object->setLanguage($data['language']); - } return $object; } /** - * @return array{file: mixed, model: mixed, prompt?: mixed, response_format?: mixed, temperature?: mixed, language?: mixed} + * @return array|string|int|float|bool|ArrayObject|null */ public function normalize($object, $format = null, array $context = []) { $data = []; $data['file'] = $object->getFile(); $data['model'] = $object->getModel(); + if ($object->isInitialized('language') && $object->getLanguage() !== null) { + $data['language'] = $object->getLanguage(); + } if ($object->isInitialized('prompt') && $object->getPrompt() !== null) { $data['prompt'] = $object->getPrompt(); } @@ -88,9 +92,13 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('temperature') && $object->getTemperature() !== null) { $data['temperature'] = $object->getTemperature(); } - if ($object->isInitialized('language') && $object->getLanguage() !== null) { - $data['language'] = $object->getLanguage(); - } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateTranscriptionRequest::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateTranscriptionResponseNormalizer.php b/generated/Normalizer/CreateTranscriptionResponseNormalizer.php index 7114906..b830318 100644 --- a/generated/Normalizer/CreateTranscriptionResponseNormalizer.php +++ b/generated/Normalizer/CreateTranscriptionResponseNormalizer.php @@ -23,12 +23,12 @@ class CreateTranscriptionResponseNormalizer implements DenormalizerInterface, No use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateTranscriptionResponse::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateTranscriptionResponse::class; } @@ -74,4 +74,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateTranscriptionResponse::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateTranslationRequestNormalizer.php b/generated/Normalizer/CreateTranslationRequestNormalizer.php index f5f51bd..59bc264 100644 --- a/generated/Normalizer/CreateTranslationRequestNormalizer.php +++ b/generated/Normalizer/CreateTranslationRequestNormalizer.php @@ -4,6 +4,7 @@ namespace Sourceability\OpenAIClient\Generated\Normalizer; +use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; use Sourceability\OpenAIClient\Generated\Model\CreateTranslationRequest; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; @@ -22,12 +23,12 @@ class CreateTranslationRequestNormalizer implements DenormalizerInterface, Norma use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateTranslationRequest::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateTranslationRequest::class; } @@ -69,7 +70,7 @@ public function denormalize($data, $class, $format = null, array $context = []) } /** - * @return array{file: mixed, model: mixed, prompt?: mixed, response_format?: mixed, temperature?: mixed} + * @return array|string|int|float|bool|ArrayObject|null */ public function normalize($object, $format = null, array $context = []) { @@ -87,4 +88,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateTranslationRequest::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateTranslationResponseNormalizer.php b/generated/Normalizer/CreateTranslationResponseNormalizer.php index 92235f8..0424ac8 100644 --- a/generated/Normalizer/CreateTranslationResponseNormalizer.php +++ b/generated/Normalizer/CreateTranslationResponseNormalizer.php @@ -23,12 +23,12 @@ class CreateTranslationResponseNormalizer implements DenormalizerInterface, Norm use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === CreateTranslationResponse::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === CreateTranslationResponse::class; } @@ -74,4 +74,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + CreateTranslationResponse::class => false, + ]; + } } diff --git a/generated/Normalizer/EngineNormalizer.php b/generated/Normalizer/DeleteAssistantFileResponseNormalizer.php similarity index 71% rename from generated/Normalizer/EngineNormalizer.php rename to generated/Normalizer/DeleteAssistantFileResponseNormalizer.php index dddadeb..9e6b27a 100644 --- a/generated/Normalizer/EngineNormalizer.php +++ b/generated/Normalizer/DeleteAssistantFileResponseNormalizer.php @@ -6,7 +6,7 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; -use Sourceability\OpenAIClient\Generated\Model\Engine; +use Sourceability\OpenAIClient\Generated\Model\DeleteAssistantFileResponse; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -16,21 +16,21 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class EngineNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class DeleteAssistantFileResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { use DenormalizerAwareTrait; use NormalizerAwareTrait; use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { - return $type === Engine::class; + return $type === DeleteAssistantFileResponse::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { - return is_object($data) && $data::class === Engine::class; + return is_object($data) && $data::class === DeleteAssistantFileResponse::class; } /** @@ -44,7 +44,7 @@ public function denormalize($data, $class, $format = null, array $context = []) if (isset($data['$recursiveRef'])) { return new Reference($data['$recursiveRef'], $context['document-origin']); } - $object = new Engine(); + $object = new DeleteAssistantFileResponse(); if ($data === null || \is_array($data) === false) { return $object; } @@ -52,20 +52,14 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } + if (\array_key_exists('deleted', $data)) { + $object->setDeleted($data['deleted']); + unset($data['deleted']); + } if (\array_key_exists('object', $data)) { $object->setObject($data['object']); unset($data['object']); } - if (\array_key_exists('created', $data) && $data['created'] !== null) { - $object->setCreated($data['created']); - unset($data['created']); - } elseif (\array_key_exists('created', $data) && $data['created'] === null) { - $object->setCreated(null); - } - if (\array_key_exists('ready', $data)) { - $object->setReady($data['ready']); - unset($data['ready']); - } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -81,9 +75,8 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); + $data['deleted'] = $object->getDeleted(); $data['object'] = $object->getObject(); - $data['created'] = $object->getCreated(); - $data['ready'] = $object->getReady(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; @@ -91,4 +84,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + DeleteAssistantFileResponse::class => false, + ]; + } } diff --git a/generated/Normalizer/DeleteAssistantResponseNormalizer.php b/generated/Normalizer/DeleteAssistantResponseNormalizer.php new file mode 100644 index 0000000..3e3ebab --- /dev/null +++ b/generated/Normalizer/DeleteAssistantResponseNormalizer.php @@ -0,0 +1,94 @@ +setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('deleted', $data)) { + $object->setDeleted($data['deleted']); + unset($data['deleted']); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['id'] = $object->getId(); + $data['deleted'] = $object->getDeleted(); + $data['object'] = $object->getObject(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + DeleteAssistantResponse::class => false, + ]; + } +} diff --git a/generated/Normalizer/DeleteFileResponseNormalizer.php b/generated/Normalizer/DeleteFileResponseNormalizer.php index 2b5ec76..54f35e5 100644 --- a/generated/Normalizer/DeleteFileResponseNormalizer.php +++ b/generated/Normalizer/DeleteFileResponseNormalizer.php @@ -23,12 +23,12 @@ class DeleteFileResponseNormalizer implements DenormalizerInterface, NormalizerI use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === DeleteFileResponse::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === DeleteFileResponse::class; } @@ -84,4 +84,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + DeleteFileResponse::class => false, + ]; + } } diff --git a/generated/Normalizer/DeleteMessageResponseNormalizer.php b/generated/Normalizer/DeleteMessageResponseNormalizer.php new file mode 100644 index 0000000..a290c10 --- /dev/null +++ b/generated/Normalizer/DeleteMessageResponseNormalizer.php @@ -0,0 +1,94 @@ +setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('deleted', $data)) { + $object->setDeleted($data['deleted']); + unset($data['deleted']); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['id'] = $object->getId(); + $data['deleted'] = $object->getDeleted(); + $data['object'] = $object->getObject(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + DeleteMessageResponse::class => false, + ]; + } +} diff --git a/generated/Normalizer/DeleteModelResponseNormalizer.php b/generated/Normalizer/DeleteModelResponseNormalizer.php index 2823708..0c8a7db 100644 --- a/generated/Normalizer/DeleteModelResponseNormalizer.php +++ b/generated/Normalizer/DeleteModelResponseNormalizer.php @@ -23,12 +23,12 @@ class DeleteModelResponseNormalizer implements DenormalizerInterface, Normalizer use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === DeleteModelResponse::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === DeleteModelResponse::class; } @@ -52,14 +52,14 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('deleted', $data)) { $object->setDeleted($data['deleted']); unset($data['deleted']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -75,8 +75,8 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['object'] = $object->getObject(); $data['deleted'] = $object->getDeleted(); + $data['object'] = $object->getObject(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; @@ -84,4 +84,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + DeleteModelResponse::class => false, + ]; + } } diff --git a/generated/Normalizer/DeleteThreadResponseNormalizer.php b/generated/Normalizer/DeleteThreadResponseNormalizer.php new file mode 100644 index 0000000..acc1fc4 --- /dev/null +++ b/generated/Normalizer/DeleteThreadResponseNormalizer.php @@ -0,0 +1,94 @@ +setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('deleted', $data)) { + $object->setDeleted($data['deleted']); + unset($data['deleted']); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['id'] = $object->getId(); + $data['deleted'] = $object->getDeleted(); + $data['object'] = $object->getObject(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + DeleteThreadResponse::class => false, + ]; + } +} diff --git a/generated/Normalizer/CreateEmbeddingResponseDataItemNormalizer.php b/generated/Normalizer/EmbeddingNormalizer.php similarity index 81% rename from generated/Normalizer/CreateEmbeddingResponseDataItemNormalizer.php rename to generated/Normalizer/EmbeddingNormalizer.php index bed4c17..8b3f9dc 100644 --- a/generated/Normalizer/CreateEmbeddingResponseDataItemNormalizer.php +++ b/generated/Normalizer/EmbeddingNormalizer.php @@ -6,7 +6,7 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; -use Sourceability\OpenAIClient\Generated\Model\CreateEmbeddingResponseDataItem; +use Sourceability\OpenAIClient\Generated\Model\Embedding; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -16,21 +16,21 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class CreateEmbeddingResponseDataItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class EmbeddingNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { use DenormalizerAwareTrait; use NormalizerAwareTrait; use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { - return $type === CreateEmbeddingResponseDataItem::class; + return $type === Embedding::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { - return is_object($data) && $data::class === CreateEmbeddingResponseDataItem::class; + return is_object($data) && $data::class === Embedding::class; } /** @@ -44,7 +44,7 @@ public function denormalize($data, $class, $format = null, array $context = []) if (isset($data['$recursiveRef'])) { return new Reference($data['$recursiveRef'], $context['document-origin']); } - $object = new CreateEmbeddingResponseDataItem(); + $object = new Embedding(); if ($data === null || \is_array($data) === false) { return $object; } @@ -52,10 +52,6 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setIndex($data['index']); unset($data['index']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('embedding', $data)) { $values = []; foreach ($data['embedding'] as $value) { @@ -64,6 +60,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setEmbedding($values); unset($data['embedding']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value_1; @@ -79,12 +79,12 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['index'] = $object->getIndex(); - $data['object'] = $object->getObject(); $values = []; foreach ($object->getEmbedding() as $value) { $values[] = $value; } $data['embedding'] = $values; + $data['object'] = $object->getObject(); foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value_1; @@ -92,4 +92,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + Embedding::class => false, + ]; + } } diff --git a/generated/Normalizer/ErrorNormalizer.php b/generated/Normalizer/ErrorNormalizer.php index 84bb265..449be94 100644 --- a/generated/Normalizer/ErrorNormalizer.php +++ b/generated/Normalizer/ErrorNormalizer.php @@ -23,12 +23,12 @@ class ErrorNormalizer implements DenormalizerInterface, NormalizerInterface, Den use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === Error::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === Error::class; } @@ -48,9 +48,11 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); + if (\array_key_exists('code', $data) && $data['code'] !== null) { + $object->setCode($data['code']); + unset($data['code']); + } elseif (\array_key_exists('code', $data) && $data['code'] === null) { + $object->setCode(null); } if (\array_key_exists('message', $data)) { $object->setMessage($data['message']); @@ -62,11 +64,9 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('param', $data) && $data['param'] === null) { $object->setParam(null); } - if (\array_key_exists('code', $data) && $data['code'] !== null) { - $object->setCode($data['code']); - unset($data['code']); - } elseif (\array_key_exists('code', $data) && $data['code'] === null) { - $object->setCode(null); + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { @@ -82,10 +82,10 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['type'] = $object->getType(); + $data['code'] = $object->getCode(); $data['message'] = $object->getMessage(); $data['param'] = $object->getParam(); - $data['code'] = $object->getCode(); + $data['type'] = $object->getType(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; @@ -93,4 +93,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + Error::class => false, + ]; + } } diff --git a/generated/Normalizer/ErrorResponseNormalizer.php b/generated/Normalizer/ErrorResponseNormalizer.php index 8728246..bad262d 100644 --- a/generated/Normalizer/ErrorResponseNormalizer.php +++ b/generated/Normalizer/ErrorResponseNormalizer.php @@ -24,12 +24,12 @@ class ErrorResponseNormalizer implements DenormalizerInterface, NormalizerInterf use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === ErrorResponse::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === ErrorResponse::class; } @@ -75,4 +75,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ErrorResponse::class => false, + ]; + } } diff --git a/generated/Normalizer/FineTuneEventNormalizer.php b/generated/Normalizer/FineTuneEventNormalizer.php index 26c78a1..070bbe0 100644 --- a/generated/Normalizer/FineTuneEventNormalizer.php +++ b/generated/Normalizer/FineTuneEventNormalizer.php @@ -23,12 +23,12 @@ class FineTuneEventNormalizer implements DenormalizerInterface, NormalizerInterf use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === FineTuneEvent::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === FineTuneEvent::class; } @@ -48,10 +48,6 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('created_at', $data)) { $object->setCreatedAt($data['created_at']); unset($data['created_at']); @@ -64,6 +60,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setMessage($data['message']); unset($data['message']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -78,10 +78,10 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['object'] = $object->getObject(); $data['created_at'] = $object->getCreatedAt(); $data['level'] = $object->getLevel(); $data['message'] = $object->getMessage(); + $data['object'] = $object->getObject(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; @@ -89,4 +89,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + FineTuneEvent::class => false, + ]; + } } diff --git a/generated/Normalizer/FineTuneHyperparamsNormalizer.php b/generated/Normalizer/FineTuneHyperparamsNormalizer.php new file mode 100644 index 0000000..6b643d4 --- /dev/null +++ b/generated/Normalizer/FineTuneHyperparamsNormalizer.php @@ -0,0 +1,126 @@ +setBatchSize($data['batch_size']); + unset($data['batch_size']); + } + if (\array_key_exists('classification_n_classes', $data)) { + $object->setClassificationNClasses($data['classification_n_classes']); + unset($data['classification_n_classes']); + } + if (\array_key_exists('classification_positive_class', $data)) { + $object->setClassificationPositiveClass($data['classification_positive_class']); + unset($data['classification_positive_class']); + } + if (\array_key_exists('compute_classification_metrics', $data)) { + $object->setComputeClassificationMetrics($data['compute_classification_metrics']); + unset($data['compute_classification_metrics']); + } + if (\array_key_exists('learning_rate_multiplier', $data)) { + $object->setLearningRateMultiplier($data['learning_rate_multiplier']); + unset($data['learning_rate_multiplier']); + } + if (\array_key_exists('n_epochs', $data)) { + $object->setNEpochs($data['n_epochs']); + unset($data['n_epochs']); + } + if (\array_key_exists('prompt_loss_weight', $data)) { + $object->setPromptLossWeight($data['prompt_loss_weight']); + unset($data['prompt_loss_weight']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['batch_size'] = $object->getBatchSize(); + if ($object->isInitialized('classificationNClasses') && $object->getClassificationNClasses() !== null) { + $data['classification_n_classes'] = $object->getClassificationNClasses(); + } + if ($object->isInitialized('classificationPositiveClass') && $object->getClassificationPositiveClass() !== null) { + $data['classification_positive_class'] = $object->getClassificationPositiveClass(); + } + if ($object->isInitialized('computeClassificationMetrics') && $object->getComputeClassificationMetrics() !== null) { + $data['compute_classification_metrics'] = $object->getComputeClassificationMetrics(); + } + $data['learning_rate_multiplier'] = $object->getLearningRateMultiplier(); + $data['n_epochs'] = $object->getNEpochs(); + $data['prompt_loss_weight'] = $object->getPromptLossWeight(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + FineTuneHyperparams::class => false, + ]; + } +} diff --git a/generated/Normalizer/FineTuneNormalizer.php b/generated/Normalizer/FineTuneNormalizer.php index 9a0902b..4ff1718 100644 --- a/generated/Normalizer/FineTuneNormalizer.php +++ b/generated/Normalizer/FineTuneNormalizer.php @@ -8,6 +8,7 @@ use Jane\Component\JsonSchemaRuntime\Reference; use Sourceability\OpenAIClient\Generated\Model\FineTune; use Sourceability\OpenAIClient\Generated\Model\FineTuneEvent; +use Sourceability\OpenAIClient\Generated\Model\FineTuneHyperparams; use Sourceability\OpenAIClient\Generated\Model\OpenAIFile; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; @@ -25,12 +26,12 @@ class FineTuneNormalizer implements DenormalizerInterface, NormalizerInterface, use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === FineTune::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === FineTune::class; } @@ -54,21 +55,17 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('created_at', $data)) { $object->setCreatedAt($data['created_at']); unset($data['created_at']); } - if (\array_key_exists('updated_at', $data)) { - $object->setUpdatedAt($data['updated_at']); - unset($data['updated_at']); - } - if (\array_key_exists('model', $data)) { - $object->setModel($data['model']); - unset($data['model']); + if (\array_key_exists('events', $data)) { + $values = []; + foreach ($data['events'] as $value) { + $values[] = $this->denormalizer->denormalize($value, FineTuneEvent::class, 'json', $context); + } + $object->setEvents($values); + unset($data['events']); } if (\array_key_exists('fine_tuned_model', $data) && $data['fine_tuned_model'] !== null) { $object->setFineTunedModel($data['fine_tuned_model']); @@ -76,57 +73,57 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('fine_tuned_model', $data) && $data['fine_tuned_model'] === null) { $object->setFineTunedModel(null); } + if (\array_key_exists('hyperparams', $data)) { + $object->setHyperparams($this->denormalizer->denormalize($data['hyperparams'], FineTuneHyperparams::class, 'json', $context)); + unset($data['hyperparams']); + } + if (\array_key_exists('model', $data)) { + $object->setModel($data['model']); + unset($data['model']); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } if (\array_key_exists('organization_id', $data)) { $object->setOrganizationId($data['organization_id']); unset($data['organization_id']); } + if (\array_key_exists('result_files', $data)) { + $values_1 = []; + foreach ($data['result_files'] as $value_1) { + $values_1[] = $this->denormalizer->denormalize($value_1, OpenAIFile::class, 'json', $context); + } + $object->setResultFiles($values_1); + unset($data['result_files']); + } if (\array_key_exists('status', $data)) { $object->setStatus($data['status']); unset($data['status']); } - if (\array_key_exists('hyperparams', $data)) { - $values = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - foreach ($data['hyperparams'] as $key => $value) { - $values[$key] = $value; - } - $object->setHyperparams($values); - unset($data['hyperparams']); - } if (\array_key_exists('training_files', $data)) { - $values_1 = []; - foreach ($data['training_files'] as $value_1) { - $values_1[] = $this->denormalizer->denormalize($value_1, OpenAIFile::class, 'json', $context); - } - $object->setTrainingFiles($values_1); - unset($data['training_files']); - } - if (\array_key_exists('validation_files', $data)) { $values_2 = []; - foreach ($data['validation_files'] as $value_2) { + foreach ($data['training_files'] as $value_2) { $values_2[] = $this->denormalizer->denormalize($value_2, OpenAIFile::class, 'json', $context); } - $object->setValidationFiles($values_2); - unset($data['validation_files']); + $object->setTrainingFiles($values_2); + unset($data['training_files']); } - if (\array_key_exists('result_files', $data)) { + if (\array_key_exists('updated_at', $data)) { + $object->setUpdatedAt($data['updated_at']); + unset($data['updated_at']); + } + if (\array_key_exists('validation_files', $data)) { $values_3 = []; - foreach ($data['result_files'] as $value_3) { + foreach ($data['validation_files'] as $value_3) { $values_3[] = $this->denormalizer->denormalize($value_3, OpenAIFile::class, 'json', $context); } - $object->setResultFiles($values_3); - unset($data['result_files']); - } - if (\array_key_exists('events', $data)) { - $values_4 = []; - foreach ($data['events'] as $value_4) { - $values_4[] = $this->denormalizer->denormalize($value_4, FineTuneEvent::class, 'json', $context); - } - $object->setEvents($values_4); - unset($data['events']); + $object->setValidationFiles($values_3); + unset($data['validation_files']); } - foreach ($data as $key_1 => $value_5) { - if (preg_match('/.*/', (string) $key_1)) { - $object[$key_1] = $value_5; + foreach ($data as $key => $value_4) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_4; } } return $object; @@ -139,45 +136,48 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['object'] = $object->getObject(); $data['created_at'] = $object->getCreatedAt(); - $data['updated_at'] = $object->getUpdatedAt(); - $data['model'] = $object->getModel(); + if ($object->isInitialized('events') && $object->getEvents() !== null) { + $values = []; + foreach ($object->getEvents() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['events'] = $values; + } $data['fine_tuned_model'] = $object->getFineTunedModel(); + $data['hyperparams'] = $this->normalizer->normalize($object->getHyperparams(), 'json', $context); + $data['model'] = $object->getModel(); + $data['object'] = $object->getObject(); $data['organization_id'] = $object->getOrganizationId(); - $data['status'] = $object->getStatus(); - $values = []; - foreach ($object->getHyperparams() as $key => $value) { - $values[$key] = $value; - } - $data['hyperparams'] = $values; $values_1 = []; - foreach ($object->getTrainingFiles() as $value_1) { + foreach ($object->getResultFiles() as $value_1) { $values_1[] = $this->normalizer->normalize($value_1, 'json', $context); } - $data['training_files'] = $values_1; + $data['result_files'] = $values_1; + $data['status'] = $object->getStatus(); $values_2 = []; - foreach ($object->getValidationFiles() as $value_2) { + foreach ($object->getTrainingFiles() as $value_2) { $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); } - $data['validation_files'] = $values_2; + $data['training_files'] = $values_2; + $data['updated_at'] = $object->getUpdatedAt(); $values_3 = []; - foreach ($object->getResultFiles() as $value_3) { + foreach ($object->getValidationFiles() as $value_3) { $values_3[] = $this->normalizer->normalize($value_3, 'json', $context); } - $data['result_files'] = $values_3; - if ($object->isInitialized('events') && $object->getEvents() !== null) { - $values_4 = []; - foreach ($object->getEvents() as $value_4) { - $values_4[] = $this->normalizer->normalize($value_4, 'json', $context); - } - $data['events'] = $values_4; - } - foreach ($object as $key_1 => $value_5) { - if (preg_match('/.*/', (string) $key_1)) { - $data[$key_1] = $value_5; + $data['validation_files'] = $values_3; + foreach ($object as $key => $value_4) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_4; } } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + FineTune::class => false, + ]; + } } diff --git a/generated/Normalizer/FineTuningJobErrorNormalizer.php b/generated/Normalizer/FineTuningJobErrorNormalizer.php new file mode 100644 index 0000000..0857030 --- /dev/null +++ b/generated/Normalizer/FineTuningJobErrorNormalizer.php @@ -0,0 +1,96 @@ +setCode($data['code']); + unset($data['code']); + } + if (\array_key_exists('message', $data)) { + $object->setMessage($data['message']); + unset($data['message']); + } + if (\array_key_exists('param', $data) && $data['param'] !== null) { + $object->setParam($data['param']); + unset($data['param']); + } elseif (\array_key_exists('param', $data) && $data['param'] === null) { + $object->setParam(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['code'] = $object->getCode(); + $data['message'] = $object->getMessage(); + $data['param'] = $object->getParam(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + FineTuningJobError::class => false, + ]; + } +} diff --git a/generated/Normalizer/FineTuningJobEventNormalizer.php b/generated/Normalizer/FineTuningJobEventNormalizer.php new file mode 100644 index 0000000..f6ca925 --- /dev/null +++ b/generated/Normalizer/FineTuningJobEventNormalizer.php @@ -0,0 +1,104 @@ +setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('created_at', $data)) { + $object->setCreatedAt($data['created_at']); + unset($data['created_at']); + } + if (\array_key_exists('level', $data)) { + $object->setLevel($data['level']); + unset($data['level']); + } + if (\array_key_exists('message', $data)) { + $object->setMessage($data['message']); + unset($data['message']); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['id'] = $object->getId(); + $data['created_at'] = $object->getCreatedAt(); + $data['level'] = $object->getLevel(); + $data['message'] = $object->getMessage(); + $data['object'] = $object->getObject(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + FineTuningJobEvent::class => false, + ]; + } +} diff --git a/generated/Normalizer/FineTuningJobHyperparametersNormalizer.php b/generated/Normalizer/FineTuningJobHyperparametersNormalizer.php new file mode 100644 index 0000000..b957752 --- /dev/null +++ b/generated/Normalizer/FineTuningJobHyperparametersNormalizer.php @@ -0,0 +1,84 @@ +setNEpochs($data['n_epochs']); + unset($data['n_epochs']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['n_epochs'] = $object->getNEpochs(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + FineTuningJobHyperparameters::class => false, + ]; + } +} diff --git a/generated/Normalizer/FineTuningJobNormalizer.php b/generated/Normalizer/FineTuningJobNormalizer.php new file mode 100644 index 0000000..8e90d3f --- /dev/null +++ b/generated/Normalizer/FineTuningJobNormalizer.php @@ -0,0 +1,169 @@ +setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('created_at', $data)) { + $object->setCreatedAt($data['created_at']); + unset($data['created_at']); + } + if (\array_key_exists('error', $data) && $data['error'] !== null) { + $object->setError($this->denormalizer->denormalize($data['error'], FineTuningJobError::class, 'json', $context)); + unset($data['error']); + } elseif (\array_key_exists('error', $data) && $data['error'] === null) { + $object->setError(null); + } + if (\array_key_exists('fine_tuned_model', $data) && $data['fine_tuned_model'] !== null) { + $object->setFineTunedModel($data['fine_tuned_model']); + unset($data['fine_tuned_model']); + } elseif (\array_key_exists('fine_tuned_model', $data) && $data['fine_tuned_model'] === null) { + $object->setFineTunedModel(null); + } + if (\array_key_exists('finished_at', $data) && $data['finished_at'] !== null) { + $object->setFinishedAt($data['finished_at']); + unset($data['finished_at']); + } elseif (\array_key_exists('finished_at', $data) && $data['finished_at'] === null) { + $object->setFinishedAt(null); + } + if (\array_key_exists('hyperparameters', $data)) { + $object->setHyperparameters($this->denormalizer->denormalize($data['hyperparameters'], FineTuningJobHyperparameters::class, 'json', $context)); + unset($data['hyperparameters']); + } + if (\array_key_exists('model', $data)) { + $object->setModel($data['model']); + unset($data['model']); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } + if (\array_key_exists('organization_id', $data)) { + $object->setOrganizationId($data['organization_id']); + unset($data['organization_id']); + } + if (\array_key_exists('result_files', $data)) { + $values = []; + foreach ($data['result_files'] as $value) { + $values[] = $value; + } + $object->setResultFiles($values); + unset($data['result_files']); + } + if (\array_key_exists('status', $data)) { + $object->setStatus($data['status']); + unset($data['status']); + } + if (\array_key_exists('trained_tokens', $data) && $data['trained_tokens'] !== null) { + $object->setTrainedTokens($data['trained_tokens']); + unset($data['trained_tokens']); + } elseif (\array_key_exists('trained_tokens', $data) && $data['trained_tokens'] === null) { + $object->setTrainedTokens(null); + } + if (\array_key_exists('training_file', $data)) { + $object->setTrainingFile($data['training_file']); + unset($data['training_file']); + } + if (\array_key_exists('validation_file', $data) && $data['validation_file'] !== null) { + $object->setValidationFile($data['validation_file']); + unset($data['validation_file']); + } elseif (\array_key_exists('validation_file', $data) && $data['validation_file'] === null) { + $object->setValidationFile(null); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['id'] = $object->getId(); + $data['created_at'] = $object->getCreatedAt(); + $data['error'] = $this->normalizer->normalize($object->getError(), 'json', $context); + $data['fine_tuned_model'] = $object->getFineTunedModel(); + $data['finished_at'] = $object->getFinishedAt(); + $data['hyperparameters'] = $this->normalizer->normalize($object->getHyperparameters(), 'json', $context); + $data['model'] = $object->getModel(); + $data['object'] = $object->getObject(); + $data['organization_id'] = $object->getOrganizationId(); + $values = []; + foreach ($object->getResultFiles() as $value) { + $values[] = $value; + } + $data['result_files'] = $values; + $data['status'] = $object->getStatus(); + $data['trained_tokens'] = $object->getTrainedTokens(); + $data['training_file'] = $object->getTrainingFile(); + $data['validation_file'] = $object->getValidationFile(); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + FineTuningJob::class => false, + ]; + } +} diff --git a/generated/Normalizer/FunctionObjectNormalizer.php b/generated/Normalizer/FunctionObjectNormalizer.php new file mode 100644 index 0000000..ca55c3c --- /dev/null +++ b/generated/Normalizer/FunctionObjectNormalizer.php @@ -0,0 +1,106 @@ +setDescription($data['description']); + unset($data['description']); + } + if (\array_key_exists('name', $data)) { + $object->setName($data['name']); + unset($data['name']); + } + if (\array_key_exists('parameters', $data)) { + $values = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['parameters'] as $key => $value) { + $values[$key] = $value; + } + $object->setParameters($values); + unset($data['parameters']); + } + foreach ($data as $key_1 => $value_1) { + if (preg_match('/.*/', (string) $key_1)) { + $object[$key_1] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('description') && $object->getDescription() !== null) { + $data['description'] = $object->getDescription(); + } + $data['name'] = $object->getName(); + if ($object->isInitialized('parameters') && $object->getParameters() !== null) { + $values = []; + foreach ($object->getParameters() as $key => $value) { + $values[$key] = $value; + } + $data['parameters'] = $values; + } + foreach ($object as $key_1 => $value_1) { + if (preg_match('/.*/', (string) $key_1)) { + $data[$key_1] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + FunctionObject::class => false, + ]; + } +} diff --git a/generated/Normalizer/ImagesResponseDataItemNormalizer.php b/generated/Normalizer/ImageNormalizer.php similarity index 72% rename from generated/Normalizer/ImagesResponseDataItemNormalizer.php rename to generated/Normalizer/ImageNormalizer.php index 17d035e..ba9ce2b 100644 --- a/generated/Normalizer/ImagesResponseDataItemNormalizer.php +++ b/generated/Normalizer/ImageNormalizer.php @@ -6,7 +6,7 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; -use Sourceability\OpenAIClient\Generated\Model\ImagesResponseDataItem; +use Sourceability\OpenAIClient\Generated\Model\Image; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -16,21 +16,21 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ImagesResponseDataItemNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ImageNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { use DenormalizerAwareTrait; use NormalizerAwareTrait; use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { - return $type === ImagesResponseDataItem::class; + return $type === Image::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { - return is_object($data) && $data::class === ImagesResponseDataItem::class; + return is_object($data) && $data::class === Image::class; } /** @@ -44,17 +44,21 @@ public function denormalize($data, $class, $format = null, array $context = []) if (isset($data['$recursiveRef'])) { return new Reference($data['$recursiveRef'], $context['document-origin']); } - $object = new ImagesResponseDataItem(); + $object = new Image(); if ($data === null || \is_array($data) === false) { return $object; } + if (\array_key_exists('b64_json', $data)) { + $object->setB64Json($data['b64_json']); + unset($data['b64_json']); + } if (\array_key_exists('url', $data)) { $object->setUrl($data['url']); unset($data['url']); } - if (\array_key_exists('b64_json', $data)) { - $object->setB64Json($data['b64_json']); - unset($data['b64_json']); + if (\array_key_exists('revised_prompt', $data)) { + $object->setRevisedPrompt($data['revised_prompt']); + unset($data['revised_prompt']); } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { @@ -70,11 +74,14 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; + if ($object->isInitialized('b64Json') && $object->getB64Json() !== null) { + $data['b64_json'] = $object->getB64Json(); + } if ($object->isInitialized('url') && $object->getUrl() !== null) { $data['url'] = $object->getUrl(); } - if ($object->isInitialized('b64Json') && $object->getB64Json() !== null) { - $data['b64_json'] = $object->getB64Json(); + if ($object->isInitialized('revisedPrompt') && $object->getRevisedPrompt() !== null) { + $data['revised_prompt'] = $object->getRevisedPrompt(); } foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { @@ -83,4 +90,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + Image::class => false, + ]; + } } diff --git a/generated/Normalizer/ImagesResponseNormalizer.php b/generated/Normalizer/ImagesResponseNormalizer.php index 0883fb3..71e3480 100644 --- a/generated/Normalizer/ImagesResponseNormalizer.php +++ b/generated/Normalizer/ImagesResponseNormalizer.php @@ -6,8 +6,8 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; +use Sourceability\OpenAIClient\Generated\Model\Image; use Sourceability\OpenAIClient\Generated\Model\ImagesResponse; -use Sourceability\OpenAIClient\Generated\Model\ImagesResponseDataItem; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -24,12 +24,12 @@ class ImagesResponseNormalizer implements DenormalizerInterface, NormalizerInter use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === ImagesResponse::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === ImagesResponse::class; } @@ -56,7 +56,7 @@ public function denormalize($data, $class, $format = null, array $context = []) if (\array_key_exists('data', $data)) { $values = []; foreach ($data['data'] as $value) { - $values[] = $this->denormalizer->denormalize($value, ImagesResponseDataItem::class, 'json', $context); + $values[] = $this->denormalizer->denormalize($value, Image::class, 'json', $context); } $object->setData($values); unset($data['data']); @@ -88,4 +88,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ImagesResponse::class => false, + ]; + } } diff --git a/generated/Normalizer/JaneObjectNormalizer.php b/generated/Normalizer/JaneObjectNormalizer.php index 7a9c3bc..cb58041 100644 --- a/generated/Normalizer/JaneObjectNormalizer.php +++ b/generated/Normalizer/JaneObjectNormalizer.php @@ -6,68 +6,150 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; +use Sourceability\OpenAIClient\Generated\Model\AssistantFileObject; +use Sourceability\OpenAIClient\Generated\Model\AssistantObject; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsCode; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsFunction; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsRetrieval; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionFunctionCallOption; use Sourceability\OpenAIClient\Generated\Model\ChatCompletionFunctions; -use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestMessage; -use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestMessageFunctionCall; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionMessageToolCall; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionMessageToolCallChunk; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionMessageToolCallChunkFunction; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionMessageToolCallFunction; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionNamedToolChoice; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionNamedToolChoiceFunction; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestAssistantMessage; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestAssistantMessageFunctionCall; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestFunctionMessage; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestMessageContentPartImage; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestMessageContentPartImageImageUrl; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestMessageContentPartText; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestSystemMessage; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestToolMessage; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestUserMessage; use Sourceability\OpenAIClient\Generated\Model\ChatCompletionResponseMessage; use Sourceability\OpenAIClient\Generated\Model\ChatCompletionResponseMessageFunctionCall; -use Sourceability\OpenAIClient\Generated\Model\CreateAnswerRequest; -use Sourceability\OpenAIClient\Generated\Model\CreateAnswerResponse; -use Sourceability\OpenAIClient\Generated\Model\CreateAnswerResponseSelectedDocumentsItem; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionStreamResponseDelta; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionStreamResponseDeltaFunctionCall; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionTokenLogprob; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionTokenLogprobTopLogprobsItem; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionTool; +use Sourceability\OpenAIClient\Generated\Model\CompletionUsage; +use Sourceability\OpenAIClient\Generated\Model\CreateAssistantFileRequest; +use Sourceability\OpenAIClient\Generated\Model\CreateAssistantRequest; +use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionFunctionResponse; +use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionFunctionResponseChoicesItem; use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionRequest; +use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionRequestResponseFormat; use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionResponse; use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionResponseChoicesItem; -use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionResponseUsage; -use Sourceability\OpenAIClient\Generated\Model\CreateClassificationRequest; -use Sourceability\OpenAIClient\Generated\Model\CreateClassificationResponse; -use Sourceability\OpenAIClient\Generated\Model\CreateClassificationResponseSelectedExamplesItem; +use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionResponseChoicesItemLogprobs; +use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionStreamResponse; +use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionStreamResponseChoicesItem; +use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionStreamResponseChoicesItemLogprobs; use Sourceability\OpenAIClient\Generated\Model\CreateCompletionRequest; use Sourceability\OpenAIClient\Generated\Model\CreateCompletionResponse; use Sourceability\OpenAIClient\Generated\Model\CreateCompletionResponseChoicesItem; use Sourceability\OpenAIClient\Generated\Model\CreateCompletionResponseChoicesItemLogprobs; -use Sourceability\OpenAIClient\Generated\Model\CreateCompletionResponseUsage; use Sourceability\OpenAIClient\Generated\Model\CreateEditRequest; use Sourceability\OpenAIClient\Generated\Model\CreateEditResponse; use Sourceability\OpenAIClient\Generated\Model\CreateEditResponseChoicesItem; -use Sourceability\OpenAIClient\Generated\Model\CreateEditResponseChoicesItemLogprobs; -use Sourceability\OpenAIClient\Generated\Model\CreateEditResponseUsage; use Sourceability\OpenAIClient\Generated\Model\CreateEmbeddingRequest; use Sourceability\OpenAIClient\Generated\Model\CreateEmbeddingResponse; -use Sourceability\OpenAIClient\Generated\Model\CreateEmbeddingResponseDataItem; use Sourceability\OpenAIClient\Generated\Model\CreateEmbeddingResponseUsage; use Sourceability\OpenAIClient\Generated\Model\CreateFileRequest; use Sourceability\OpenAIClient\Generated\Model\CreateFineTuneRequest; +use Sourceability\OpenAIClient\Generated\Model\CreateFineTuneRequestHyperparameters; +use Sourceability\OpenAIClient\Generated\Model\CreateFineTuningJobRequest; +use Sourceability\OpenAIClient\Generated\Model\CreateFineTuningJobRequestHyperparameters; use Sourceability\OpenAIClient\Generated\Model\CreateImageEditRequest; use Sourceability\OpenAIClient\Generated\Model\CreateImageRequest; use Sourceability\OpenAIClient\Generated\Model\CreateImageVariationRequest; +use Sourceability\OpenAIClient\Generated\Model\CreateMessageRequest; use Sourceability\OpenAIClient\Generated\Model\CreateModerationRequest; use Sourceability\OpenAIClient\Generated\Model\CreateModerationResponse; use Sourceability\OpenAIClient\Generated\Model\CreateModerationResponseResultsItem; use Sourceability\OpenAIClient\Generated\Model\CreateModerationResponseResultsItemCategories; use Sourceability\OpenAIClient\Generated\Model\CreateModerationResponseResultsItemCategoryScores; -use Sourceability\OpenAIClient\Generated\Model\CreateSearchRequest; -use Sourceability\OpenAIClient\Generated\Model\CreateSearchResponse; -use Sourceability\OpenAIClient\Generated\Model\CreateSearchResponseDataItem; +use Sourceability\OpenAIClient\Generated\Model\CreateRunRequest; +use Sourceability\OpenAIClient\Generated\Model\CreateSpeechRequest; +use Sourceability\OpenAIClient\Generated\Model\CreateThreadAndRunRequest; +use Sourceability\OpenAIClient\Generated\Model\CreateThreadRequest; use Sourceability\OpenAIClient\Generated\Model\CreateTranscriptionRequest; use Sourceability\OpenAIClient\Generated\Model\CreateTranscriptionResponse; use Sourceability\OpenAIClient\Generated\Model\CreateTranslationRequest; use Sourceability\OpenAIClient\Generated\Model\CreateTranslationResponse; +use Sourceability\OpenAIClient\Generated\Model\DeleteAssistantFileResponse; +use Sourceability\OpenAIClient\Generated\Model\DeleteAssistantResponse; use Sourceability\OpenAIClient\Generated\Model\DeleteFileResponse; +use Sourceability\OpenAIClient\Generated\Model\DeleteMessageResponse; use Sourceability\OpenAIClient\Generated\Model\DeleteModelResponse; -use Sourceability\OpenAIClient\Generated\Model\Engine; +use Sourceability\OpenAIClient\Generated\Model\DeleteThreadResponse; +use Sourceability\OpenAIClient\Generated\Model\Embedding; use Sourceability\OpenAIClient\Generated\Model\Error; use Sourceability\OpenAIClient\Generated\Model\ErrorResponse; use Sourceability\OpenAIClient\Generated\Model\FineTune; use Sourceability\OpenAIClient\Generated\Model\FineTuneEvent; +use Sourceability\OpenAIClient\Generated\Model\FineTuneHyperparams; +use Sourceability\OpenAIClient\Generated\Model\FineTuningJob; +use Sourceability\OpenAIClient\Generated\Model\FineTuningJobError; +use Sourceability\OpenAIClient\Generated\Model\FineTuningJobEvent; +use Sourceability\OpenAIClient\Generated\Model\FineTuningJobHyperparameters; +use Sourceability\OpenAIClient\Generated\Model\FunctionObject; +use Sourceability\OpenAIClient\Generated\Model\Image; use Sourceability\OpenAIClient\Generated\Model\ImagesResponse; -use Sourceability\OpenAIClient\Generated\Model\ImagesResponseDataItem; -use Sourceability\OpenAIClient\Generated\Model\ListEnginesResponse; +use Sourceability\OpenAIClient\Generated\Model\ListAssistantFilesResponse; +use Sourceability\OpenAIClient\Generated\Model\ListAssistantsResponse; use Sourceability\OpenAIClient\Generated\Model\ListFilesResponse; use Sourceability\OpenAIClient\Generated\Model\ListFineTuneEventsResponse; use Sourceability\OpenAIClient\Generated\Model\ListFineTunesResponse; +use Sourceability\OpenAIClient\Generated\Model\ListFineTuningJobEventsResponse; +use Sourceability\OpenAIClient\Generated\Model\ListMessageFilesResponse; +use Sourceability\OpenAIClient\Generated\Model\ListMessagesResponse; use Sourceability\OpenAIClient\Generated\Model\ListModelsResponse; +use Sourceability\OpenAIClient\Generated\Model\ListPaginatedFineTuningJobsResponse; +use Sourceability\OpenAIClient\Generated\Model\ListRunsResponse; +use Sourceability\OpenAIClient\Generated\Model\ListRunStepsResponse; +use Sourceability\OpenAIClient\Generated\Model\ListThreadsResponse; +use Sourceability\OpenAIClient\Generated\Model\MessageContentImageFileObject; +use Sourceability\OpenAIClient\Generated\Model\MessageContentImageFileObjectImageFile; +use Sourceability\OpenAIClient\Generated\Model\MessageContentTextAnnotationsFileCitationObject; +use Sourceability\OpenAIClient\Generated\Model\MessageContentTextAnnotationsFileCitationObjectFileCitation; +use Sourceability\OpenAIClient\Generated\Model\MessageContentTextAnnotationsFilePathObject; +use Sourceability\OpenAIClient\Generated\Model\MessageContentTextAnnotationsFilePathObjectFilePath; +use Sourceability\OpenAIClient\Generated\Model\MessageContentTextObject; +use Sourceability\OpenAIClient\Generated\Model\MessageContentTextObjectText; +use Sourceability\OpenAIClient\Generated\Model\MessageFileObject; +use Sourceability\OpenAIClient\Generated\Model\MessageObject; use Sourceability\OpenAIClient\Generated\Model\Model; +use Sourceability\OpenAIClient\Generated\Model\ModifyAssistantRequest; +use Sourceability\OpenAIClient\Generated\Model\ModifyMessageRequest; +use Sourceability\OpenAIClient\Generated\Model\ModifyRunRequest; +use Sourceability\OpenAIClient\Generated\Model\ModifyThreadRequest; use Sourceability\OpenAIClient\Generated\Model\OpenAIFile; +use Sourceability\OpenAIClient\Generated\Model\RunObject; +use Sourceability\OpenAIClient\Generated\Model\RunObjectLastError; +use Sourceability\OpenAIClient\Generated\Model\RunObjectRequiredAction; +use Sourceability\OpenAIClient\Generated\Model\RunObjectRequiredActionSubmitToolOutputs; +use Sourceability\OpenAIClient\Generated\Model\RunStepDetailsMessageCreationObject; +use Sourceability\OpenAIClient\Generated\Model\RunStepDetailsMessageCreationObjectMessageCreation; +use Sourceability\OpenAIClient\Generated\Model\RunStepDetailsToolCallsCodeObject; +use Sourceability\OpenAIClient\Generated\Model\RunStepDetailsToolCallsCodeObjectCodeInterpreter; +use Sourceability\OpenAIClient\Generated\Model\RunStepDetailsToolCallsCodeOutputImageObject; +use Sourceability\OpenAIClient\Generated\Model\RunStepDetailsToolCallsCodeOutputImageObjectImage; +use Sourceability\OpenAIClient\Generated\Model\RunStepDetailsToolCallsCodeOutputLogsObject; +use Sourceability\OpenAIClient\Generated\Model\RunStepDetailsToolCallsFunctionObject; +use Sourceability\OpenAIClient\Generated\Model\RunStepDetailsToolCallsFunctionObjectFunction; +use Sourceability\OpenAIClient\Generated\Model\RunStepDetailsToolCallsObject; +use Sourceability\OpenAIClient\Generated\Model\RunStepDetailsToolCallsRetrievalObject; +use Sourceability\OpenAIClient\Generated\Model\RunStepObject; +use Sourceability\OpenAIClient\Generated\Model\RunStepObjectLastError; +use Sourceability\OpenAIClient\Generated\Model\RunToolCallObject; +use Sourceability\OpenAIClient\Generated\Model\RunToolCallObjectFunction; +use Sourceability\OpenAIClient\Generated\Model\SubmitToolOutputsRunRequest; +use Sourceability\OpenAIClient\Generated\Model\SubmitToolOutputsRunRequestToolOutputsItem; +use Sourceability\OpenAIClient\Generated\Model\ThreadObject; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ReferenceNormalizer; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; @@ -88,31 +170,54 @@ class JaneObjectNormalizer implements DenormalizerInterface, NormalizerInterface protected array $normalizers = [ Error::class => ErrorNormalizer::class, ErrorResponse::class => ErrorResponseNormalizer::class, - ListEnginesResponse::class => ListEnginesResponseNormalizer::class, ListModelsResponse::class => ListModelsResponseNormalizer::class, DeleteModelResponse::class => DeleteModelResponseNormalizer::class, CreateCompletionRequest::class => CreateCompletionRequestNormalizer::class, CreateCompletionResponse::class => CreateCompletionResponseNormalizer::class, CreateCompletionResponseChoicesItem::class => CreateCompletionResponseChoicesItemNormalizer::class, CreateCompletionResponseChoicesItemLogprobs::class => CreateCompletionResponseChoicesItemLogprobsNormalizer::class, - CreateCompletionResponseUsage::class => CreateCompletionResponseUsageNormalizer::class, - ChatCompletionRequestMessage::class => ChatCompletionRequestMessageNormalizer::class, - ChatCompletionRequestMessageFunctionCall::class => ChatCompletionRequestMessageFunctionCallNormalizer::class, + ChatCompletionRequestMessageContentPartImage::class => ChatCompletionRequestMessageContentPartImageNormalizer::class, + ChatCompletionRequestMessageContentPartImageImageUrl::class => ChatCompletionRequestMessageContentPartImageImageUrlNormalizer::class, + ChatCompletionRequestMessageContentPartText::class => ChatCompletionRequestMessageContentPartTextNormalizer::class, + ChatCompletionRequestSystemMessage::class => ChatCompletionRequestSystemMessageNormalizer::class, + ChatCompletionRequestUserMessage::class => ChatCompletionRequestUserMessageNormalizer::class, + ChatCompletionRequestAssistantMessage::class => ChatCompletionRequestAssistantMessageNormalizer::class, + ChatCompletionRequestAssistantMessageFunctionCall::class => ChatCompletionRequestAssistantMessageFunctionCallNormalizer::class, + ChatCompletionRequestToolMessage::class => ChatCompletionRequestToolMessageNormalizer::class, + ChatCompletionRequestFunctionMessage::class => ChatCompletionRequestFunctionMessageNormalizer::class, ChatCompletionFunctions::class => ChatCompletionFunctionsNormalizer::class, + ChatCompletionFunctionCallOption::class => ChatCompletionFunctionCallOptionNormalizer::class, + ChatCompletionTool::class => ChatCompletionToolNormalizer::class, + FunctionObject::class => FunctionObjectNormalizer::class, + ChatCompletionNamedToolChoice::class => ChatCompletionNamedToolChoiceNormalizer::class, + ChatCompletionNamedToolChoiceFunction::class => ChatCompletionNamedToolChoiceFunctionNormalizer::class, + ChatCompletionMessageToolCall::class => ChatCompletionMessageToolCallNormalizer::class, + ChatCompletionMessageToolCallFunction::class => ChatCompletionMessageToolCallFunctionNormalizer::class, + ChatCompletionMessageToolCallChunk::class => ChatCompletionMessageToolCallChunkNormalizer::class, + ChatCompletionMessageToolCallChunkFunction::class => ChatCompletionMessageToolCallChunkFunctionNormalizer::class, ChatCompletionResponseMessage::class => ChatCompletionResponseMessageNormalizer::class, ChatCompletionResponseMessageFunctionCall::class => ChatCompletionResponseMessageFunctionCallNormalizer::class, + ChatCompletionStreamResponseDelta::class => ChatCompletionStreamResponseDeltaNormalizer::class, + ChatCompletionStreamResponseDeltaFunctionCall::class => ChatCompletionStreamResponseDeltaFunctionCallNormalizer::class, CreateChatCompletionRequest::class => CreateChatCompletionRequestNormalizer::class, + CreateChatCompletionRequestResponseFormat::class => CreateChatCompletionRequestResponseFormatNormalizer::class, CreateChatCompletionResponse::class => CreateChatCompletionResponseNormalizer::class, CreateChatCompletionResponseChoicesItem::class => CreateChatCompletionResponseChoicesItemNormalizer::class, - CreateChatCompletionResponseUsage::class => CreateChatCompletionResponseUsageNormalizer::class, + CreateChatCompletionResponseChoicesItemLogprobs::class => CreateChatCompletionResponseChoicesItemLogprobsNormalizer::class, + CreateChatCompletionFunctionResponse::class => CreateChatCompletionFunctionResponseNormalizer::class, + CreateChatCompletionFunctionResponseChoicesItem::class => CreateChatCompletionFunctionResponseChoicesItemNormalizer::class, + ChatCompletionTokenLogprob::class => ChatCompletionTokenLogprobNormalizer::class, + ChatCompletionTokenLogprobTopLogprobsItem::class => ChatCompletionTokenLogprobTopLogprobsItemNormalizer::class, + ListPaginatedFineTuningJobsResponse::class => ListPaginatedFineTuningJobsResponseNormalizer::class, + CreateChatCompletionStreamResponse::class => CreateChatCompletionStreamResponseNormalizer::class, + CreateChatCompletionStreamResponseChoicesItem::class => CreateChatCompletionStreamResponseChoicesItemNormalizer::class, + CreateChatCompletionStreamResponseChoicesItemLogprobs::class => CreateChatCompletionStreamResponseChoicesItemLogprobsNormalizer::class, CreateEditRequest::class => CreateEditRequestNormalizer::class, CreateEditResponse::class => CreateEditResponseNormalizer::class, CreateEditResponseChoicesItem::class => CreateEditResponseChoicesItemNormalizer::class, - CreateEditResponseChoicesItemLogprobs::class => CreateEditResponseChoicesItemLogprobsNormalizer::class, - CreateEditResponseUsage::class => CreateEditResponseUsageNormalizer::class, CreateImageRequest::class => CreateImageRequestNormalizer::class, ImagesResponse::class => ImagesResponseNormalizer::class, - ImagesResponseDataItem::class => ImagesResponseDataItemNormalizer::class, + Image::class => ImageNormalizer::class, CreateImageEditRequest::class => CreateImageEditRequestNormalizer::class, CreateImageVariationRequest::class => CreateImageVariationRequestNormalizer::class, CreateModerationRequest::class => CreateModerationRequestNormalizer::class, @@ -120,45 +225,104 @@ class JaneObjectNormalizer implements DenormalizerInterface, NormalizerInterface CreateModerationResponseResultsItem::class => CreateModerationResponseResultsItemNormalizer::class, CreateModerationResponseResultsItemCategories::class => CreateModerationResponseResultsItemCategoriesNormalizer::class, CreateModerationResponseResultsItemCategoryScores::class => CreateModerationResponseResultsItemCategoryScoresNormalizer::class, - CreateSearchRequest::class => CreateSearchRequestNormalizer::class, - CreateSearchResponse::class => CreateSearchResponseNormalizer::class, - CreateSearchResponseDataItem::class => CreateSearchResponseDataItemNormalizer::class, ListFilesResponse::class => ListFilesResponseNormalizer::class, CreateFileRequest::class => CreateFileRequestNormalizer::class, DeleteFileResponse::class => DeleteFileResponseNormalizer::class, - CreateAnswerRequest::class => CreateAnswerRequestNormalizer::class, - CreateAnswerResponse::class => CreateAnswerResponseNormalizer::class, - CreateAnswerResponseSelectedDocumentsItem::class => CreateAnswerResponseSelectedDocumentsItemNormalizer::class, - CreateClassificationRequest::class => CreateClassificationRequestNormalizer::class, - CreateClassificationResponse::class => CreateClassificationResponseNormalizer::class, - CreateClassificationResponseSelectedExamplesItem::class => CreateClassificationResponseSelectedExamplesItemNormalizer::class, + CreateFineTuningJobRequest::class => CreateFineTuningJobRequestNormalizer::class, + CreateFineTuningJobRequestHyperparameters::class => CreateFineTuningJobRequestHyperparametersNormalizer::class, + ListFineTuningJobEventsResponse::class => ListFineTuningJobEventsResponseNormalizer::class, CreateFineTuneRequest::class => CreateFineTuneRequestNormalizer::class, + CreateFineTuneRequestHyperparameters::class => CreateFineTuneRequestHyperparametersNormalizer::class, ListFineTunesResponse::class => ListFineTunesResponseNormalizer::class, ListFineTuneEventsResponse::class => ListFineTuneEventsResponseNormalizer::class, CreateEmbeddingRequest::class => CreateEmbeddingRequestNormalizer::class, CreateEmbeddingResponse::class => CreateEmbeddingResponseNormalizer::class, - CreateEmbeddingResponseDataItem::class => CreateEmbeddingResponseDataItemNormalizer::class, CreateEmbeddingResponseUsage::class => CreateEmbeddingResponseUsageNormalizer::class, CreateTranscriptionRequest::class => CreateTranscriptionRequestNormalizer::class, CreateTranscriptionResponse::class => CreateTranscriptionResponseNormalizer::class, CreateTranslationRequest::class => CreateTranslationRequestNormalizer::class, CreateTranslationResponse::class => CreateTranslationResponseNormalizer::class, - Engine::class => EngineNormalizer::class, + CreateSpeechRequest::class => CreateSpeechRequestNormalizer::class, Model::class => ModelNormalizer::class, OpenAIFile::class => OpenAIFileNormalizer::class, + Embedding::class => EmbeddingNormalizer::class, + FineTuningJob::class => FineTuningJobNormalizer::class, + FineTuningJobError::class => FineTuningJobErrorNormalizer::class, + FineTuningJobHyperparameters::class => FineTuningJobHyperparametersNormalizer::class, + FineTuningJobEvent::class => FineTuningJobEventNormalizer::class, FineTune::class => FineTuneNormalizer::class, + FineTuneHyperparams::class => FineTuneHyperparamsNormalizer::class, FineTuneEvent::class => FineTuneEventNormalizer::class, - '\\' . Reference::class => '\\' . ReferenceNormalizer::class, + CompletionUsage::class => CompletionUsageNormalizer::class, + AssistantObject::class => AssistantObjectNormalizer::class, + CreateAssistantRequest::class => CreateAssistantRequestNormalizer::class, + ModifyAssistantRequest::class => ModifyAssistantRequestNormalizer::class, + DeleteAssistantResponse::class => DeleteAssistantResponseNormalizer::class, + ListAssistantsResponse::class => ListAssistantsResponseNormalizer::class, + AssistantToolsCode::class => AssistantToolsCodeNormalizer::class, + AssistantToolsRetrieval::class => AssistantToolsRetrievalNormalizer::class, + AssistantToolsFunction::class => AssistantToolsFunctionNormalizer::class, + RunObject::class => RunObjectNormalizer::class, + RunObjectRequiredAction::class => RunObjectRequiredActionNormalizer::class, + RunObjectRequiredActionSubmitToolOutputs::class => RunObjectRequiredActionSubmitToolOutputsNormalizer::class, + RunObjectLastError::class => RunObjectLastErrorNormalizer::class, + CreateRunRequest::class => CreateRunRequestNormalizer::class, + ListRunsResponse::class => ListRunsResponseNormalizer::class, + ModifyRunRequest::class => ModifyRunRequestNormalizer::class, + SubmitToolOutputsRunRequest::class => SubmitToolOutputsRunRequestNormalizer::class, + SubmitToolOutputsRunRequestToolOutputsItem::class => SubmitToolOutputsRunRequestToolOutputsItemNormalizer::class, + RunToolCallObject::class => RunToolCallObjectNormalizer::class, + RunToolCallObjectFunction::class => RunToolCallObjectFunctionNormalizer::class, + CreateThreadAndRunRequest::class => CreateThreadAndRunRequestNormalizer::class, + ThreadObject::class => ThreadObjectNormalizer::class, + CreateThreadRequest::class => CreateThreadRequestNormalizer::class, + ModifyThreadRequest::class => ModifyThreadRequestNormalizer::class, + DeleteThreadResponse::class => DeleteThreadResponseNormalizer::class, + ListThreadsResponse::class => ListThreadsResponseNormalizer::class, + MessageObject::class => MessageObjectNormalizer::class, + CreateMessageRequest::class => CreateMessageRequestNormalizer::class, + ModifyMessageRequest::class => ModifyMessageRequestNormalizer::class, + DeleteMessageResponse::class => DeleteMessageResponseNormalizer::class, + ListMessagesResponse::class => ListMessagesResponseNormalizer::class, + MessageContentImageFileObject::class => MessageContentImageFileObjectNormalizer::class, + MessageContentImageFileObjectImageFile::class => MessageContentImageFileObjectImageFileNormalizer::class, + MessageContentTextObject::class => MessageContentTextObjectNormalizer::class, + MessageContentTextObjectText::class => MessageContentTextObjectTextNormalizer::class, + MessageContentTextAnnotationsFileCitationObject::class => MessageContentTextAnnotationsFileCitationObjectNormalizer::class, + MessageContentTextAnnotationsFileCitationObjectFileCitation::class => MessageContentTextAnnotationsFileCitationObjectFileCitationNormalizer::class, + MessageContentTextAnnotationsFilePathObject::class => MessageContentTextAnnotationsFilePathObjectNormalizer::class, + MessageContentTextAnnotationsFilePathObjectFilePath::class => MessageContentTextAnnotationsFilePathObjectFilePathNormalizer::class, + RunStepObject::class => RunStepObjectNormalizer::class, + RunStepObjectLastError::class => RunStepObjectLastErrorNormalizer::class, + ListRunStepsResponse::class => ListRunStepsResponseNormalizer::class, + RunStepDetailsMessageCreationObject::class => RunStepDetailsMessageCreationObjectNormalizer::class, + RunStepDetailsMessageCreationObjectMessageCreation::class => RunStepDetailsMessageCreationObjectMessageCreationNormalizer::class, + RunStepDetailsToolCallsObject::class => RunStepDetailsToolCallsObjectNormalizer::class, + RunStepDetailsToolCallsCodeObject::class => RunStepDetailsToolCallsCodeObjectNormalizer::class, + RunStepDetailsToolCallsCodeObjectCodeInterpreter::class => RunStepDetailsToolCallsCodeObjectCodeInterpreterNormalizer::class, + RunStepDetailsToolCallsCodeOutputLogsObject::class => RunStepDetailsToolCallsCodeOutputLogsObjectNormalizer::class, + RunStepDetailsToolCallsCodeOutputImageObject::class => RunStepDetailsToolCallsCodeOutputImageObjectNormalizer::class, + RunStepDetailsToolCallsCodeOutputImageObjectImage::class => RunStepDetailsToolCallsCodeOutputImageObjectImageNormalizer::class, + RunStepDetailsToolCallsRetrievalObject::class => RunStepDetailsToolCallsRetrievalObjectNormalizer::class, + RunStepDetailsToolCallsFunctionObject::class => RunStepDetailsToolCallsFunctionObjectNormalizer::class, + RunStepDetailsToolCallsFunctionObjectFunction::class => RunStepDetailsToolCallsFunctionObjectFunctionNormalizer::class, + AssistantFileObject::class => AssistantFileObjectNormalizer::class, + CreateAssistantFileRequest::class => CreateAssistantFileRequestNormalizer::class, + DeleteAssistantFileResponse::class => DeleteAssistantFileResponseNormalizer::class, + ListAssistantFilesResponse::class => ListAssistantFilesResponseNormalizer::class, + MessageFileObject::class => MessageFileObjectNormalizer::class, + ListMessageFilesResponse::class => ListMessageFilesResponseNormalizer::class, + Reference::class => ReferenceNormalizer::class, ]; protected array $normalizersCache = []; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return array_key_exists($type, $this->normalizers); } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && array_key_exists($data::class, $this->normalizers); } @@ -183,6 +347,157 @@ public function denormalize($data, $class, $format = null, array $context = []) return $denormalizer->denormalize($data, $class, $format, $context); } + public function getSupportedTypes(?string $format = null): array + { + return [ + Error::class => false, + ErrorResponse::class => false, + ListModelsResponse::class => false, + DeleteModelResponse::class => false, + CreateCompletionRequest::class => false, + CreateCompletionResponse::class => false, + CreateCompletionResponseChoicesItem::class => false, + CreateCompletionResponseChoicesItemLogprobs::class => false, + ChatCompletionRequestMessageContentPartImage::class => false, + ChatCompletionRequestMessageContentPartImageImageUrl::class => false, + ChatCompletionRequestMessageContentPartText::class => false, + ChatCompletionRequestSystemMessage::class => false, + ChatCompletionRequestUserMessage::class => false, + ChatCompletionRequestAssistantMessage::class => false, + ChatCompletionRequestAssistantMessageFunctionCall::class => false, + ChatCompletionRequestToolMessage::class => false, + ChatCompletionRequestFunctionMessage::class => false, + ChatCompletionFunctions::class => false, + ChatCompletionFunctionCallOption::class => false, + ChatCompletionTool::class => false, + FunctionObject::class => false, + ChatCompletionNamedToolChoice::class => false, + ChatCompletionNamedToolChoiceFunction::class => false, + ChatCompletionMessageToolCall::class => false, + ChatCompletionMessageToolCallFunction::class => false, + ChatCompletionMessageToolCallChunk::class => false, + ChatCompletionMessageToolCallChunkFunction::class => false, + ChatCompletionResponseMessage::class => false, + ChatCompletionResponseMessageFunctionCall::class => false, + ChatCompletionStreamResponseDelta::class => false, + ChatCompletionStreamResponseDeltaFunctionCall::class => false, + CreateChatCompletionRequest::class => false, + CreateChatCompletionRequestResponseFormat::class => false, + CreateChatCompletionResponse::class => false, + CreateChatCompletionResponseChoicesItem::class => false, + CreateChatCompletionResponseChoicesItemLogprobs::class => false, + CreateChatCompletionFunctionResponse::class => false, + CreateChatCompletionFunctionResponseChoicesItem::class => false, + ChatCompletionTokenLogprob::class => false, + ChatCompletionTokenLogprobTopLogprobsItem::class => false, + ListPaginatedFineTuningJobsResponse::class => false, + CreateChatCompletionStreamResponse::class => false, + CreateChatCompletionStreamResponseChoicesItem::class => false, + CreateChatCompletionStreamResponseChoicesItemLogprobs::class => false, + CreateEditRequest::class => false, + CreateEditResponse::class => false, + CreateEditResponseChoicesItem::class => false, + CreateImageRequest::class => false, + ImagesResponse::class => false, + Image::class => false, + CreateImageEditRequest::class => false, + CreateImageVariationRequest::class => false, + CreateModerationRequest::class => false, + CreateModerationResponse::class => false, + CreateModerationResponseResultsItem::class => false, + CreateModerationResponseResultsItemCategories::class => false, + CreateModerationResponseResultsItemCategoryScores::class => false, + ListFilesResponse::class => false, + CreateFileRequest::class => false, + DeleteFileResponse::class => false, + CreateFineTuningJobRequest::class => false, + CreateFineTuningJobRequestHyperparameters::class => false, + ListFineTuningJobEventsResponse::class => false, + CreateFineTuneRequest::class => false, + CreateFineTuneRequestHyperparameters::class => false, + ListFineTunesResponse::class => false, + ListFineTuneEventsResponse::class => false, + CreateEmbeddingRequest::class => false, + CreateEmbeddingResponse::class => false, + CreateEmbeddingResponseUsage::class => false, + CreateTranscriptionRequest::class => false, + CreateTranscriptionResponse::class => false, + CreateTranslationRequest::class => false, + CreateTranslationResponse::class => false, + CreateSpeechRequest::class => false, + Model::class => false, + OpenAIFile::class => false, + Embedding::class => false, + FineTuningJob::class => false, + FineTuningJobError::class => false, + FineTuningJobHyperparameters::class => false, + FineTuningJobEvent::class => false, + FineTune::class => false, + FineTuneHyperparams::class => false, + FineTuneEvent::class => false, + CompletionUsage::class => false, + AssistantObject::class => false, + CreateAssistantRequest::class => false, + ModifyAssistantRequest::class => false, + DeleteAssistantResponse::class => false, + ListAssistantsResponse::class => false, + AssistantToolsCode::class => false, + AssistantToolsRetrieval::class => false, + AssistantToolsFunction::class => false, + RunObject::class => false, + RunObjectRequiredAction::class => false, + RunObjectRequiredActionSubmitToolOutputs::class => false, + RunObjectLastError::class => false, + CreateRunRequest::class => false, + ListRunsResponse::class => false, + ModifyRunRequest::class => false, + SubmitToolOutputsRunRequest::class => false, + SubmitToolOutputsRunRequestToolOutputsItem::class => false, + RunToolCallObject::class => false, + RunToolCallObjectFunction::class => false, + CreateThreadAndRunRequest::class => false, + ThreadObject::class => false, + CreateThreadRequest::class => false, + ModifyThreadRequest::class => false, + DeleteThreadResponse::class => false, + ListThreadsResponse::class => false, + MessageObject::class => false, + CreateMessageRequest::class => false, + ModifyMessageRequest::class => false, + DeleteMessageResponse::class => false, + ListMessagesResponse::class => false, + MessageContentImageFileObject::class => false, + MessageContentImageFileObjectImageFile::class => false, + MessageContentTextObject::class => false, + MessageContentTextObjectText::class => false, + MessageContentTextAnnotationsFileCitationObject::class => false, + MessageContentTextAnnotationsFileCitationObjectFileCitation::class => false, + MessageContentTextAnnotationsFilePathObject::class => false, + MessageContentTextAnnotationsFilePathObjectFilePath::class => false, + RunStepObject::class => false, + RunStepObjectLastError::class => false, + ListRunStepsResponse::class => false, + RunStepDetailsMessageCreationObject::class => false, + RunStepDetailsMessageCreationObjectMessageCreation::class => false, + RunStepDetailsToolCallsObject::class => false, + RunStepDetailsToolCallsCodeObject::class => false, + RunStepDetailsToolCallsCodeObjectCodeInterpreter::class => false, + RunStepDetailsToolCallsCodeOutputLogsObject::class => false, + RunStepDetailsToolCallsCodeOutputImageObject::class => false, + RunStepDetailsToolCallsCodeOutputImageObjectImage::class => false, + RunStepDetailsToolCallsRetrievalObject::class => false, + RunStepDetailsToolCallsFunctionObject::class => false, + RunStepDetailsToolCallsFunctionObjectFunction::class => false, + AssistantFileObject::class => false, + CreateAssistantFileRequest::class => false, + DeleteAssistantFileResponse::class => false, + ListAssistantFilesResponse::class => false, + MessageFileObject::class => false, + ListMessageFilesResponse::class => false, + Reference::class => false, + ]; + } + private function getNormalizer(string $normalizerClass) { return $this->normalizersCache[$normalizerClass] ?? $this->initNormalizer($normalizerClass); diff --git a/generated/Normalizer/ListAssistantFilesResponseNormalizer.php b/generated/Normalizer/ListAssistantFilesResponseNormalizer.php new file mode 100644 index 0000000..7cb8d61 --- /dev/null +++ b/generated/Normalizer/ListAssistantFilesResponseNormalizer.php @@ -0,0 +1,113 @@ +setObject($data['object']); + unset($data['object']); + } + if (\array_key_exists('data', $data)) { + $values = []; + foreach ($data['data'] as $value) { + $values[] = $this->denormalizer->denormalize($value, AssistantFileObject::class, 'json', $context); + } + $object->setData($values); + unset($data['data']); + } + if (\array_key_exists('first_id', $data)) { + $object->setFirstId($data['first_id']); + unset($data['first_id']); + } + if (\array_key_exists('last_id', $data)) { + $object->setLastId($data['last_id']); + unset($data['last_id']); + } + if (\array_key_exists('has_more', $data)) { + $object->setHasMore($data['has_more']); + unset($data['has_more']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['object'] = $object->getObject(); + $values = []; + foreach ($object->getData() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['data'] = $values; + $data['first_id'] = $object->getFirstId(); + $data['last_id'] = $object->getLastId(); + $data['has_more'] = $object->getHasMore(); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ListAssistantFilesResponse::class => false, + ]; + } +} diff --git a/generated/Normalizer/ListAssistantsResponseNormalizer.php b/generated/Normalizer/ListAssistantsResponseNormalizer.php new file mode 100644 index 0000000..e242b23 --- /dev/null +++ b/generated/Normalizer/ListAssistantsResponseNormalizer.php @@ -0,0 +1,113 @@ +setObject($data['object']); + unset($data['object']); + } + if (\array_key_exists('data', $data)) { + $values = []; + foreach ($data['data'] as $value) { + $values[] = $this->denormalizer->denormalize($value, AssistantObject::class, 'json', $context); + } + $object->setData($values); + unset($data['data']); + } + if (\array_key_exists('first_id', $data)) { + $object->setFirstId($data['first_id']); + unset($data['first_id']); + } + if (\array_key_exists('last_id', $data)) { + $object->setLastId($data['last_id']); + unset($data['last_id']); + } + if (\array_key_exists('has_more', $data)) { + $object->setHasMore($data['has_more']); + unset($data['has_more']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['object'] = $object->getObject(); + $values = []; + foreach ($object->getData() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['data'] = $values; + $data['first_id'] = $object->getFirstId(); + $data['last_id'] = $object->getLastId(); + $data['has_more'] = $object->getHasMore(); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ListAssistantsResponse::class => false, + ]; + } +} diff --git a/generated/Normalizer/ListFilesResponseNormalizer.php b/generated/Normalizer/ListFilesResponseNormalizer.php index ca523d1..78b5f83 100644 --- a/generated/Normalizer/ListFilesResponseNormalizer.php +++ b/generated/Normalizer/ListFilesResponseNormalizer.php @@ -24,12 +24,12 @@ class ListFilesResponseNormalizer implements DenormalizerInterface, NormalizerIn use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === ListFilesResponse::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === ListFilesResponse::class; } @@ -49,10 +49,6 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('data', $data)) { $values = []; foreach ($data['data'] as $value) { @@ -61,6 +57,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setData($values); unset($data['data']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value_1; @@ -75,12 +75,12 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['object'] = $object->getObject(); $values = []; foreach ($object->getData() as $value) { $values[] = $this->normalizer->normalize($value, 'json', $context); } $data['data'] = $values; + $data['object'] = $object->getObject(); foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value_1; @@ -88,4 +88,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ListFilesResponse::class => false, + ]; + } } diff --git a/generated/Normalizer/ListFineTuneEventsResponseNormalizer.php b/generated/Normalizer/ListFineTuneEventsResponseNormalizer.php index 871f40d..8d83b3a 100644 --- a/generated/Normalizer/ListFineTuneEventsResponseNormalizer.php +++ b/generated/Normalizer/ListFineTuneEventsResponseNormalizer.php @@ -24,12 +24,12 @@ class ListFineTuneEventsResponseNormalizer implements DenormalizerInterface, Nor use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === ListFineTuneEventsResponse::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === ListFineTuneEventsResponse::class; } @@ -49,10 +49,6 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('data', $data)) { $values = []; foreach ($data['data'] as $value) { @@ -61,6 +57,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setData($values); unset($data['data']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value_1; @@ -75,12 +75,12 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['object'] = $object->getObject(); $values = []; foreach ($object->getData() as $value) { $values[] = $this->normalizer->normalize($value, 'json', $context); } $data['data'] = $values; + $data['object'] = $object->getObject(); foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value_1; @@ -88,4 +88,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ListFineTuneEventsResponse::class => false, + ]; + } } diff --git a/generated/Normalizer/ListFineTunesResponseNormalizer.php b/generated/Normalizer/ListFineTunesResponseNormalizer.php index e38eb72..d1165af 100644 --- a/generated/Normalizer/ListFineTunesResponseNormalizer.php +++ b/generated/Normalizer/ListFineTunesResponseNormalizer.php @@ -24,12 +24,12 @@ class ListFineTunesResponseNormalizer implements DenormalizerInterface, Normaliz use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === ListFineTunesResponse::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === ListFineTunesResponse::class; } @@ -49,10 +49,6 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('data', $data)) { $values = []; foreach ($data['data'] as $value) { @@ -61,6 +57,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setData($values); unset($data['data']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value_1; @@ -75,12 +75,12 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['object'] = $object->getObject(); $values = []; foreach ($object->getData() as $value) { $values[] = $this->normalizer->normalize($value, 'json', $context); } $data['data'] = $values; + $data['object'] = $object->getObject(); foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value_1; @@ -88,4 +88,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ListFineTunesResponse::class => false, + ]; + } } diff --git a/generated/Normalizer/ListEnginesResponseNormalizer.php b/generated/Normalizer/ListFineTuningJobEventsResponseNormalizer.php similarity index 75% rename from generated/Normalizer/ListEnginesResponseNormalizer.php rename to generated/Normalizer/ListFineTuningJobEventsResponseNormalizer.php index 0887f82..5880bdd 100644 --- a/generated/Normalizer/ListEnginesResponseNormalizer.php +++ b/generated/Normalizer/ListFineTuningJobEventsResponseNormalizer.php @@ -6,8 +6,8 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; -use Sourceability\OpenAIClient\Generated\Model\Engine; -use Sourceability\OpenAIClient\Generated\Model\ListEnginesResponse; +use Sourceability\OpenAIClient\Generated\Model\FineTuningJobEvent; +use Sourceability\OpenAIClient\Generated\Model\ListFineTuningJobEventsResponse; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -17,21 +17,21 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class ListEnginesResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ListFineTuningJobEventsResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { use DenormalizerAwareTrait; use NormalizerAwareTrait; use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { - return $type === ListEnginesResponse::class; + return $type === ListFineTuningJobEventsResponse::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { - return is_object($data) && $data::class === ListEnginesResponse::class; + return is_object($data) && $data::class === ListFineTuningJobEventsResponse::class; } /** @@ -45,22 +45,22 @@ public function denormalize($data, $class, $format = null, array $context = []) if (isset($data['$recursiveRef'])) { return new Reference($data['$recursiveRef'], $context['document-origin']); } - $object = new ListEnginesResponse(); + $object = new ListFineTuningJobEventsResponse(); if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('data', $data)) { $values = []; foreach ($data['data'] as $value) { - $values[] = $this->denormalizer->denormalize($value, Engine::class, 'json', $context); + $values[] = $this->denormalizer->denormalize($value, FineTuningJobEvent::class, 'json', $context); } $object->setData($values); unset($data['data']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value_1; @@ -75,12 +75,12 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['object'] = $object->getObject(); $values = []; foreach ($object->getData() as $value) { $values[] = $this->normalizer->normalize($value, 'json', $context); } $data['data'] = $values; + $data['object'] = $object->getObject(); foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value_1; @@ -88,4 +88,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ListFineTuningJobEventsResponse::class => false, + ]; + } } diff --git a/generated/Normalizer/ListMessageFilesResponseNormalizer.php b/generated/Normalizer/ListMessageFilesResponseNormalizer.php new file mode 100644 index 0000000..cfff9a5 --- /dev/null +++ b/generated/Normalizer/ListMessageFilesResponseNormalizer.php @@ -0,0 +1,113 @@ +setObject($data['object']); + unset($data['object']); + } + if (\array_key_exists('data', $data)) { + $values = []; + foreach ($data['data'] as $value) { + $values[] = $this->denormalizer->denormalize($value, MessageFileObject::class, 'json', $context); + } + $object->setData($values); + unset($data['data']); + } + if (\array_key_exists('first_id', $data)) { + $object->setFirstId($data['first_id']); + unset($data['first_id']); + } + if (\array_key_exists('last_id', $data)) { + $object->setLastId($data['last_id']); + unset($data['last_id']); + } + if (\array_key_exists('has_more', $data)) { + $object->setHasMore($data['has_more']); + unset($data['has_more']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['object'] = $object->getObject(); + $values = []; + foreach ($object->getData() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['data'] = $values; + $data['first_id'] = $object->getFirstId(); + $data['last_id'] = $object->getLastId(); + $data['has_more'] = $object->getHasMore(); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ListMessageFilesResponse::class => false, + ]; + } +} diff --git a/generated/Normalizer/ListMessagesResponseNormalizer.php b/generated/Normalizer/ListMessagesResponseNormalizer.php new file mode 100644 index 0000000..ed689b9 --- /dev/null +++ b/generated/Normalizer/ListMessagesResponseNormalizer.php @@ -0,0 +1,113 @@ +setObject($data['object']); + unset($data['object']); + } + if (\array_key_exists('data', $data)) { + $values = []; + foreach ($data['data'] as $value) { + $values[] = $this->denormalizer->denormalize($value, MessageObject::class, 'json', $context); + } + $object->setData($values); + unset($data['data']); + } + if (\array_key_exists('first_id', $data)) { + $object->setFirstId($data['first_id']); + unset($data['first_id']); + } + if (\array_key_exists('last_id', $data)) { + $object->setLastId($data['last_id']); + unset($data['last_id']); + } + if (\array_key_exists('has_more', $data)) { + $object->setHasMore($data['has_more']); + unset($data['has_more']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['object'] = $object->getObject(); + $values = []; + foreach ($object->getData() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['data'] = $values; + $data['first_id'] = $object->getFirstId(); + $data['last_id'] = $object->getLastId(); + $data['has_more'] = $object->getHasMore(); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ListMessagesResponse::class => false, + ]; + } +} diff --git a/generated/Normalizer/ListModelsResponseNormalizer.php b/generated/Normalizer/ListModelsResponseNormalizer.php index c3d488c..8fd722d 100644 --- a/generated/Normalizer/ListModelsResponseNormalizer.php +++ b/generated/Normalizer/ListModelsResponseNormalizer.php @@ -24,12 +24,12 @@ class ListModelsResponseNormalizer implements DenormalizerInterface, NormalizerI use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === ListModelsResponse::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === ListModelsResponse::class; } @@ -88,4 +88,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ListModelsResponse::class => false, + ]; + } } diff --git a/generated/Normalizer/CreateSearchResponseNormalizer.php b/generated/Normalizer/ListPaginatedFineTuningJobsResponseNormalizer.php similarity index 64% rename from generated/Normalizer/CreateSearchResponseNormalizer.php rename to generated/Normalizer/ListPaginatedFineTuningJobsResponseNormalizer.php index 558e3d0..f0c1702 100644 --- a/generated/Normalizer/CreateSearchResponseNormalizer.php +++ b/generated/Normalizer/ListPaginatedFineTuningJobsResponseNormalizer.php @@ -6,8 +6,8 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; -use Sourceability\OpenAIClient\Generated\Model\CreateSearchResponse; -use Sourceability\OpenAIClient\Generated\Model\CreateSearchResponseDataItem; +use Sourceability\OpenAIClient\Generated\Model\FineTuningJob; +use Sourceability\OpenAIClient\Generated\Model\ListPaginatedFineTuningJobsResponse; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -17,21 +17,21 @@ use Symfony\Component\Serializer\Normalizer\NormalizerAwareTrait; use Symfony\Component\Serializer\Normalizer\NormalizerInterface; -class CreateSearchResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface +class ListPaginatedFineTuningJobsResponseNormalizer implements DenormalizerInterface, NormalizerInterface, DenormalizerAwareInterface, NormalizerAwareInterface { use DenormalizerAwareTrait; use NormalizerAwareTrait; use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { - return $type === CreateSearchResponse::class; + return $type === ListPaginatedFineTuningJobsResponse::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { - return is_object($data) && $data::class === CreateSearchResponse::class; + return is_object($data) && $data::class === ListPaginatedFineTuningJobsResponse::class; } /** @@ -45,26 +45,26 @@ public function denormalize($data, $class, $format = null, array $context = []) if (isset($data['$recursiveRef'])) { return new Reference($data['$recursiveRef'], $context['document-origin']); } - $object = new CreateSearchResponse(); + $object = new ListPaginatedFineTuningJobsResponse(); if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } - if (\array_key_exists('model', $data)) { - $object->setModel($data['model']); - unset($data['model']); - } if (\array_key_exists('data', $data)) { $values = []; foreach ($data['data'] as $value) { - $values[] = $this->denormalizer->denormalize($value, CreateSearchResponseDataItem::class, 'json', $context); + $values[] = $this->denormalizer->denormalize($value, FineTuningJob::class, 'json', $context); } $object->setData($values); unset($data['data']); } + if (\array_key_exists('has_more', $data)) { + $object->setHasMore($data['has_more']); + unset($data['has_more']); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value_1; @@ -79,19 +79,13 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - if ($object->isInitialized('object') && $object->getObject() !== null) { - $data['object'] = $object->getObject(); - } - if ($object->isInitialized('model') && $object->getModel() !== null) { - $data['model'] = $object->getModel(); - } - if ($object->isInitialized('data') && $object->getData() !== null) { - $values = []; - foreach ($object->getData() as $value) { - $values[] = $this->normalizer->normalize($value, 'json', $context); - } - $data['data'] = $values; + $values = []; + foreach ($object->getData() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); } + $data['data'] = $values; + $data['has_more'] = $object->getHasMore(); + $data['object'] = $object->getObject(); foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value_1; @@ -99,4 +93,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ListPaginatedFineTuningJobsResponse::class => false, + ]; + } } diff --git a/generated/Normalizer/ListRunStepsResponseNormalizer.php b/generated/Normalizer/ListRunStepsResponseNormalizer.php new file mode 100644 index 0000000..6de3ac6 --- /dev/null +++ b/generated/Normalizer/ListRunStepsResponseNormalizer.php @@ -0,0 +1,113 @@ +setObject($data['object']); + unset($data['object']); + } + if (\array_key_exists('data', $data)) { + $values = []; + foreach ($data['data'] as $value) { + $values[] = $this->denormalizer->denormalize($value, RunStepObject::class, 'json', $context); + } + $object->setData($values); + unset($data['data']); + } + if (\array_key_exists('first_id', $data)) { + $object->setFirstId($data['first_id']); + unset($data['first_id']); + } + if (\array_key_exists('last_id', $data)) { + $object->setLastId($data['last_id']); + unset($data['last_id']); + } + if (\array_key_exists('has_more', $data)) { + $object->setHasMore($data['has_more']); + unset($data['has_more']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['object'] = $object->getObject(); + $values = []; + foreach ($object->getData() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['data'] = $values; + $data['first_id'] = $object->getFirstId(); + $data['last_id'] = $object->getLastId(); + $data['has_more'] = $object->getHasMore(); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ListRunStepsResponse::class => false, + ]; + } +} diff --git a/generated/Normalizer/ListRunsResponseNormalizer.php b/generated/Normalizer/ListRunsResponseNormalizer.php new file mode 100644 index 0000000..2780ac8 --- /dev/null +++ b/generated/Normalizer/ListRunsResponseNormalizer.php @@ -0,0 +1,113 @@ +setObject($data['object']); + unset($data['object']); + } + if (\array_key_exists('data', $data)) { + $values = []; + foreach ($data['data'] as $value) { + $values[] = $this->denormalizer->denormalize($value, RunObject::class, 'json', $context); + } + $object->setData($values); + unset($data['data']); + } + if (\array_key_exists('first_id', $data)) { + $object->setFirstId($data['first_id']); + unset($data['first_id']); + } + if (\array_key_exists('last_id', $data)) { + $object->setLastId($data['last_id']); + unset($data['last_id']); + } + if (\array_key_exists('has_more', $data)) { + $object->setHasMore($data['has_more']); + unset($data['has_more']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['object'] = $object->getObject(); + $values = []; + foreach ($object->getData() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['data'] = $values; + $data['first_id'] = $object->getFirstId(); + $data['last_id'] = $object->getLastId(); + $data['has_more'] = $object->getHasMore(); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ListRunsResponse::class => false, + ]; + } +} diff --git a/generated/Normalizer/ListThreadsResponseNormalizer.php b/generated/Normalizer/ListThreadsResponseNormalizer.php new file mode 100644 index 0000000..0aa27b5 --- /dev/null +++ b/generated/Normalizer/ListThreadsResponseNormalizer.php @@ -0,0 +1,113 @@ +setObject($data['object']); + unset($data['object']); + } + if (\array_key_exists('data', $data)) { + $values = []; + foreach ($data['data'] as $value) { + $values[] = $this->denormalizer->denormalize($value, ThreadObject::class, 'json', $context); + } + $object->setData($values); + unset($data['data']); + } + if (\array_key_exists('first_id', $data)) { + $object->setFirstId($data['first_id']); + unset($data['first_id']); + } + if (\array_key_exists('last_id', $data)) { + $object->setLastId($data['last_id']); + unset($data['last_id']); + } + if (\array_key_exists('has_more', $data)) { + $object->setHasMore($data['has_more']); + unset($data['has_more']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['object'] = $object->getObject(); + $values = []; + foreach ($object->getData() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['data'] = $values; + $data['first_id'] = $object->getFirstId(); + $data['last_id'] = $object->getLastId(); + $data['has_more'] = $object->getHasMore(); + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ListThreadsResponse::class => false, + ]; + } +} diff --git a/generated/Normalizer/MessageContentImageFileObjectImageFileNormalizer.php b/generated/Normalizer/MessageContentImageFileObjectImageFileNormalizer.php new file mode 100644 index 0000000..072bce4 --- /dev/null +++ b/generated/Normalizer/MessageContentImageFileObjectImageFileNormalizer.php @@ -0,0 +1,84 @@ +setFileId($data['file_id']); + unset($data['file_id']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['file_id'] = $object->getFileId(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + MessageContentImageFileObjectImageFile::class => false, + ]; + } +} diff --git a/generated/Normalizer/MessageContentImageFileObjectNormalizer.php b/generated/Normalizer/MessageContentImageFileObjectNormalizer.php new file mode 100644 index 0000000..fb4db40 --- /dev/null +++ b/generated/Normalizer/MessageContentImageFileObjectNormalizer.php @@ -0,0 +1,90 @@ +setType($data['type']); + unset($data['type']); + } + if (\array_key_exists('image_file', $data)) { + $object->setImageFile($this->denormalizer->denormalize($data['image_file'], MessageContentImageFileObjectImageFile::class, 'json', $context)); + unset($data['image_file']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['type'] = $object->getType(); + $data['image_file'] = $this->normalizer->normalize($object->getImageFile(), 'json', $context); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + MessageContentImageFileObject::class => false, + ]; + } +} diff --git a/generated/Normalizer/MessageContentTextAnnotationsFileCitationObjectFileCitationNormalizer.php b/generated/Normalizer/MessageContentTextAnnotationsFileCitationObjectFileCitationNormalizer.php new file mode 100644 index 0000000..a0446be --- /dev/null +++ b/generated/Normalizer/MessageContentTextAnnotationsFileCitationObjectFileCitationNormalizer.php @@ -0,0 +1,89 @@ +setFileId($data['file_id']); + unset($data['file_id']); + } + if (\array_key_exists('quote', $data)) { + $object->setQuote($data['quote']); + unset($data['quote']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['file_id'] = $object->getFileId(); + $data['quote'] = $object->getQuote(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + MessageContentTextAnnotationsFileCitationObjectFileCitation::class => false, + ]; + } +} diff --git a/generated/Normalizer/MessageContentTextAnnotationsFileCitationObjectNormalizer.php b/generated/Normalizer/MessageContentTextAnnotationsFileCitationObjectNormalizer.php new file mode 100644 index 0000000..ad66369 --- /dev/null +++ b/generated/Normalizer/MessageContentTextAnnotationsFileCitationObjectNormalizer.php @@ -0,0 +1,105 @@ +setType($data['type']); + unset($data['type']); + } + if (\array_key_exists('text', $data)) { + $object->setText($data['text']); + unset($data['text']); + } + if (\array_key_exists('file_citation', $data)) { + $object->setFileCitation($this->denormalizer->denormalize($data['file_citation'], MessageContentTextAnnotationsFileCitationObjectFileCitation::class, 'json', $context)); + unset($data['file_citation']); + } + if (\array_key_exists('start_index', $data)) { + $object->setStartIndex($data['start_index']); + unset($data['start_index']); + } + if (\array_key_exists('end_index', $data)) { + $object->setEndIndex($data['end_index']); + unset($data['end_index']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['type'] = $object->getType(); + $data['text'] = $object->getText(); + $data['file_citation'] = $this->normalizer->normalize($object->getFileCitation(), 'json', $context); + $data['start_index'] = $object->getStartIndex(); + $data['end_index'] = $object->getEndIndex(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + MessageContentTextAnnotationsFileCitationObject::class => false, + ]; + } +} diff --git a/generated/Normalizer/MessageContentTextAnnotationsFilePathObjectFilePathNormalizer.php b/generated/Normalizer/MessageContentTextAnnotationsFilePathObjectFilePathNormalizer.php new file mode 100644 index 0000000..2a78986 --- /dev/null +++ b/generated/Normalizer/MessageContentTextAnnotationsFilePathObjectFilePathNormalizer.php @@ -0,0 +1,84 @@ +setFileId($data['file_id']); + unset($data['file_id']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['file_id'] = $object->getFileId(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + MessageContentTextAnnotationsFilePathObjectFilePath::class => false, + ]; + } +} diff --git a/generated/Normalizer/MessageContentTextAnnotationsFilePathObjectNormalizer.php b/generated/Normalizer/MessageContentTextAnnotationsFilePathObjectNormalizer.php new file mode 100644 index 0000000..67bd1b6 --- /dev/null +++ b/generated/Normalizer/MessageContentTextAnnotationsFilePathObjectNormalizer.php @@ -0,0 +1,105 @@ +setType($data['type']); + unset($data['type']); + } + if (\array_key_exists('text', $data)) { + $object->setText($data['text']); + unset($data['text']); + } + if (\array_key_exists('file_path', $data)) { + $object->setFilePath($this->denormalizer->denormalize($data['file_path'], MessageContentTextAnnotationsFilePathObjectFilePath::class, 'json', $context)); + unset($data['file_path']); + } + if (\array_key_exists('start_index', $data)) { + $object->setStartIndex($data['start_index']); + unset($data['start_index']); + } + if (\array_key_exists('end_index', $data)) { + $object->setEndIndex($data['end_index']); + unset($data['end_index']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['type'] = $object->getType(); + $data['text'] = $object->getText(); + $data['file_path'] = $this->normalizer->normalize($object->getFilePath(), 'json', $context); + $data['start_index'] = $object->getStartIndex(); + $data['end_index'] = $object->getEndIndex(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + MessageContentTextAnnotationsFilePathObject::class => false, + ]; + } +} diff --git a/generated/Normalizer/MessageContentTextObjectNormalizer.php b/generated/Normalizer/MessageContentTextObjectNormalizer.php new file mode 100644 index 0000000..e41d5a0 --- /dev/null +++ b/generated/Normalizer/MessageContentTextObjectNormalizer.php @@ -0,0 +1,90 @@ +setType($data['type']); + unset($data['type']); + } + if (\array_key_exists('text', $data)) { + $object->setText($this->denormalizer->denormalize($data['text'], MessageContentTextObjectText::class, 'json', $context)); + unset($data['text']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['type'] = $object->getType(); + $data['text'] = $this->normalizer->normalize($object->getText(), 'json', $context); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + MessageContentTextObject::class => false, + ]; + } +} diff --git a/generated/Normalizer/MessageContentTextObjectTextNormalizer.php b/generated/Normalizer/MessageContentTextObjectTextNormalizer.php new file mode 100644 index 0000000..6d85893 --- /dev/null +++ b/generated/Normalizer/MessageContentTextObjectTextNormalizer.php @@ -0,0 +1,97 @@ +setValue($data['value']); + unset($data['value']); + } + if (\array_key_exists('annotations', $data)) { + $values = []; + foreach ($data['annotations'] as $value) { + $values[] = $value; + } + $object->setAnnotations($values); + unset($data['annotations']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['value'] = $object->getValue(); + $values = []; + foreach ($object->getAnnotations() as $value) { + $values[] = $value; + } + $data['annotations'] = $values; + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + MessageContentTextObjectText::class => false, + ]; + } +} diff --git a/generated/Normalizer/MessageFileObjectNormalizer.php b/generated/Normalizer/MessageFileObjectNormalizer.php new file mode 100644 index 0000000..81be677 --- /dev/null +++ b/generated/Normalizer/MessageFileObjectNormalizer.php @@ -0,0 +1,99 @@ +setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } + if (\array_key_exists('created_at', $data)) { + $object->setCreatedAt($data['created_at']); + unset($data['created_at']); + } + if (\array_key_exists('message_id', $data)) { + $object->setMessageId($data['message_id']); + unset($data['message_id']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['id'] = $object->getId(); + $data['object'] = $object->getObject(); + $data['created_at'] = $object->getCreatedAt(); + $data['message_id'] = $object->getMessageId(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + MessageFileObject::class => false, + ]; + } +} diff --git a/generated/Normalizer/MessageObjectNormalizer.php b/generated/Normalizer/MessageObjectNormalizer.php new file mode 100644 index 0000000..0eb54d6 --- /dev/null +++ b/generated/Normalizer/MessageObjectNormalizer.php @@ -0,0 +1,159 @@ +setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } + if (\array_key_exists('created_at', $data)) { + $object->setCreatedAt($data['created_at']); + unset($data['created_at']); + } + if (\array_key_exists('thread_id', $data)) { + $object->setThreadId($data['thread_id']); + unset($data['thread_id']); + } + if (\array_key_exists('role', $data)) { + $object->setRole($data['role']); + unset($data['role']); + } + if (\array_key_exists('content', $data)) { + $values = []; + foreach ($data['content'] as $value) { + $values[] = $value; + } + $object->setContent($values); + unset($data['content']); + } + if (\array_key_exists('assistant_id', $data) && $data['assistant_id'] !== null) { + $object->setAssistantId($data['assistant_id']); + unset($data['assistant_id']); + } elseif (\array_key_exists('assistant_id', $data) && $data['assistant_id'] === null) { + $object->setAssistantId(null); + } + if (\array_key_exists('run_id', $data) && $data['run_id'] !== null) { + $object->setRunId($data['run_id']); + unset($data['run_id']); + } elseif (\array_key_exists('run_id', $data) && $data['run_id'] === null) { + $object->setRunId(null); + } + if (\array_key_exists('file_ids', $data)) { + $values_1 = []; + foreach ($data['file_ids'] as $value_1) { + $values_1[] = $value_1; + } + $object->setFileIds($values_1); + unset($data['file_ids']); + } + if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { + $values_2 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['metadata'] as $key => $value_2) { + $values_2[$key] = $value_2; + } + $object->setMetadata($values_2); + unset($data['metadata']); + } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { + $object->setMetadata(null); + } + foreach ($data as $key_1 => $value_3) { + if (preg_match('/.*/', (string) $key_1)) { + $object[$key_1] = $value_3; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['id'] = $object->getId(); + $data['object'] = $object->getObject(); + $data['created_at'] = $object->getCreatedAt(); + $data['thread_id'] = $object->getThreadId(); + $data['role'] = $object->getRole(); + $values = []; + foreach ($object->getContent() as $value) { + $values[] = $value; + } + $data['content'] = $values; + $data['assistant_id'] = $object->getAssistantId(); + $data['run_id'] = $object->getRunId(); + $values_1 = []; + foreach ($object->getFileIds() as $value_1) { + $values_1[] = $value_1; + } + $data['file_ids'] = $values_1; + $values_2 = []; + foreach ($object->getMetadata() as $key => $value_2) { + $values_2[$key] = $value_2; + } + $data['metadata'] = $values_2; + foreach ($object as $key_1 => $value_3) { + if (preg_match('/.*/', (string) $key_1)) { + $data[$key_1] = $value_3; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + MessageObject::class => false, + ]; + } +} diff --git a/generated/Normalizer/ModelNormalizer.php b/generated/Normalizer/ModelNormalizer.php index e3cfb3c..6c1bf16 100644 --- a/generated/Normalizer/ModelNormalizer.php +++ b/generated/Normalizer/ModelNormalizer.php @@ -23,12 +23,12 @@ class ModelNormalizer implements DenormalizerInterface, NormalizerInterface, Den use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === Model::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === Model::class; } @@ -52,14 +52,14 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('created', $data)) { $object->setCreated($data['created']); unset($data['created']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } if (\array_key_exists('owned_by', $data)) { $object->setOwnedBy($data['owned_by']); unset($data['owned_by']); @@ -79,8 +79,8 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['object'] = $object->getObject(); $data['created'] = $object->getCreated(); + $data['object'] = $object->getObject(); $data['owned_by'] = $object->getOwnedBy(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { @@ -89,4 +89,11 @@ public function normalize($object, $format = null, array $context = []) } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + Model::class => false, + ]; + } } diff --git a/generated/Normalizer/ModifyAssistantRequestNormalizer.php b/generated/Normalizer/ModifyAssistantRequestNormalizer.php new file mode 100644 index 0000000..632cf82 --- /dev/null +++ b/generated/Normalizer/ModifyAssistantRequestNormalizer.php @@ -0,0 +1,143 @@ +setModel($data['model']); + } + if (\array_key_exists('name', $data) && $data['name'] !== null) { + $object->setName($data['name']); + } elseif (\array_key_exists('name', $data) && $data['name'] === null) { + $object->setName(null); + } + if (\array_key_exists('description', $data) && $data['description'] !== null) { + $object->setDescription($data['description']); + } elseif (\array_key_exists('description', $data) && $data['description'] === null) { + $object->setDescription(null); + } + if (\array_key_exists('instructions', $data) && $data['instructions'] !== null) { + $object->setInstructions($data['instructions']); + } elseif (\array_key_exists('instructions', $data) && $data['instructions'] === null) { + $object->setInstructions(null); + } + if (\array_key_exists('tools', $data)) { + $values = []; + foreach ($data['tools'] as $value) { + $values[] = $value; + } + $object->setTools($values); + } + if (\array_key_exists('file_ids', $data)) { + $values_1 = []; + foreach ($data['file_ids'] as $value_1) { + $values_1[] = $value_1; + } + $object->setFileIds($values_1); + } + if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { + $values_2 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['metadata'] as $key => $value_2) { + $values_2[$key] = $value_2; + } + $object->setMetadata($values_2); + } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { + $object->setMetadata(null); + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('model') && $object->getModel() !== null) { + $data['model'] = $object->getModel(); + } + if ($object->isInitialized('name') && $object->getName() !== null) { + $data['name'] = $object->getName(); + } + if ($object->isInitialized('description') && $object->getDescription() !== null) { + $data['description'] = $object->getDescription(); + } + if ($object->isInitialized('instructions') && $object->getInstructions() !== null) { + $data['instructions'] = $object->getInstructions(); + } + if ($object->isInitialized('tools') && $object->getTools() !== null) { + $values = []; + foreach ($object->getTools() as $value) { + $values[] = $value; + } + $data['tools'] = $values; + } + if ($object->isInitialized('fileIds') && $object->getFileIds() !== null) { + $values_1 = []; + foreach ($object->getFileIds() as $value_1) { + $values_1[] = $value_1; + } + $data['file_ids'] = $values_1; + } + if ($object->isInitialized('metadata') && $object->getMetadata() !== null) { + $values_2 = []; + foreach ($object->getMetadata() as $key => $value_2) { + $values_2[$key] = $value_2; + } + $data['metadata'] = $values_2; + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ModifyAssistantRequest::class => false, + ]; + } +} diff --git a/generated/Normalizer/ModifyMessageRequestNormalizer.php b/generated/Normalizer/ModifyMessageRequestNormalizer.php new file mode 100644 index 0000000..4889a42 --- /dev/null +++ b/generated/Normalizer/ModifyMessageRequestNormalizer.php @@ -0,0 +1,85 @@ + $value) { + $values[$key] = $value; + } + $object->setMetadata($values); + } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { + $object->setMetadata(null); + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('metadata') && $object->getMetadata() !== null) { + $values = []; + foreach ($object->getMetadata() as $key => $value) { + $values[$key] = $value; + } + $data['metadata'] = $values; + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ModifyMessageRequest::class => false, + ]; + } +} diff --git a/generated/Normalizer/ModifyRunRequestNormalizer.php b/generated/Normalizer/ModifyRunRequestNormalizer.php new file mode 100644 index 0000000..b89fd74 --- /dev/null +++ b/generated/Normalizer/ModifyRunRequestNormalizer.php @@ -0,0 +1,85 @@ + $value) { + $values[$key] = $value; + } + $object->setMetadata($values); + } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { + $object->setMetadata(null); + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('metadata') && $object->getMetadata() !== null) { + $values = []; + foreach ($object->getMetadata() as $key => $value) { + $values[$key] = $value; + } + $data['metadata'] = $values; + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ModifyRunRequest::class => false, + ]; + } +} diff --git a/generated/Normalizer/ModifyThreadRequestNormalizer.php b/generated/Normalizer/ModifyThreadRequestNormalizer.php new file mode 100644 index 0000000..20a8146 --- /dev/null +++ b/generated/Normalizer/ModifyThreadRequestNormalizer.php @@ -0,0 +1,85 @@ + $value) { + $values[$key] = $value; + } + $object->setMetadata($values); + } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { + $object->setMetadata(null); + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('metadata') && $object->getMetadata() !== null) { + $values = []; + foreach ($object->getMetadata() as $key => $value) { + $values[$key] = $value; + } + $data['metadata'] = $values; + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ModifyThreadRequest::class => false, + ]; + } +} diff --git a/generated/Normalizer/OpenAIFileNormalizer.php b/generated/Normalizer/OpenAIFileNormalizer.php index 2ff42c6..7eee2b8 100644 --- a/generated/Normalizer/OpenAIFileNormalizer.php +++ b/generated/Normalizer/OpenAIFileNormalizer.php @@ -23,12 +23,12 @@ class OpenAIFileNormalizer implements DenormalizerInterface, NormalizerInterface use CheckArray; use ValidatorTrait; - public function supportsDenormalization($data, $type, $format = null): bool + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool { return $type === OpenAIFile::class; } - public function supportsNormalization($data, $format = null): bool + public function supportsNormalization($data, $format = null, array $context = []): bool { return is_object($data) && $data::class === OpenAIFile::class; } @@ -52,10 +52,6 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('bytes', $data)) { $object->setBytes($data['bytes']); unset($data['bytes']); @@ -68,6 +64,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setFilename($data['filename']); unset($data['filename']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } if (\array_key_exists('purpose', $data)) { $object->setPurpose($data['purpose']); unset($data['purpose']); @@ -76,19 +76,13 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setStatus($data['status']); unset($data['status']); } - if (\array_key_exists('status_details', $data) && $data['status_details'] !== null) { - $values = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - foreach ($data['status_details'] as $key => $value) { - $values[$key] = $value; - } - $object->setStatusDetails($values); + if (\array_key_exists('status_details', $data)) { + $object->setStatusDetails($data['status_details']); unset($data['status_details']); - } elseif (\array_key_exists('status_details', $data) && $data['status_details'] === null) { - $object->setStatusDetails(null); } - foreach ($data as $key_1 => $value_1) { - if (preg_match('/.*/', (string) $key_1)) { - $object[$key_1] = $value_1; + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; } } return $object; @@ -101,26 +95,27 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['object'] = $object->getObject(); $data['bytes'] = $object->getBytes(); $data['created_at'] = $object->getCreatedAt(); $data['filename'] = $object->getFilename(); + $data['object'] = $object->getObject(); $data['purpose'] = $object->getPurpose(); - if ($object->isInitialized('status') && $object->getStatus() !== null) { - $data['status'] = $object->getStatus(); - } + $data['status'] = $object->getStatus(); if ($object->isInitialized('statusDetails') && $object->getStatusDetails() !== null) { - $values = []; - foreach ($object->getStatusDetails() as $key => $value) { - $values[$key] = $value; - } - $data['status_details'] = $values; + $data['status_details'] = $object->getStatusDetails(); } - foreach ($object as $key_1 => $value_1) { - if (preg_match('/.*/', (string) $key_1)) { - $data[$key_1] = $value_1; + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; } } return $data; } + + public function getSupportedTypes(?string $format = null): array + { + return [ + OpenAIFile::class => false, + ]; + } } diff --git a/generated/Normalizer/RunObjectLastErrorNormalizer.php b/generated/Normalizer/RunObjectLastErrorNormalizer.php new file mode 100644 index 0000000..3d42a63 --- /dev/null +++ b/generated/Normalizer/RunObjectLastErrorNormalizer.php @@ -0,0 +1,89 @@ +setCode($data['code']); + unset($data['code']); + } + if (\array_key_exists('message', $data)) { + $object->setMessage($data['message']); + unset($data['message']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['code'] = $object->getCode(); + $data['message'] = $object->getMessage(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunObjectLastError::class => false, + ]; + } +} diff --git a/generated/Normalizer/RunObjectNormalizer.php b/generated/Normalizer/RunObjectNormalizer.php new file mode 100644 index 0000000..4e582b2 --- /dev/null +++ b/generated/Normalizer/RunObjectNormalizer.php @@ -0,0 +1,209 @@ +setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } + if (\array_key_exists('created_at', $data)) { + $object->setCreatedAt($data['created_at']); + unset($data['created_at']); + } + if (\array_key_exists('thread_id', $data)) { + $object->setThreadId($data['thread_id']); + unset($data['thread_id']); + } + if (\array_key_exists('assistant_id', $data)) { + $object->setAssistantId($data['assistant_id']); + unset($data['assistant_id']); + } + if (\array_key_exists('status', $data)) { + $object->setStatus($data['status']); + unset($data['status']); + } + if (\array_key_exists('required_action', $data) && $data['required_action'] !== null) { + $object->setRequiredAction($this->denormalizer->denormalize($data['required_action'], RunObjectRequiredAction::class, 'json', $context)); + unset($data['required_action']); + } elseif (\array_key_exists('required_action', $data) && $data['required_action'] === null) { + $object->setRequiredAction(null); + } + if (\array_key_exists('last_error', $data) && $data['last_error'] !== null) { + $object->setLastError($this->denormalizer->denormalize($data['last_error'], RunObjectLastError::class, 'json', $context)); + unset($data['last_error']); + } elseif (\array_key_exists('last_error', $data) && $data['last_error'] === null) { + $object->setLastError(null); + } + if (\array_key_exists('expires_at', $data)) { + $object->setExpiresAt($data['expires_at']); + unset($data['expires_at']); + } + if (\array_key_exists('started_at', $data) && $data['started_at'] !== null) { + $object->setStartedAt($data['started_at']); + unset($data['started_at']); + } elseif (\array_key_exists('started_at', $data) && $data['started_at'] === null) { + $object->setStartedAt(null); + } + if (\array_key_exists('cancelled_at', $data) && $data['cancelled_at'] !== null) { + $object->setCancelledAt($data['cancelled_at']); + unset($data['cancelled_at']); + } elseif (\array_key_exists('cancelled_at', $data) && $data['cancelled_at'] === null) { + $object->setCancelledAt(null); + } + if (\array_key_exists('failed_at', $data) && $data['failed_at'] !== null) { + $object->setFailedAt($data['failed_at']); + unset($data['failed_at']); + } elseif (\array_key_exists('failed_at', $data) && $data['failed_at'] === null) { + $object->setFailedAt(null); + } + if (\array_key_exists('completed_at', $data) && $data['completed_at'] !== null) { + $object->setCompletedAt($data['completed_at']); + unset($data['completed_at']); + } elseif (\array_key_exists('completed_at', $data) && $data['completed_at'] === null) { + $object->setCompletedAt(null); + } + if (\array_key_exists('model', $data)) { + $object->setModel($data['model']); + unset($data['model']); + } + if (\array_key_exists('instructions', $data)) { + $object->setInstructions($data['instructions']); + unset($data['instructions']); + } + if (\array_key_exists('tools', $data)) { + $values = []; + foreach ($data['tools'] as $value) { + $values[] = $value; + } + $object->setTools($values); + unset($data['tools']); + } + if (\array_key_exists('file_ids', $data)) { + $values_1 = []; + foreach ($data['file_ids'] as $value_1) { + $values_1[] = $value_1; + } + $object->setFileIds($values_1); + unset($data['file_ids']); + } + if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { + $values_2 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['metadata'] as $key => $value_2) { + $values_2[$key] = $value_2; + } + $object->setMetadata($values_2); + unset($data['metadata']); + } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { + $object->setMetadata(null); + } + foreach ($data as $key_1 => $value_3) { + if (preg_match('/.*/', (string) $key_1)) { + $object[$key_1] = $value_3; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['id'] = $object->getId(); + $data['object'] = $object->getObject(); + $data['created_at'] = $object->getCreatedAt(); + $data['thread_id'] = $object->getThreadId(); + $data['assistant_id'] = $object->getAssistantId(); + $data['status'] = $object->getStatus(); + $data['required_action'] = $this->normalizer->normalize($object->getRequiredAction(), 'json', $context); + $data['last_error'] = $this->normalizer->normalize($object->getLastError(), 'json', $context); + $data['expires_at'] = $object->getExpiresAt(); + $data['started_at'] = $object->getStartedAt(); + $data['cancelled_at'] = $object->getCancelledAt(); + $data['failed_at'] = $object->getFailedAt(); + $data['completed_at'] = $object->getCompletedAt(); + $data['model'] = $object->getModel(); + $data['instructions'] = $object->getInstructions(); + $values = []; + foreach ($object->getTools() as $value) { + $values[] = $value; + } + $data['tools'] = $values; + $values_1 = []; + foreach ($object->getFileIds() as $value_1) { + $values_1[] = $value_1; + } + $data['file_ids'] = $values_1; + $values_2 = []; + foreach ($object->getMetadata() as $key => $value_2) { + $values_2[$key] = $value_2; + } + $data['metadata'] = $values_2; + foreach ($object as $key_1 => $value_3) { + if (preg_match('/.*/', (string) $key_1)) { + $data[$key_1] = $value_3; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunObject::class => false, + ]; + } +} diff --git a/generated/Normalizer/RunObjectRequiredActionNormalizer.php b/generated/Normalizer/RunObjectRequiredActionNormalizer.php new file mode 100644 index 0000000..a554f6b --- /dev/null +++ b/generated/Normalizer/RunObjectRequiredActionNormalizer.php @@ -0,0 +1,90 @@ +setType($data['type']); + unset($data['type']); + } + if (\array_key_exists('submit_tool_outputs', $data)) { + $object->setSubmitToolOutputs($this->denormalizer->denormalize($data['submit_tool_outputs'], RunObjectRequiredActionSubmitToolOutputs::class, 'json', $context)); + unset($data['submit_tool_outputs']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['type'] = $object->getType(); + $data['submit_tool_outputs'] = $this->normalizer->normalize($object->getSubmitToolOutputs(), 'json', $context); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunObjectRequiredAction::class => false, + ]; + } +} diff --git a/generated/Normalizer/RunObjectRequiredActionSubmitToolOutputsNormalizer.php b/generated/Normalizer/RunObjectRequiredActionSubmitToolOutputsNormalizer.php new file mode 100644 index 0000000..e5d1c4e --- /dev/null +++ b/generated/Normalizer/RunObjectRequiredActionSubmitToolOutputsNormalizer.php @@ -0,0 +1,93 @@ +denormalizer->denormalize($value, RunToolCallObject::class, 'json', $context); + } + $object->setToolCalls($values); + unset($data['tool_calls']); + } + foreach ($data as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getToolCalls() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['tool_calls'] = $values; + foreach ($object as $key => $value_1) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunObjectRequiredActionSubmitToolOutputs::class => false, + ]; + } +} diff --git a/generated/Normalizer/RunStepDetailsMessageCreationObjectMessageCreationNormalizer.php b/generated/Normalizer/RunStepDetailsMessageCreationObjectMessageCreationNormalizer.php new file mode 100644 index 0000000..6d57ac4 --- /dev/null +++ b/generated/Normalizer/RunStepDetailsMessageCreationObjectMessageCreationNormalizer.php @@ -0,0 +1,84 @@ +setMessageId($data['message_id']); + unset($data['message_id']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['message_id'] = $object->getMessageId(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunStepDetailsMessageCreationObjectMessageCreation::class => false, + ]; + } +} diff --git a/generated/Normalizer/RunStepDetailsMessageCreationObjectNormalizer.php b/generated/Normalizer/RunStepDetailsMessageCreationObjectNormalizer.php new file mode 100644 index 0000000..339dd4a --- /dev/null +++ b/generated/Normalizer/RunStepDetailsMessageCreationObjectNormalizer.php @@ -0,0 +1,90 @@ +setType($data['type']); + unset($data['type']); + } + if (\array_key_exists('message_creation', $data)) { + $object->setMessageCreation($this->denormalizer->denormalize($data['message_creation'], RunStepDetailsMessageCreationObjectMessageCreation::class, 'json', $context)); + unset($data['message_creation']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['type'] = $object->getType(); + $data['message_creation'] = $this->normalizer->normalize($object->getMessageCreation(), 'json', $context); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunStepDetailsMessageCreationObject::class => false, + ]; + } +} diff --git a/generated/Normalizer/RunStepDetailsToolCallsCodeObjectCodeInterpreterNormalizer.php b/generated/Normalizer/RunStepDetailsToolCallsCodeObjectCodeInterpreterNormalizer.php new file mode 100644 index 0000000..aca721a --- /dev/null +++ b/generated/Normalizer/RunStepDetailsToolCallsCodeObjectCodeInterpreterNormalizer.php @@ -0,0 +1,105 @@ +setInput($data['input']); + unset($data['input']); + } + if (\array_key_exists('outputs', $data)) { + $values = []; + foreach ($data['outputs'] as $value) { + $values_1 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($value as $key => $value_1) { + $values_1[$key] = $value_1; + } + $values[] = $values_1; + } + $object->setOutputs($values); + unset($data['outputs']); + } + foreach ($data as $key_1 => $value_2) { + if (preg_match('/.*/', (string) $key_1)) { + $object[$key_1] = $value_2; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['input'] = $object->getInput(); + $values = []; + foreach ($object->getOutputs() as $value) { + $values_1 = []; + foreach ($value as $key => $value_1) { + $values_1[$key] = $value_1; + } + $values[] = $values_1; + } + $data['outputs'] = $values; + foreach ($object as $key_1 => $value_2) { + if (preg_match('/.*/', (string) $key_1)) { + $data[$key_1] = $value_2; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunStepDetailsToolCallsCodeObjectCodeInterpreter::class => false, + ]; + } +} diff --git a/generated/Normalizer/RunStepDetailsToolCallsCodeObjectNormalizer.php b/generated/Normalizer/RunStepDetailsToolCallsCodeObjectNormalizer.php new file mode 100644 index 0000000..c70013e --- /dev/null +++ b/generated/Normalizer/RunStepDetailsToolCallsCodeObjectNormalizer.php @@ -0,0 +1,95 @@ +setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } + if (\array_key_exists('code_interpreter', $data)) { + $object->setCodeInterpreter($this->denormalizer->denormalize($data['code_interpreter'], RunStepDetailsToolCallsCodeObjectCodeInterpreter::class, 'json', $context)); + unset($data['code_interpreter']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['id'] = $object->getId(); + $data['type'] = $object->getType(); + $data['code_interpreter'] = $this->normalizer->normalize($object->getCodeInterpreter(), 'json', $context); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunStepDetailsToolCallsCodeObject::class => false, + ]; + } +} diff --git a/generated/Normalizer/RunStepDetailsToolCallsCodeOutputImageObjectImageNormalizer.php b/generated/Normalizer/RunStepDetailsToolCallsCodeOutputImageObjectImageNormalizer.php new file mode 100644 index 0000000..52223e5 --- /dev/null +++ b/generated/Normalizer/RunStepDetailsToolCallsCodeOutputImageObjectImageNormalizer.php @@ -0,0 +1,84 @@ +setFileId($data['file_id']); + unset($data['file_id']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['file_id'] = $object->getFileId(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunStepDetailsToolCallsCodeOutputImageObjectImage::class => false, + ]; + } +} diff --git a/generated/Normalizer/RunStepDetailsToolCallsCodeOutputImageObjectNormalizer.php b/generated/Normalizer/RunStepDetailsToolCallsCodeOutputImageObjectNormalizer.php new file mode 100644 index 0000000..eee32fe --- /dev/null +++ b/generated/Normalizer/RunStepDetailsToolCallsCodeOutputImageObjectNormalizer.php @@ -0,0 +1,90 @@ +setType($data['type']); + unset($data['type']); + } + if (\array_key_exists('image', $data)) { + $object->setImage($this->denormalizer->denormalize($data['image'], RunStepDetailsToolCallsCodeOutputImageObjectImage::class, 'json', $context)); + unset($data['image']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['type'] = $object->getType(); + $data['image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunStepDetailsToolCallsCodeOutputImageObject::class => false, + ]; + } +} diff --git a/generated/Normalizer/RunStepDetailsToolCallsCodeOutputLogsObjectNormalizer.php b/generated/Normalizer/RunStepDetailsToolCallsCodeOutputLogsObjectNormalizer.php new file mode 100644 index 0000000..c320228 --- /dev/null +++ b/generated/Normalizer/RunStepDetailsToolCallsCodeOutputLogsObjectNormalizer.php @@ -0,0 +1,89 @@ +setType($data['type']); + unset($data['type']); + } + if (\array_key_exists('logs', $data)) { + $object->setLogs($data['logs']); + unset($data['logs']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['type'] = $object->getType(); + $data['logs'] = $object->getLogs(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunStepDetailsToolCallsCodeOutputLogsObject::class => false, + ]; + } +} diff --git a/generated/Normalizer/RunStepDetailsToolCallsFunctionObjectFunctionNormalizer.php b/generated/Normalizer/RunStepDetailsToolCallsFunctionObjectFunctionNormalizer.php new file mode 100644 index 0000000..6d7f182 --- /dev/null +++ b/generated/Normalizer/RunStepDetailsToolCallsFunctionObjectFunctionNormalizer.php @@ -0,0 +1,96 @@ +setName($data['name']); + unset($data['name']); + } + if (\array_key_exists('arguments', $data)) { + $object->setArguments($data['arguments']); + unset($data['arguments']); + } + if (\array_key_exists('output', $data) && $data['output'] !== null) { + $object->setOutput($data['output']); + unset($data['output']); + } elseif (\array_key_exists('output', $data) && $data['output'] === null) { + $object->setOutput(null); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['name'] = $object->getName(); + $data['arguments'] = $object->getArguments(); + $data['output'] = $object->getOutput(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunStepDetailsToolCallsFunctionObjectFunction::class => false, + ]; + } +} diff --git a/generated/Normalizer/RunStepDetailsToolCallsFunctionObjectNormalizer.php b/generated/Normalizer/RunStepDetailsToolCallsFunctionObjectNormalizer.php new file mode 100644 index 0000000..f199861 --- /dev/null +++ b/generated/Normalizer/RunStepDetailsToolCallsFunctionObjectNormalizer.php @@ -0,0 +1,95 @@ +setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } + if (\array_key_exists('function', $data)) { + $object->setFunction($this->denormalizer->denormalize($data['function'], RunStepDetailsToolCallsFunctionObjectFunction::class, 'json', $context)); + unset($data['function']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['id'] = $object->getId(); + $data['type'] = $object->getType(); + $data['function'] = $this->normalizer->normalize($object->getFunction(), 'json', $context); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunStepDetailsToolCallsFunctionObject::class => false, + ]; + } +} diff --git a/generated/Normalizer/RunStepDetailsToolCallsObjectNormalizer.php b/generated/Normalizer/RunStepDetailsToolCallsObjectNormalizer.php new file mode 100644 index 0000000..6c8dc97 --- /dev/null +++ b/generated/Normalizer/RunStepDetailsToolCallsObjectNormalizer.php @@ -0,0 +1,105 @@ +setType($data['type']); + unset($data['type']); + } + if (\array_key_exists('tool_calls', $data)) { + $values = []; + foreach ($data['tool_calls'] as $value) { + $values_1 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($value as $key => $value_1) { + $values_1[$key] = $value_1; + } + $values[] = $values_1; + } + $object->setToolCalls($values); + unset($data['tool_calls']); + } + foreach ($data as $key_1 => $value_2) { + if (preg_match('/.*/', (string) $key_1)) { + $object[$key_1] = $value_2; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['type'] = $object->getType(); + $values = []; + foreach ($object->getToolCalls() as $value) { + $values_1 = []; + foreach ($value as $key => $value_1) { + $values_1[$key] = $value_1; + } + $values[] = $values_1; + } + $data['tool_calls'] = $values; + foreach ($object as $key_1 => $value_2) { + if (preg_match('/.*/', (string) $key_1)) { + $data[$key_1] = $value_2; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunStepDetailsToolCallsObject::class => false, + ]; + } +} diff --git a/generated/Normalizer/RunStepDetailsToolCallsRetrievalObjectNormalizer.php b/generated/Normalizer/RunStepDetailsToolCallsRetrievalObjectNormalizer.php new file mode 100644 index 0000000..5186034 --- /dev/null +++ b/generated/Normalizer/RunStepDetailsToolCallsRetrievalObjectNormalizer.php @@ -0,0 +1,102 @@ +setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } + if (\array_key_exists('retrieval', $data)) { + $values = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['retrieval'] as $key => $value) { + $values[$key] = $value; + } + $object->setRetrieval($values); + unset($data['retrieval']); + } + foreach ($data as $key_1 => $value_1) { + if (preg_match('/.*/', (string) $key_1)) { + $object[$key_1] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['id'] = $object->getId(); + $data['type'] = $object->getType(); + $values = []; + foreach ($object->getRetrieval() as $key => $value) { + $values[$key] = $value; + } + $data['retrieval'] = $values; + foreach ($object as $key_1 => $value_1) { + if (preg_match('/.*/', (string) $key_1)) { + $data[$key_1] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunStepDetailsToolCallsRetrievalObject::class => false, + ]; + } +} diff --git a/generated/Normalizer/RunStepObjectLastErrorNormalizer.php b/generated/Normalizer/RunStepObjectLastErrorNormalizer.php new file mode 100644 index 0000000..5d2e7d0 --- /dev/null +++ b/generated/Normalizer/RunStepObjectLastErrorNormalizer.php @@ -0,0 +1,89 @@ +setCode($data['code']); + unset($data['code']); + } + if (\array_key_exists('message', $data)) { + $object->setMessage($data['message']); + unset($data['message']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['code'] = $object->getCode(); + $data['message'] = $object->getMessage(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunStepObjectLastError::class => false, + ]; + } +} diff --git a/generated/Normalizer/RunStepObjectNormalizer.php b/generated/Normalizer/RunStepObjectNormalizer.php new file mode 100644 index 0000000..4a72c3c --- /dev/null +++ b/generated/Normalizer/RunStepObjectNormalizer.php @@ -0,0 +1,183 @@ +setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } + if (\array_key_exists('created_at', $data)) { + $object->setCreatedAt($data['created_at']); + unset($data['created_at']); + } + if (\array_key_exists('assistant_id', $data)) { + $object->setAssistantId($data['assistant_id']); + unset($data['assistant_id']); + } + if (\array_key_exists('thread_id', $data)) { + $object->setThreadId($data['thread_id']); + unset($data['thread_id']); + } + if (\array_key_exists('run_id', $data)) { + $object->setRunId($data['run_id']); + unset($data['run_id']); + } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } + if (\array_key_exists('status', $data)) { + $object->setStatus($data['status']); + unset($data['status']); + } + if (\array_key_exists('step_details', $data)) { + $values = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['step_details'] as $key => $value) { + $values[$key] = $value; + } + $object->setStepDetails($values); + unset($data['step_details']); + } + if (\array_key_exists('last_error', $data) && $data['last_error'] !== null) { + $object->setLastError($this->denormalizer->denormalize($data['last_error'], RunStepObjectLastError::class, 'json', $context)); + unset($data['last_error']); + } elseif (\array_key_exists('last_error', $data) && $data['last_error'] === null) { + $object->setLastError(null); + } + if (\array_key_exists('expired_at', $data) && $data['expired_at'] !== null) { + $object->setExpiredAt($data['expired_at']); + unset($data['expired_at']); + } elseif (\array_key_exists('expired_at', $data) && $data['expired_at'] === null) { + $object->setExpiredAt(null); + } + if (\array_key_exists('cancelled_at', $data) && $data['cancelled_at'] !== null) { + $object->setCancelledAt($data['cancelled_at']); + unset($data['cancelled_at']); + } elseif (\array_key_exists('cancelled_at', $data) && $data['cancelled_at'] === null) { + $object->setCancelledAt(null); + } + if (\array_key_exists('failed_at', $data) && $data['failed_at'] !== null) { + $object->setFailedAt($data['failed_at']); + unset($data['failed_at']); + } elseif (\array_key_exists('failed_at', $data) && $data['failed_at'] === null) { + $object->setFailedAt(null); + } + if (\array_key_exists('completed_at', $data) && $data['completed_at'] !== null) { + $object->setCompletedAt($data['completed_at']); + unset($data['completed_at']); + } elseif (\array_key_exists('completed_at', $data) && $data['completed_at'] === null) { + $object->setCompletedAt(null); + } + if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { + $values_1 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['metadata'] as $key_1 => $value_1) { + $values_1[$key_1] = $value_1; + } + $object->setMetadata($values_1); + unset($data['metadata']); + } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { + $object->setMetadata(null); + } + foreach ($data as $key_2 => $value_2) { + if (preg_match('/.*/', (string) $key_2)) { + $object[$key_2] = $value_2; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['id'] = $object->getId(); + $data['object'] = $object->getObject(); + $data['created_at'] = $object->getCreatedAt(); + $data['assistant_id'] = $object->getAssistantId(); + $data['thread_id'] = $object->getThreadId(); + $data['run_id'] = $object->getRunId(); + $data['type'] = $object->getType(); + $data['status'] = $object->getStatus(); + $values = []; + foreach ($object->getStepDetails() as $key => $value) { + $values[$key] = $value; + } + $data['step_details'] = $values; + $data['last_error'] = $this->normalizer->normalize($object->getLastError(), 'json', $context); + $data['expired_at'] = $object->getExpiredAt(); + $data['cancelled_at'] = $object->getCancelledAt(); + $data['failed_at'] = $object->getFailedAt(); + $data['completed_at'] = $object->getCompletedAt(); + $values_1 = []; + foreach ($object->getMetadata() as $key_1 => $value_1) { + $values_1[$key_1] = $value_1; + } + $data['metadata'] = $values_1; + foreach ($object as $key_2 => $value_2) { + if (preg_match('/.*/', (string) $key_2)) { + $data[$key_2] = $value_2; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunStepObject::class => false, + ]; + } +} diff --git a/generated/Normalizer/RunToolCallObjectFunctionNormalizer.php b/generated/Normalizer/RunToolCallObjectFunctionNormalizer.php new file mode 100644 index 0000000..dc1738e --- /dev/null +++ b/generated/Normalizer/RunToolCallObjectFunctionNormalizer.php @@ -0,0 +1,89 @@ +setName($data['name']); + unset($data['name']); + } + if (\array_key_exists('arguments', $data)) { + $object->setArguments($data['arguments']); + unset($data['arguments']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['name'] = $object->getName(); + $data['arguments'] = $object->getArguments(); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunToolCallObjectFunction::class => false, + ]; + } +} diff --git a/generated/Normalizer/RunToolCallObjectNormalizer.php b/generated/Normalizer/RunToolCallObjectNormalizer.php new file mode 100644 index 0000000..f3d6d0a --- /dev/null +++ b/generated/Normalizer/RunToolCallObjectNormalizer.php @@ -0,0 +1,95 @@ +setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } + if (\array_key_exists('function', $data)) { + $object->setFunction($this->denormalizer->denormalize($data['function'], RunToolCallObjectFunction::class, 'json', $context)); + unset($data['function']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['id'] = $object->getId(); + $data['type'] = $object->getType(); + $data['function'] = $this->normalizer->normalize($object->getFunction(), 'json', $context); + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + RunToolCallObject::class => false, + ]; + } +} diff --git a/generated/Normalizer/SubmitToolOutputsRunRequestNormalizer.php b/generated/Normalizer/SubmitToolOutputsRunRequestNormalizer.php new file mode 100644 index 0000000..6032551 --- /dev/null +++ b/generated/Normalizer/SubmitToolOutputsRunRequestNormalizer.php @@ -0,0 +1,82 @@ +denormalizer->denormalize($value, SubmitToolOutputsRunRequestToolOutputsItem::class, 'json', $context); + } + $object->setToolOutputs($values); + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $values = []; + foreach ($object->getToolOutputs() as $value) { + $values[] = $this->normalizer->normalize($value, 'json', $context); + } + $data['tool_outputs'] = $values; + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + SubmitToolOutputsRunRequest::class => false, + ]; + } +} diff --git a/generated/Normalizer/SubmitToolOutputsRunRequestToolOutputsItemNormalizer.php b/generated/Normalizer/SubmitToolOutputsRunRequestToolOutputsItemNormalizer.php new file mode 100644 index 0000000..806bcb2 --- /dev/null +++ b/generated/Normalizer/SubmitToolOutputsRunRequestToolOutputsItemNormalizer.php @@ -0,0 +1,93 @@ +setToolCallId($data['tool_call_id']); + unset($data['tool_call_id']); + } + if (\array_key_exists('output', $data)) { + $object->setOutput($data['output']); + unset($data['output']); + } + foreach ($data as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $object[$key] = $value; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + if ($object->isInitialized('toolCallId') && $object->getToolCallId() !== null) { + $data['tool_call_id'] = $object->getToolCallId(); + } + if ($object->isInitialized('output') && $object->getOutput() !== null) { + $data['output'] = $object->getOutput(); + } + foreach ($object as $key => $value) { + if (preg_match('/.*/', (string) $key)) { + $data[$key] = $value; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + SubmitToolOutputsRunRequestToolOutputsItem::class => false, + ]; + } +} diff --git a/generated/Normalizer/ThreadObjectNormalizer.php b/generated/Normalizer/ThreadObjectNormalizer.php new file mode 100644 index 0000000..c9eb6d0 --- /dev/null +++ b/generated/Normalizer/ThreadObjectNormalizer.php @@ -0,0 +1,109 @@ +setId($data['id']); + unset($data['id']); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } + if (\array_key_exists('created_at', $data)) { + $object->setCreatedAt($data['created_at']); + unset($data['created_at']); + } + if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { + $values = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['metadata'] as $key => $value) { + $values[$key] = $value; + } + $object->setMetadata($values); + unset($data['metadata']); + } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { + $object->setMetadata(null); + } + foreach ($data as $key_1 => $value_1) { + if (preg_match('/.*/', (string) $key_1)) { + $object[$key_1] = $value_1; + } + } + return $object; + } + + /** + * @return array|string|int|float|bool|ArrayObject|null + */ + public function normalize($object, $format = null, array $context = []) + { + $data = []; + $data['id'] = $object->getId(); + $data['object'] = $object->getObject(); + $data['created_at'] = $object->getCreatedAt(); + $values = []; + foreach ($object->getMetadata() as $key => $value) { + $values[$key] = $value; + } + $data['metadata'] = $values; + foreach ($object as $key_1 => $value_1) { + if (preg_match('/.*/', (string) $key_1)) { + $data[$key_1] = $value_1; + } + } + return $data; + } + + public function getSupportedTypes(?string $format = null): array + { + return [ + ThreadObject::class => false, + ]; + } +} diff --git a/generated/Runtime/Normalizer/ValidationException.php b/generated/Runtime/Normalizer/ValidationException.php index 2918f74..fc8d4b2 100644 --- a/generated/Runtime/Normalizer/ValidationException.php +++ b/generated/Runtime/Normalizer/ValidationException.php @@ -12,7 +12,7 @@ class ValidationException extends RuntimeException public function __construct( private ConstraintViolationListInterface $violationList ) { - parent::__construct(sprintf('Model validation failed with %d errors.', $violationList->count()), 400); + parent::__construct(sprintf('Model validation failed with %d errors.', $this->violationList->count()), 400); } public function getViolationList(): ConstraintViolationListInterface From 06a69a01dc272e64c025b33bde385496ffc3b9bb Mon Sep 17 00:00:00 2001 From: Adrien Brault Date: Tue, 9 Jan 2024 16:05:42 +0100 Subject: [PATCH 4/8] feat: update generated --- Makefile | 2 +- build/ModelWithConstructorGenerator.php | 117 +++++++- composer.json | 8 +- example-chat.php | 12 +- generated/Model/AssistantFileObject.php | 12 +- generated/Model/AssistantObject.php | 28 +- generated/Model/AssistantToolsCode.php | 2 +- generated/Model/AssistantToolsFunction.php | 12 +- generated/Model/AssistantToolsRetrieval.php | 2 +- .../Model/ChatCompletionMessageToolCall.php | 12 +- .../ChatCompletionMessageToolCallChunk.php | 12 +- .../Model/ChatCompletionNamedToolChoice.php | 12 +- .../ChatCompletionRequestAssistantMessage.php | 12 +- .../ChatCompletionRequestFunctionMessage.php | 12 +- ...mpletionRequestMessageContentPartImage.php | 12 +- ...ompletionRequestMessageContentPartText.php | 12 +- .../ChatCompletionRequestSystemMessage.php | 12 +- .../ChatCompletionRequestToolMessage.php | 12 +- .../ChatCompletionRequestUserMessage.php | 22 +- .../Model/ChatCompletionResponseMessage.php | 12 +- generated/Model/ChatCompletionTool.php | 12 +- generated/Model/CreateAssistantRequest.php | 30 +- .../CreateChatCompletionFunctionResponse.php | 12 +- .../Model/CreateChatCompletionRequest.php | 133 +++++---- .../Model/CreateChatCompletionResponse.php | 32 +- .../CreateChatCompletionStreamResponse.php | 2 +- generated/Model/CreateCompletionRequest.php | 89 +++--- generated/Model/CreateCompletionResponse.php | 12 +- generated/Model/CreateEditRequest.php | 12 +- generated/Model/CreateEditResponse.php | 12 +- generated/Model/CreateEmbeddingRequest.php | 30 +- generated/Model/CreateEmbeddingResponse.php | 12 +- generated/Model/CreateFineTuneRequest.php | 66 ++--- .../CreateFineTuneRequestHyperparameters.php | 16 +- .../Model/CreateFineTuningJobRequest.php | 15 +- ...ateFineTuningJobRequestHyperparameters.php | 44 +-- generated/Model/CreateImageEditRequest.php | 20 +- generated/Model/CreateImageRequest.php | 20 +- .../Model/CreateImageVariationRequest.php | 20 +- generated/Model/CreateMessageRequest.php | 20 +- generated/Model/CreateModerationRequest.php | 26 +- generated/Model/CreateRunRequest.php | 10 +- generated/Model/CreateSpeechRequest.php | 12 +- generated/Model/CreateThreadAndRunRequest.php | 10 +- .../Model/CreateTranscriptionRequest.php | 12 +- generated/Model/CreateTranslationRequest.php | 12 +- .../Model/DeleteAssistantFileResponse.php | 2 +- generated/Model/DeleteAssistantResponse.php | 2 +- generated/Model/DeleteFileResponse.php | 12 +- generated/Model/DeleteMessageResponse.php | 2 +- generated/Model/DeleteThreadResponse.php | 2 +- generated/Model/Embedding.php | 2 +- generated/Model/FineTune.php | 12 +- generated/Model/FineTuneEvent.php | 2 +- generated/Model/FineTuningJob.php | 12 +- generated/Model/FineTuningJobEvent.php | 2 +- .../Model/FineTuningJobHyperparameters.php | 16 +- generated/Model/ListFilesResponse.php | 2 +- .../Model/ListFineTuneEventsResponse.php | 2 +- generated/Model/ListFineTunesResponse.php | 2 +- .../Model/ListFineTuningJobEventsResponse.php | 2 +- generated/Model/ListModelsResponse.php | 12 +- .../ListPaginatedFineTuningJobsResponse.php | 2 +- .../Model/MessageContentImageFileObject.php | 12 +- ...ntentTextAnnotationsFileCitationObject.php | 12 +- ...geContentTextAnnotationsFilePathObject.php | 12 +- generated/Model/MessageContentTextObject.php | 12 +- .../Model/MessageContentTextObjectText.php | 8 +- generated/Model/MessageFileObject.php | 12 +- generated/Model/MessageObject.php | 28 +- generated/Model/Model.php | 12 +- generated/Model/ModifyAssistantRequest.php | 30 +- generated/Model/OpenAIFile.php | 12 +- generated/Model/RunObject.php | 28 +- generated/Model/RunObjectRequiredAction.php | 12 +- .../RunStepDetailsMessageCreationObject.php | 12 +- .../RunStepDetailsToolCallsCodeObject.php | 12 +- ...pDetailsToolCallsCodeOutputImageObject.php | 12 +- ...epDetailsToolCallsCodeOutputLogsObject.php | 12 +- .../RunStepDetailsToolCallsFunctionObject.php | 12 +- .../Model/RunStepDetailsToolCallsObject.php | 12 +- ...RunStepDetailsToolCallsRetrievalObject.php | 12 +- generated/Model/RunStepObject.php | 12 +- generated/Model/RunToolCallObject.php | 12 +- generated/Model/ThreadObject.php | 12 +- .../AssistantFileObjectNormalizer.php | 10 +- .../Normalizer/AssistantObjectNormalizer.php | 91 +++--- .../AssistantToolsFunctionNormalizer.php | 10 +- ...mpletionMessageToolCallChunkNormalizer.php | 14 +- ...hatCompletionMessageToolCallNormalizer.php | 10 +- ...hatCompletionNamedToolChoiceNormalizer.php | 10 +- ...etionRequestAssistantMessageNormalizer.php | 10 +- ...letionRequestFunctionMessageNormalizer.php | 10 +- ...questMessageContentPartImageNormalizer.php | 10 +- ...equestMessageContentPartTextNormalizer.php | 10 +- ...mpletionRequestSystemMessageNormalizer.php | 10 +- ...CompletionRequestToolMessageNormalizer.php | 10 +- ...CompletionRequestUserMessageNormalizer.php | 56 +++- ...hatCompletionResponseMessageNormalizer.php | 10 +- .../ChatCompletionToolNormalizer.php | 10 +- .../CreateAssistantRequestNormalizer.php | 87 ++++-- ...atCompletionFunctionResponseNormalizer.php | 10 +- .../CreateChatCompletionRequestNormalizer.php | 279 ++++++++++++------ ...CreateChatCompletionResponseNormalizer.php | 16 +- .../CreateCompletionRequestNormalizer.php | 220 +++++++++----- .../CreateCompletionResponseNormalizer.php | 10 +- .../CreateEditRequestNormalizer.php | 24 +- .../CreateEditResponseNormalizer.php | 10 +- .../CreateEmbeddingRequestNormalizer.php | 82 ++++- .../CreateEmbeddingResponseNormalizer.php | 10 +- ...neTuneRequestHyperparametersNormalizer.php | 24 +- .../CreateFineTuneRequestNormalizer.php | 74 +++-- ...ingJobRequestHyperparametersNormalizer.php | 56 +++- .../CreateFineTuningJobRequestNormalizer.php | 24 +- .../CreateImageEditRequestNormalizer.php | 38 ++- .../CreateImageRequestNormalizer.php | 38 ++- .../CreateImageVariationRequestNormalizer.php | 38 ++- .../CreateMessageRequestNormalizer.php | 46 +-- .../CreateModerationRequestNormalizer.php | 48 ++- .../Normalizer/CreateRunRequestNormalizer.php | 31 +- .../CreateSpeechRequestNormalizer.php | 16 +- .../CreateThreadAndRunRequestNormalizer.php | 31 +- .../CreateTranscriptionRequestNormalizer.php | 16 +- .../CreateTranslationRequestNormalizer.php | 16 +- .../DeleteFileResponseNormalizer.php | 10 +- generated/Normalizer/FineTuneNormalizer.php | 10 +- ...FineTuningJobHyperparametersNormalizer.php | 24 +- .../Normalizer/FineTuningJobNormalizer.php | 10 +- .../ListModelsResponseNormalizer.php | 10 +- ...essageContentImageFileObjectNormalizer.php | 10 +- ...nnotationsFileCitationObjectNormalizer.php | 10 +- ...extAnnotationsFilePathObjectNormalizer.php | 10 +- .../MessageContentTextObjectNormalizer.php | 10 +- ...MessageContentTextObjectTextNormalizer.php | 26 +- .../MessageFileObjectNormalizer.php | 10 +- .../Normalizer/MessageObjectNormalizer.php | 70 +++-- generated/Normalizer/ModelNormalizer.php | 10 +- .../ModifyAssistantRequestNormalizer.php | 87 ++++-- generated/Normalizer/OpenAIFileNormalizer.php | 10 +- generated/Normalizer/RunObjectNormalizer.php | 91 +++--- .../RunObjectRequiredActionNormalizer.php | 10 +- ...DetailsMessageCreationObjectNormalizer.php | 10 +- ...epDetailsToolCallsCodeObjectNormalizer.php | 10 +- ...olCallsCodeOutputImageObjectNormalizer.php | 10 +- ...oolCallsCodeOutputLogsObjectNormalizer.php | 10 +- ...tailsToolCallsFunctionObjectNormalizer.php | 10 +- ...unStepDetailsToolCallsObjectNormalizer.php | 10 +- ...ailsToolCallsRetrievalObjectNormalizer.php | 10 +- .../Normalizer/RunStepObjectNormalizer.php | 10 +- .../RunToolCallObjectNormalizer.php | 10 +- .../Normalizer/ThreadObjectNormalizer.php | 10 +- 151 files changed, 2117 insertions(+), 1352 deletions(-) diff --git a/Makefile b/Makefile index f083551..e68d7f7 100644 --- a/Makefile +++ b/Makefile @@ -36,4 +36,4 @@ pre-commit: .PHONY: build build: - time (time bin/jane generate ; for in in {1..4} ; do time (vendor/bin/rector process ; vendor/bin/ecs --fix); done) + time (time bin/jane generate ; for in in {1..2} ; do time (vendor/bin/rector process --no-diffs ; vendor/bin/ecs --fix > /dev/null); done) diff --git a/build/ModelWithConstructorGenerator.php b/build/ModelWithConstructorGenerator.php index 7e5d317..33dcc12 100644 --- a/build/ModelWithConstructorGenerator.php +++ b/build/ModelWithConstructorGenerator.php @@ -4,8 +4,10 @@ namespace Sourceability\OpenAIClient\Build; +use Jane\Component\JsonSchema\Generator\Context\Context; use Jane\Component\JsonSchema\Guesser\Guess\ClassGuess as BaseClassGuess; use Jane\Component\JsonSchema\Guesser\Guess\Property; +use Jane\Component\OpenApi3\JsonSchema\Model\Schema; use Jane\Component\OpenApiCommon\Generator\ModelGenerator; use PhpParser\Comment\Doc; use PhpParser\Node\Arg; @@ -23,6 +25,27 @@ class ModelWithConstructorGenerator extends ModelGenerator { + public function generate(\Jane\Component\JsonSchema\Registry\Schema $schema, string $className, Context $context): void + { + foreach ($schema->getClasses() as $class) { + if ($class->getName() === 'CreateChatCompletionResponse') { + // allow null + $class->getProperty('system_fingerprint')->getType()->getObject()->setNullable(true); + // dd($class->getProperty('system_fingerprint')->getType()); + $class->getProperty('system_fingerprint')->getType()->getObject()->setDefault(null); + $properties = $class->getLocalProperties(); + foreach ($properties as $index => $property) { + if ($property->getName() === 'system_fingerprint') { + $properties[$index] = $this->getPropertyWithNullable($property, true); + } + } + $class->setProperties($properties); + } + } + + parent::generate($schema, $className, $context); + } + /** * @param array $properties */ @@ -36,8 +59,42 @@ protected function doCreateModel(BaseClassGuess $class, array $properties, array $property->props[0]->default = new Name('null'); } + // Move properties with a default value to the end of the list + // That way objects with discriminator like properties will have the discriminator property last + // To avoid having to use named arguments + $localProperties = $class->getLocalProperties(); + usort( + $localProperties, + function (Property $a, Property $b): int { + if ($a->getType()->getObject()->getDefault() === null && $b->getType()->getObject()->getDefault() !== null) { + return -1; + } + + if ($a->getType()->getObject()->getDefault() !== null && $b->getType()->getObject()->getDefault() === null) { + return 1; + } + + return 0; + } + ); + + // Remove logprobs default value which causes issues with vision api calls + if ($class->getName() === 'CreateChatCompletionRequest') { + foreach ($properties as $property) { + if ($property->props[0]->name->toString() === 'logprobs') { + $property->props[0]->default = new Name('null'); + } + } + foreach ($localProperties as &$localProperty) { + if ($localProperty->getName() === 'logprobs') { + $localProperty = $this->getPropertyWithDefault($localProperty, null); + } + } + } + $class->setProperties($localProperties); + $methods = [ - $this->createConstructorMethod($class->getLocalProperties()), + $this->createConstructorMethod($localProperties), ...$methods, ]; @@ -83,6 +140,64 @@ protected function createConstructorArgumentDoc(Property $property): string return $docBlock; } + protected function createProperty(Property $property, string $namespace, $default = null, bool $strict = true): Stmt + { + if ($property->getType()->getName() === 'string' + && $property->getType()->getObject() instanceof Schema + && count($property->getType()->getObject()->getEnum() ?? []) === 1 + && $property->getType()->getObject()->getDefault() === null + ) { + // Useful for completion message role properties which are defined as enums with a single value + $newDefault = $property->getType()->getObject()->getEnum()[0]; + + $property = $this->getPropertyWithDefault($property, $newDefault); + } + + return parent::createProperty($property, $namespace, $default, $strict); + } + + private function getPropertyWithDefault(Property $property, $newDefault): Property + { + $property->getType()->getObject()->setDefault($newDefault); + $newProperty = new Property( + $property->getObject(), + $property->getName(), + $property->getReference(), + $property->isNullable(), + $property->isRequired(), + $property->getType(), + $property->getDescription(), + $newDefault, + $property->isReadOnly() + ); + $newProperty->setPhpName($property->getName()); + $newProperty->setAccessorName($property->getAccessorName()); + $newProperty->setDeprecated($property->isDeprecated()); + + return $newProperty; + } + + private function getPropertyWithNullable(Property $property, bool $newNullable): Property + { + $property->getType()->getObject()->setNullable($newNullable); + $newProperty = new Property( + $property->getObject(), + $property->getName(), + $property->getReference(), + $newNullable, + $property->isRequired(), + $property->getType(), + $property->getDescription(), + $property->getDefault(), + $property->isReadOnly() + ); + $newProperty->setPhpName($property->getName()); + $newProperty->setAccessorName($property->getAccessorName()); + $newProperty->setDeprecated($property->isDeprecated()); + + return $newProperty; + } + /** * @param array $properties */ diff --git a/composer.json b/composer.json index 294d6d8..7c87056 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ "guzzlehttp/psr7": "^2.4", "guzzlehttp/guzzle": "^7.5", "php-http/guzzle7-adapter": "^1.0", - "jane-php/open-api-3": "^7.5", + "jane-php/open-api-3": "dev-openapi-oneof as 7.5.x-dev", "rector/rector": "^0.19.0", "symplify/easy-coding-standard": "^12.1", "slevomat/coding-standard": "^8.14", @@ -41,6 +41,12 @@ "dealerdirect/phpcodesniffer-composer-installer": false } }, + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/adrienbrault/open-api-3" + } + ], "extra": { "symfony": { "allow-contrib": "true" diff --git a/example-chat.php b/example-chat.php index acc0870..0123002 100644 --- a/example-chat.php +++ b/example-chat.php @@ -5,7 +5,7 @@ use Http\Client\Common\Plugin\LoggerPlugin; use Http\Message\Formatter\FullHttpMessageFormatter; use Sourceability\OpenAIClient\Client; -use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestMessage; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestUserMessage; use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionRequest; use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionResponse; use Symfony\Component\Console\Logger\ConsoleLogger; @@ -26,20 +26,14 @@ model: 'gpt-3.5-turbo', temperature: 0, messages: [ - new ChatCompletionRequestMessage( - role: 'user', - content: 'The jane php library is very useful because' - ) + new ChatCompletionRequestUserMessage('The jane php library is very useful because') ], ), new CreateChatCompletionRequest( model: 'gpt-3.5-turbo', temperature: 0, messages: [ - new ChatCompletionRequestMessage( - role: 'user', - content: 'Symfony symfony symfony is like sourceability on a' - ) + new ChatCompletionRequestUserMessage('Symfony symfony symfony is like sourceability on a') ], ), ]; diff --git a/generated/Model/AssistantFileObject.php b/generated/Model/AssistantFileObject.php index bafc93f..bdc9648 100644 --- a/generated/Model/AssistantFileObject.php +++ b/generated/Model/AssistantFileObject.php @@ -18,7 +18,7 @@ class AssistantFileObject extends ArrayObject /** * The object type, which is always `assistant.file`. */ - protected ?string $object = null; + protected string $object = 'assistant.file'; /** * The Unix timestamp (in seconds) for when the assistant file was created. @@ -32,24 +32,24 @@ class AssistantFileObject extends ArrayObject /** * @param string $id The identifier, which can be referenced in API endpoints. - * @param string $object The object type, which is always `assistant.file`. * @param int $createdAt The Unix timestamp (in seconds) for when the assistant file was created. * @param string $assistantId The assistant ID that the file is attached to. + * @param string $object The object type, which is always `assistant.file`. */ - public function __construct($id = null, $object = null, $createdAt = null, $assistantId = null) + public function __construct($id = null, $createdAt = null, $assistantId = null, $object = null) { if ($id !== null) { $this->setId($id); } - if ($object !== null) { - $this->setObject($object); - } if ($createdAt !== null) { $this->setCreatedAt($createdAt); } if ($assistantId !== null) { $this->setAssistantId($assistantId); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool diff --git a/generated/Model/AssistantObject.php b/generated/Model/AssistantObject.php index 8b43bb2..1e7b7c2 100644 --- a/generated/Model/AssistantObject.php +++ b/generated/Model/AssistantObject.php @@ -18,7 +18,7 @@ class AssistantObject extends ArrayObject /** * The object type, which is always `assistant`. */ - protected ?string $object = null; + protected string $object = 'assistant'; /** * The Unix timestamp (in seconds) for when the assistant was created. @@ -48,7 +48,7 @@ class AssistantObject extends ArrayObject /** * A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. * - * @var mixed[] + * @var AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[] */ protected array $tools = []; @@ -68,24 +68,21 @@ class AssistantObject extends ArrayObject /** * @param string $id The identifier, which can be referenced in API endpoints. - * @param string $object The object type, which is always `assistant`. * @param int $createdAt The Unix timestamp (in seconds) for when the assistant was created. * @param string|null $name The name of the assistant. The maximum length is 256 characters. * @param string|null $description The description of the assistant. The maximum length is 512 characters. * @param string $model ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. * @param string|null $instructions The system instructions that the assistant uses. The maximum length is 32768 characters. - * @param mixed[] $tools A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. - * @param string[] $fileIds A list of [file](/docs/api-reference/files) IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * @param string $object The object type, which is always `assistant`. + * @param AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[] $tools A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. + * @param string[] $fileIds A list of [file](/docs/api-reference/files) IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. */ - public function __construct($id = null, $object = null, $createdAt = null, $name = null, $description = null, $model = null, $instructions = null, $tools = [], $fileIds = [], $metadata = null) + public function __construct($id = null, $createdAt = null, $name = null, $description = null, $model = null, $instructions = null, $metadata = null, $object = null, $tools = [], $fileIds = []) { if ($id !== null) { $this->setId($id); } - if ($object !== null) { - $this->setObject($object); - } if ($createdAt !== null) { $this->setCreatedAt($createdAt); } @@ -101,15 +98,18 @@ public function __construct($id = null, $object = null, $createdAt = null, $name if ($instructions !== null) { $this->setInstructions($instructions); } + if ($metadata !== null) { + $this->setMetadata($metadata); + } + if ($object !== null) { + $this->setObject($object); + } if ($tools !== null) { $this->setTools($tools); } if ($fileIds !== null) { $this->setFileIds($fileIds); } - if ($metadata !== null) { - $this->setMetadata($metadata); - } } public function isInitialized($property): bool @@ -246,7 +246,7 @@ public function setInstructions(?string $instructions): self /** * A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. * - * @return mixed[] + * @return AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[] */ public function getTools(): array { @@ -256,7 +256,7 @@ public function getTools(): array /** * A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. * - * @param mixed[] $tools + * @param AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[] $tools */ public function setTools(array $tools): self { diff --git a/generated/Model/AssistantToolsCode.php b/generated/Model/AssistantToolsCode.php index af22e24..681f2c9 100644 --- a/generated/Model/AssistantToolsCode.php +++ b/generated/Model/AssistantToolsCode.php @@ -13,7 +13,7 @@ class AssistantToolsCode extends ArrayObject /** * The type of tool being defined: `code_interpreter` */ - protected ?string $type = null; + protected string $type = 'code_interpreter'; /** * @param string $type The type of tool being defined: `code_interpreter` diff --git a/generated/Model/AssistantToolsFunction.php b/generated/Model/AssistantToolsFunction.php index ca98d3e..7a62037 100644 --- a/generated/Model/AssistantToolsFunction.php +++ b/generated/Model/AssistantToolsFunction.php @@ -13,22 +13,22 @@ class AssistantToolsFunction extends ArrayObject /** * The type of tool being defined: `function` */ - protected ?string $type = null; + protected string $type = 'function'; protected ?FunctionObject $function = null; /** - * @param string $type The type of tool being defined: `function` * @param FunctionObject $function + * @param string $type The type of tool being defined: `function` */ - public function __construct($type = null, $function = null) + public function __construct($function = null, $type = null) { - if ($type !== null) { - $this->setType($type); - } if ($function !== null) { $this->setFunction($function); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/AssistantToolsRetrieval.php b/generated/Model/AssistantToolsRetrieval.php index bc67643..fc8ff12 100644 --- a/generated/Model/AssistantToolsRetrieval.php +++ b/generated/Model/AssistantToolsRetrieval.php @@ -13,7 +13,7 @@ class AssistantToolsRetrieval extends ArrayObject /** * The type of tool being defined: `retrieval` */ - protected ?string $type = null; + protected string $type = 'retrieval'; /** * @param string $type The type of tool being defined: `retrieval` diff --git a/generated/Model/ChatCompletionMessageToolCall.php b/generated/Model/ChatCompletionMessageToolCall.php index e74d64f..67689ac 100644 --- a/generated/Model/ChatCompletionMessageToolCall.php +++ b/generated/Model/ChatCompletionMessageToolCall.php @@ -18,7 +18,7 @@ class ChatCompletionMessageToolCall extends ArrayObject /** * The type of the tool. Currently, only `function` is supported. */ - protected ?string $type = null; + protected string $type = 'function'; /** * The function that the model called. @@ -27,20 +27,20 @@ class ChatCompletionMessageToolCall extends ArrayObject /** * @param string $id The ID of the tool call. - * @param string $type The type of the tool. Currently, only `function` is supported. * @param ChatCompletionMessageToolCallFunction $function The function that the model called. + * @param string $type The type of the tool. Currently, only `function` is supported. */ - public function __construct($id = null, $type = null, $function = null) + public function __construct($id = null, $function = null, $type = null) { if ($id !== null) { $this->setId($id); } - if ($type !== null) { - $this->setType($type); - } if ($function !== null) { $this->setFunction($function); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/ChatCompletionMessageToolCallChunk.php b/generated/Model/ChatCompletionMessageToolCallChunk.php index 5af8a47..08964a7 100644 --- a/generated/Model/ChatCompletionMessageToolCallChunk.php +++ b/generated/Model/ChatCompletionMessageToolCallChunk.php @@ -20,17 +20,17 @@ class ChatCompletionMessageToolCallChunk extends ArrayObject /** * The type of the tool. Currently, only `function` is supported. */ - protected ?string $type = null; + protected string $type = 'function'; protected ?ChatCompletionMessageToolCallChunkFunction $function = null; /** * @param int $index * @param string $id The ID of the tool call. - * @param string $type The type of the tool. Currently, only `function` is supported. * @param ChatCompletionMessageToolCallChunkFunction $function + * @param string $type The type of the tool. Currently, only `function` is supported. */ - public function __construct($index = null, $id = null, $type = null, $function = null) + public function __construct($index = null, $id = null, $function = null, $type = null) { if ($index !== null) { $this->setIndex($index); @@ -38,12 +38,12 @@ public function __construct($index = null, $id = null, $type = null, $function = if ($id !== null) { $this->setId($id); } - if ($type !== null) { - $this->setType($type); - } if ($function !== null) { $this->setFunction($function); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/ChatCompletionNamedToolChoice.php b/generated/Model/ChatCompletionNamedToolChoice.php index ca55eb0..a0e4cdd 100644 --- a/generated/Model/ChatCompletionNamedToolChoice.php +++ b/generated/Model/ChatCompletionNamedToolChoice.php @@ -13,22 +13,22 @@ class ChatCompletionNamedToolChoice extends ArrayObject /** * The type of the tool. Currently, only `function` is supported. */ - protected ?string $type = null; + protected string $type = 'function'; protected ?ChatCompletionNamedToolChoiceFunction $function = null; /** - * @param string $type The type of the tool. Currently, only `function` is supported. * @param ChatCompletionNamedToolChoiceFunction $function + * @param string $type The type of the tool. Currently, only `function` is supported. */ - public function __construct($type = null, $function = null) + public function __construct($function = null, $type = null) { - if ($type !== null) { - $this->setType($type); - } if ($function !== null) { $this->setFunction($function); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/ChatCompletionRequestAssistantMessage.php b/generated/Model/ChatCompletionRequestAssistantMessage.php index 03e721a..aa25342 100644 --- a/generated/Model/ChatCompletionRequestAssistantMessage.php +++ b/generated/Model/ChatCompletionRequestAssistantMessage.php @@ -18,7 +18,7 @@ class ChatCompletionRequestAssistantMessage extends ArrayObject /** * The role of the messages author, in this case `assistant`. */ - protected ?string $role = null; + protected string $role = 'assistant'; /** * An optional name for the participant. Provides the model information to differentiate between participants of the same role. @@ -41,19 +41,16 @@ class ChatCompletionRequestAssistantMessage extends ArrayObject /** * @param string|null $content The contents of the assistant message. Required unless `tool_calls` or `function_call` is specified. - * @param string $role The role of the messages author, in this case `assistant`. * @param string $name An optional name for the participant. Provides the model information to differentiate between participants of the same role. * @param ChatCompletionMessageToolCall[] $toolCalls The tool calls generated by the model, such as function calls. * @param ChatCompletionRequestAssistantMessageFunctionCall $functionCall Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + * @param string $role The role of the messages author, in this case `assistant`. */ - public function __construct($content = null, $role = null, $name = null, $toolCalls = null, $functionCall = null) + public function __construct($content = null, $name = null, $toolCalls = null, $functionCall = null, $role = null) { if ($content !== null) { $this->setContent($content); } - if ($role !== null) { - $this->setRole($role); - } if ($name !== null) { $this->setName($name); } @@ -63,6 +60,9 @@ public function __construct($content = null, $role = null, $name = null, $toolCa if ($functionCall !== null) { $this->setFunctionCall($functionCall); } + if ($role !== null) { + $this->setRole($role); + } } public function isInitialized($property): bool diff --git a/generated/Model/ChatCompletionRequestFunctionMessage.php b/generated/Model/ChatCompletionRequestFunctionMessage.php index 7774b69..6e53155 100644 --- a/generated/Model/ChatCompletionRequestFunctionMessage.php +++ b/generated/Model/ChatCompletionRequestFunctionMessage.php @@ -16,7 +16,7 @@ class ChatCompletionRequestFunctionMessage extends ArrayObject /** * The role of the messages author, in this case `function`. */ - protected ?string $role = null; + protected string $role = 'function'; /** * The contents of the function message. @@ -29,21 +29,21 @@ class ChatCompletionRequestFunctionMessage extends ArrayObject protected ?string $name = null; /** - * @param string $role The role of the messages author, in this case `function`. * @param string|null $content The contents of the function message. * @param string $name The name of the function to call. + * @param string $role The role of the messages author, in this case `function`. */ - public function __construct($role = null, $content = null, $name = null) + public function __construct($content = null, $name = null, $role = null) { - if ($role !== null) { - $this->setRole($role); - } if ($content !== null) { $this->setContent($content); } if ($name !== null) { $this->setName($name); } + if ($role !== null) { + $this->setRole($role); + } } public function isInitialized($property): bool diff --git a/generated/Model/ChatCompletionRequestMessageContentPartImage.php b/generated/Model/ChatCompletionRequestMessageContentPartImage.php index 2433a0b..e0ac401 100644 --- a/generated/Model/ChatCompletionRequestMessageContentPartImage.php +++ b/generated/Model/ChatCompletionRequestMessageContentPartImage.php @@ -13,22 +13,22 @@ class ChatCompletionRequestMessageContentPartImage extends ArrayObject /** * The type of the content part. */ - protected ?string $type = null; + protected string $type = 'image_url'; protected ?ChatCompletionRequestMessageContentPartImageImageUrl $imageUrl = null; /** - * @param string $type The type of the content part. * @param ChatCompletionRequestMessageContentPartImageImageUrl $imageUrl + * @param string $type The type of the content part. */ - public function __construct($type = null, $imageUrl = null) + public function __construct($imageUrl = null, $type = null) { - if ($type !== null) { - $this->setType($type); - } if ($imageUrl !== null) { $this->setImageUrl($imageUrl); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/ChatCompletionRequestMessageContentPartText.php b/generated/Model/ChatCompletionRequestMessageContentPartText.php index a1a60ef..d84dd50 100644 --- a/generated/Model/ChatCompletionRequestMessageContentPartText.php +++ b/generated/Model/ChatCompletionRequestMessageContentPartText.php @@ -13,7 +13,7 @@ class ChatCompletionRequestMessageContentPartText extends ArrayObject /** * The type of the content part. */ - protected ?string $type = null; + protected string $type = 'text'; /** * The text content. @@ -21,17 +21,17 @@ class ChatCompletionRequestMessageContentPartText extends ArrayObject protected ?string $text = null; /** - * @param string $type The type of the content part. * @param string $text The text content. + * @param string $type The type of the content part. */ - public function __construct($type = null, $text = null) + public function __construct($text = null, $type = null) { - if ($type !== null) { - $this->setType($type); - } if ($text !== null) { $this->setText($text); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/ChatCompletionRequestSystemMessage.php b/generated/Model/ChatCompletionRequestSystemMessage.php index daaf28d..cd49398 100644 --- a/generated/Model/ChatCompletionRequestSystemMessage.php +++ b/generated/Model/ChatCompletionRequestSystemMessage.php @@ -18,7 +18,7 @@ class ChatCompletionRequestSystemMessage extends ArrayObject /** * The role of the messages author, in this case `system`. */ - protected ?string $role = null; + protected string $role = 'system'; /** * An optional name for the participant. Provides the model information to differentiate between participants of the same role. @@ -27,20 +27,20 @@ class ChatCompletionRequestSystemMessage extends ArrayObject /** * @param string $content The contents of the system message. - * @param string $role The role of the messages author, in this case `system`. * @param string $name An optional name for the participant. Provides the model information to differentiate between participants of the same role. + * @param string $role The role of the messages author, in this case `system`. */ - public function __construct($content = null, $role = null, $name = null) + public function __construct($content = null, $name = null, $role = null) { if ($content !== null) { $this->setContent($content); } - if ($role !== null) { - $this->setRole($role); - } if ($name !== null) { $this->setName($name); } + if ($role !== null) { + $this->setRole($role); + } } public function isInitialized($property): bool diff --git a/generated/Model/ChatCompletionRequestToolMessage.php b/generated/Model/ChatCompletionRequestToolMessage.php index 276d2a3..c7892f4 100644 --- a/generated/Model/ChatCompletionRequestToolMessage.php +++ b/generated/Model/ChatCompletionRequestToolMessage.php @@ -13,7 +13,7 @@ class ChatCompletionRequestToolMessage extends ArrayObject /** * The role of the messages author, in this case `tool`. */ - protected ?string $role = null; + protected string $role = 'tool'; /** * The contents of the tool message. @@ -26,21 +26,21 @@ class ChatCompletionRequestToolMessage extends ArrayObject protected ?string $toolCallId = null; /** - * @param string $role The role of the messages author, in this case `tool`. * @param string $content The contents of the tool message. * @param string $toolCallId Tool call that this message is responding to. + * @param string $role The role of the messages author, in this case `tool`. */ - public function __construct($role = null, $content = null, $toolCallId = null) + public function __construct($content = null, $toolCallId = null, $role = null) { - if ($role !== null) { - $this->setRole($role); - } if ($content !== null) { $this->setContent($content); } if ($toolCallId !== null) { $this->setToolCallId($toolCallId); } + if ($role !== null) { + $this->setRole($role); + } } public function isInitialized($property): bool diff --git a/generated/Model/ChatCompletionRequestUserMessage.php b/generated/Model/ChatCompletionRequestUserMessage.php index ce00d53..97aa31f 100644 --- a/generated/Model/ChatCompletionRequestUserMessage.php +++ b/generated/Model/ChatCompletionRequestUserMessage.php @@ -13,14 +13,14 @@ class ChatCompletionRequestUserMessage extends ArrayObject /** * The contents of the user message. * - * @var mixed + * @var string|ChatCompletionRequestMessageContentPartText[]|ChatCompletionRequestMessageContentPartImage[] */ protected $content = null; /** * The role of the messages author, in this case `user`. */ - protected ?string $role = null; + protected string $role = 'user'; /** * An optional name for the participant. Provides the model information to differentiate between participants of the same role. @@ -28,21 +28,21 @@ class ChatCompletionRequestUserMessage extends ArrayObject protected ?string $name = null; /** - * @param mixed $content The contents of the user message. - * @param string $role The role of the messages author, in this case `user`. + * @param string|ChatCompletionRequestMessageContentPartText[]|ChatCompletionRequestMessageContentPartImage[] $content The contents of the user message. * @param string $name An optional name for the participant. Provides the model information to differentiate between participants of the same role. + * @param string $role The role of the messages author, in this case `user`. */ - public function __construct(mixed $content = null, $role = null, $name = null) + public function __construct($content = null, $name = null, $role = null) { if ($content !== null) { $this->setContent($content); } - if ($role !== null) { - $this->setRole($role); - } if ($name !== null) { $this->setName($name); } + if ($role !== null) { + $this->setRole($role); + } } public function isInitialized($property): bool @@ -53,7 +53,7 @@ public function isInitialized($property): bool /** * The contents of the user message. * - * @return mixed + * @return string|ChatCompletionRequestMessageContentPartText[]|ChatCompletionRequestMessageContentPartImage[] */ public function getContent() { @@ -62,8 +62,10 @@ public function getContent() /** * The contents of the user message. + * + * @param string|ChatCompletionRequestMessageContentPartText[]|ChatCompletionRequestMessageContentPartImage[] $content */ - public function setContent(mixed $content): self + public function setContent($content): self { $this->initialized['content'] = true; $this->content = $content; diff --git a/generated/Model/ChatCompletionResponseMessage.php b/generated/Model/ChatCompletionResponseMessage.php index f84fbe7..a8a5ca2 100644 --- a/generated/Model/ChatCompletionResponseMessage.php +++ b/generated/Model/ChatCompletionResponseMessage.php @@ -25,7 +25,7 @@ class ChatCompletionResponseMessage extends ArrayObject /** * The role of the author of this message. */ - protected ?string $role = null; + protected string $role = 'assistant'; /** * Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. @@ -37,10 +37,10 @@ class ChatCompletionResponseMessage extends ArrayObject /** * @param string|null $content The contents of the message. * @param ChatCompletionMessageToolCall[] $toolCalls The tool calls generated by the model, such as function calls. - * @param string $role The role of the author of this message. * @param ChatCompletionResponseMessageFunctionCall $functionCall Deprecated and replaced by `tool_calls`. The name and arguments of a function that should be called, as generated by the model. + * @param string $role The role of the author of this message. */ - public function __construct($content = null, $toolCalls = null, $role = null, $functionCall = null) + public function __construct($content = null, $toolCalls = null, $functionCall = null, $role = null) { if ($content !== null) { $this->setContent($content); @@ -48,12 +48,12 @@ public function __construct($content = null, $toolCalls = null, $role = null, $f if ($toolCalls !== null) { $this->setToolCalls($toolCalls); } - if ($role !== null) { - $this->setRole($role); - } if ($functionCall !== null) { $this->setFunctionCall($functionCall); } + if ($role !== null) { + $this->setRole($role); + } } public function isInitialized($property): bool diff --git a/generated/Model/ChatCompletionTool.php b/generated/Model/ChatCompletionTool.php index 6ab0157..35ded88 100644 --- a/generated/Model/ChatCompletionTool.php +++ b/generated/Model/ChatCompletionTool.php @@ -13,22 +13,22 @@ class ChatCompletionTool extends ArrayObject /** * The type of the tool. Currently, only `function` is supported. */ - protected ?string $type = null; + protected string $type = 'function'; protected ?FunctionObject $function = null; /** - * @param string $type The type of the tool. Currently, only `function` is supported. * @param FunctionObject $function + * @param string $type The type of the tool. Currently, only `function` is supported. */ - public function __construct($type = null, $function = null) + public function __construct($function = null, $type = null) { - if ($type !== null) { - $this->setType($type); - } if ($function !== null) { $this->setFunction($function); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/CreateAssistantRequest.php b/generated/Model/CreateAssistantRequest.php index 7af68c6..1f3e595 100644 --- a/generated/Model/CreateAssistantRequest.php +++ b/generated/Model/CreateAssistantRequest.php @@ -10,10 +10,8 @@ class CreateAssistantRequest /** * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. - * - * @var mixed */ - protected $model = null; + protected ?string $model = null; /** * The name of the assistant. The maximum length is 256 characters. @@ -33,7 +31,7 @@ class CreateAssistantRequest /** * A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. * - * @var mixed[] + * @var AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[] */ protected array $tools = []; @@ -52,15 +50,15 @@ class CreateAssistantRequest protected $metadata = null; /** - * @param mixed $model ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + * @param string $model ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. * @param string|null $name The name of the assistant. The maximum length is 256 characters. * @param string|null $description The description of the assistant. The maximum length is 512 characters. * @param string|null $instructions The system instructions that the assistant uses. The maximum length is 32768 characters. - * @param mixed[] $tools A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. - * @param string[] $fileIds A list of [file](/docs/api-reference/files) IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * @param AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[] $tools A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. + * @param string[] $fileIds A list of [file](/docs/api-reference/files) IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. */ - public function __construct(mixed $model = null, $name = null, $description = null, $instructions = null, $tools = [], $fileIds = [], $metadata = null) + public function __construct($model = null, $name = null, $description = null, $instructions = null, $metadata = null, $tools = [], $fileIds = []) { if ($model !== null) { $this->setModel($model); @@ -74,15 +72,15 @@ public function __construct(mixed $model = null, $name = null, $description = nu if ($instructions !== null) { $this->setInstructions($instructions); } + if ($metadata !== null) { + $this->setMetadata($metadata); + } if ($tools !== null) { $this->setTools($tools); } if ($fileIds !== null) { $this->setFileIds($fileIds); } - if ($metadata !== null) { - $this->setMetadata($metadata); - } } public function isInitialized($property): bool @@ -92,10 +90,8 @@ public function isInitialized($property): bool /** * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. - * - * @return mixed */ - public function getModel() + public function getModel(): string { return $this->model; } @@ -103,7 +99,7 @@ public function getModel() /** * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. */ - public function setModel(mixed $model): self + public function setModel(string $model): self { $this->initialized['model'] = true; $this->model = $model; @@ -167,7 +163,7 @@ public function setInstructions(?string $instructions): self /** * A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. * - * @return mixed[] + * @return AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[] */ public function getTools(): array { @@ -177,7 +173,7 @@ public function getTools(): array /** * A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. * - * @param mixed[] $tools + * @param AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[] $tools */ public function setTools(array $tools): self { diff --git a/generated/Model/CreateChatCompletionFunctionResponse.php b/generated/Model/CreateChatCompletionFunctionResponse.php index 6f1020a..a6a32ef 100644 --- a/generated/Model/CreateChatCompletionFunctionResponse.php +++ b/generated/Model/CreateChatCompletionFunctionResponse.php @@ -42,7 +42,7 @@ class CreateChatCompletionFunctionResponse extends ArrayObject /** * The object type, which is always `chat.completion`. */ - protected ?string $object = null; + protected string $object = 'chat.completion'; /** * Usage statistics for the completion request. @@ -56,10 +56,10 @@ class CreateChatCompletionFunctionResponse extends ArrayObject * @param string $model The model used for the chat completion. * @param string $systemFingerprint This fingerprint represents the backend configuration that the model runs with. * Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. - * @param string $object The object type, which is always `chat.completion`. * @param CompletionUsage $usage Usage statistics for the completion request. + * @param string $object The object type, which is always `chat.completion`. */ - public function __construct($id = null, $choices = null, $created = null, $model = null, $systemFingerprint = null, $object = null, $usage = null) + public function __construct($id = null, $choices = null, $created = null, $model = null, $systemFingerprint = null, $usage = null, $object = null) { if ($id !== null) { $this->setId($id); @@ -76,12 +76,12 @@ public function __construct($id = null, $choices = null, $created = null, $model if ($systemFingerprint !== null) { $this->setSystemFingerprint($systemFingerprint); } - if ($object !== null) { - $this->setObject($object); - } if ($usage !== null) { $this->setUsage($usage); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool diff --git a/generated/Model/CreateChatCompletionRequest.php b/generated/Model/CreateChatCompletionRequest.php index 35117ae..f00ec7c 100644 --- a/generated/Model/CreateChatCompletionRequest.php +++ b/generated/Model/CreateChatCompletionRequest.php @@ -13,14 +13,14 @@ class CreateChatCompletionRequest extends ArrayObject /** * A list of messages comprising the conversation so far. [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models). * - * @var mixed[] + * @var ChatCompletionRequestSystemMessage[]|ChatCompletionRequestUserMessage[]|ChatCompletionRequestAssistantMessage[]|ChatCompletionRequestToolMessage[]|ChatCompletionRequestFunctionMessage[] */ protected ?array $messages = null; /** * ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API. * - * @var mixed + * @var string|string */ protected $model = null; @@ -43,7 +43,7 @@ class CreateChatCompletionRequest extends ArrayObject /** * Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`. This option is currently not available on the `gpt-4-vision-preview` model. */ - protected ?bool $logprobs = false; + protected ?bool $logprobs = null; /** * An integer between 0 and 5 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used. @@ -88,7 +88,7 @@ class CreateChatCompletionRequest extends ArrayObject /** * Up to 4 sequences where the API will stop generating further tokens. * - * @var mixed + * @var string|string[] */ protected $stop = null; @@ -123,7 +123,7 @@ class CreateChatCompletionRequest extends ArrayObject /** * Controls which (if any) function is called by the model. * - * @var mixed + * @var string|ChatCompletionNamedToolChoice */ protected $toolChoice = null; @@ -138,7 +138,7 @@ class CreateChatCompletionRequest extends ArrayObject * * @deprecated * - * @var mixed + * @var string|ChatCompletionFunctionCallOption */ protected $functionCall = null; @@ -153,48 +153,48 @@ class CreateChatCompletionRequest extends ArrayObject protected ?array $functions = null; /** - * @param mixed[] $messages A list of messages comprising the conversation so far. [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models). - * @param mixed $model ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API. - * @param float|null $frequencyPenalty Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. - * [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) + * @param ChatCompletionRequestSystemMessage[]|ChatCompletionRequestUserMessage[]|ChatCompletionRequestAssistantMessage[]|ChatCompletionRequestToolMessage[]|ChatCompletionRequestFunctionMessage[] $messages A list of messages comprising the conversation so far. [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models). + * @param string|string $model ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API. * @param array|null $logitBias Modify the likelihood of specified tokens appearing in the completion. * Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. - * @param bool|null $logprobs Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`. This option is currently not available on the `gpt-4-vision-preview` model. * @param int|null $topLogprobs An integer between 0 and 5 specifying the number of most likely tokens to return at each token position, each with an associated log probability. `logprobs` must be set to `true` if this parameter is used. * @param int|null $maxTokens The maximum number of [tokens](/tokenizer) that can be generated in the chat completion. * The total length of input tokens and generated tokens is limited by the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. - * @param int|null $n How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. - * @param float|null $presencePenalty Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. - * [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) * @param CreateChatCompletionRequestResponseFormat $responseFormat An object specifying the format that the model must output. Compatible with `gpt-4-1106-preview` and `gpt-3.5-turbo-1106`. * Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the message the model generates is valid JSON. * **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length. * @param int|null $seed This feature is in Beta. * If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. * Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. - * @param mixed $stop Up to 4 sequences where the API will stop generating further tokens. + * @param string|string[] $stop Up to 4 sequences where the API will stop generating further tokens. + * @param ChatCompletionTool[] $tools A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. + * @param string|ChatCompletionNamedToolChoice $toolChoice Controls which (if any) function is called by the model. + * `none` means the model will not call a function and instead generates a message. + * `auto` means the model can pick between generating a message or calling a function. + * Specifying a particular function via `{"type: "function", "function": {"name": "my_function"}}` forces the model to call that function. + * `none` is the default when no functions are present. `auto` is the default if functions are present. + * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). + * @param string|ChatCompletionFunctionCallOption $functionCall Deprecated in favor of `tool_choice`. + * Controls which (if any) function is called by the model. + * `none` means the model will not call a function and instead generates a message. + * `auto` means the model can pick between generating a message or calling a function. + * Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. + * `none` is the default when no functions are present. `auto` is the default if functions are present. + * @param ChatCompletionFunctions[] $functions Deprecated in favor of `tools`. + * A list of functions the model may generate JSON inputs for. + * @param float|null $frequencyPenalty Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. + * [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) + * @param bool|null $logprobs Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the `content` of `message`. This option is currently not available on the `gpt-4-vision-preview` model. + * @param int|null $n How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep `n` as `1` to minimize costs. + * @param float|null $presencePenalty Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. + * [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) * @param bool|null $stream If set, partial message deltas will be sent, like in ChatGPT. Tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). * @param float|null $temperature What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. * We generally recommend altering this or `top_p` but not both. * @param float|null $topP An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. * We generally recommend altering this or `temperature` but not both. - * @param ChatCompletionTool[] $tools A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for. - * @param mixed $toolChoice Controls which (if any) function is called by the model. - * `none` means the model will not call a function and instead generates a message. - * `auto` means the model can pick between generating a message or calling a function. - * Specifying a particular function via `{"type: "function", "function": {"name": "my_function"}}` forces the model to call that function. - * `none` is the default when no functions are present. `auto` is the default if functions are present. - * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). - * @param mixed $functionCall Deprecated in favor of `tool_choice`. - * Controls which (if any) function is called by the model. - * `none` means the model will not call a function and instead generates a message. - * `auto` means the model can pick between generating a message or calling a function. - * Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. - * `none` is the default when no functions are present. `auto` is the default if functions are present. - * @param ChatCompletionFunctions[] $functions Deprecated in favor of `tools`. - * A list of functions the model may generate JSON inputs for. */ - public function __construct($messages = null, mixed $model = null, $frequencyPenalty = 0, $logitBias = null, $logprobs = false, $topLogprobs = null, $maxTokens = null, $n = 1, $presencePenalty = 0, $responseFormat = null, $seed = null, mixed $stop = null, $stream = false, $temperature = 1, $topP = 1, $tools = null, mixed $toolChoice = null, $user = null, mixed $functionCall = null, $functions = null) + public function __construct($messages = null, $model = null, $logitBias = null, $topLogprobs = null, $maxTokens = null, $responseFormat = null, $seed = null, $stop = null, $tools = null, $toolChoice = null, $user = null, $functionCall = null, $functions = null, $frequencyPenalty = 0, $logprobs = null, $n = 1, $presencePenalty = 0, $stream = false, $temperature = 1, $topP = 1) { if ($messages !== null) { $this->setMessages($messages); @@ -202,27 +202,15 @@ public function __construct($messages = null, mixed $model = null, $frequencyPen if ($model !== null) { $this->setModel($model); } - if ($frequencyPenalty !== null) { - $this->setFrequencyPenalty($frequencyPenalty); - } if ($logitBias !== null) { $this->setLogitBias($logitBias); } - if ($logprobs !== null) { - $this->setLogprobs($logprobs); - } if ($topLogprobs !== null) { $this->setTopLogprobs($topLogprobs); } if ($maxTokens !== null) { $this->setMaxTokens($maxTokens); } - if ($n !== null) { - $this->setN($n); - } - if ($presencePenalty !== null) { - $this->setPresencePenalty($presencePenalty); - } if ($responseFormat !== null) { $this->setResponseFormat($responseFormat); } @@ -232,15 +220,6 @@ public function __construct($messages = null, mixed $model = null, $frequencyPen if ($stop !== null) { $this->setStop($stop); } - if ($stream !== null) { - $this->setStream($stream); - } - if ($temperature !== null) { - $this->setTemperature($temperature); - } - if ($topP !== null) { - $this->setTopP($topP); - } if ($tools !== null) { $this->setTools($tools); } @@ -256,6 +235,27 @@ public function __construct($messages = null, mixed $model = null, $frequencyPen if ($functions !== null) { $this->setFunctions($functions); } + if ($frequencyPenalty !== null) { + $this->setFrequencyPenalty($frequencyPenalty); + } + if ($logprobs !== null) { + $this->setLogprobs($logprobs); + } + if ($n !== null) { + $this->setN($n); + } + if ($presencePenalty !== null) { + $this->setPresencePenalty($presencePenalty); + } + if ($stream !== null) { + $this->setStream($stream); + } + if ($temperature !== null) { + $this->setTemperature($temperature); + } + if ($topP !== null) { + $this->setTopP($topP); + } } public function isInitialized($property): bool @@ -266,7 +266,7 @@ public function isInitialized($property): bool /** * A list of messages comprising the conversation so far. [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models). * - * @return mixed[] + * @return ChatCompletionRequestSystemMessage[]|ChatCompletionRequestUserMessage[]|ChatCompletionRequestAssistantMessage[]|ChatCompletionRequestToolMessage[]|ChatCompletionRequestFunctionMessage[] */ public function getMessages(): array { @@ -276,7 +276,7 @@ public function getMessages(): array /** * A list of messages comprising the conversation so far. [Example Python code](https://cookbook.openai.com/examples/how_to_format_inputs_to_chatgpt_models). * - * @param mixed[] $messages + * @param ChatCompletionRequestSystemMessage[]|ChatCompletionRequestUserMessage[]|ChatCompletionRequestAssistantMessage[]|ChatCompletionRequestToolMessage[]|ChatCompletionRequestFunctionMessage[] $messages */ public function setMessages(array $messages): self { @@ -288,7 +288,7 @@ public function setMessages(array $messages): self /** * ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API. * - * @return mixed + * @return string|string */ public function getModel() { @@ -297,8 +297,10 @@ public function getModel() /** * ID of the model to use. See the [model endpoint compatibility](/docs/models/model-endpoint-compatibility) table for details on which models work with the Chat API. + * + * @param string|string $model */ - public function setModel(mixed $model): self + public function setModel($model): self { $this->initialized['model'] = true; $this->model = $model; @@ -498,7 +500,7 @@ public function setSeed(?int $seed): self /** * Up to 4 sequences where the API will stop generating further tokens. * - * @return mixed + * @return string|string[] */ public function getStop() { @@ -507,8 +509,10 @@ public function getStop() /** * Up to 4 sequences where the API will stop generating further tokens. + * + * @param string|string[] $stop */ - public function setStop(mixed $stop): self + public function setStop($stop): self { $this->initialized['stop'] = true; $this->stop = $stop; @@ -602,7 +606,7 @@ public function setTools(array $tools): self /** * Controls which (if any) function is called by the model. * - * @return mixed + * @return string|ChatCompletionNamedToolChoice */ public function getToolChoice() { @@ -611,9 +615,10 @@ public function getToolChoice() /** * Controls which (if any) function is called by the model. - `none` is the default when no functions are present. `auto` is the default if functions are present. + * + * @param string|ChatCompletionNamedToolChoice $toolChoice */ - public function setToolChoice(mixed $toolChoice): self + public function setToolChoice($toolChoice): self { $this->initialized['toolChoice'] = true; $this->toolChoice = $toolChoice; @@ -644,7 +649,7 @@ public function setUser(string $user): self * * @deprecated * - * @return mixed + * @return string|ChatCompletionFunctionCallOption */ public function getFunctionCall() { @@ -654,10 +659,12 @@ public function getFunctionCall() /** * Deprecated in favor of `tool_choice`. + * + * @param string|ChatCompletionFunctionCallOption $functionCall * * @deprecated */ - public function setFunctionCall(mixed $functionCall): self + public function setFunctionCall($functionCall): self { $this->initialized['functionCall'] = true; $this->functionCall = $functionCall; diff --git a/generated/Model/CreateChatCompletionResponse.php b/generated/Model/CreateChatCompletionResponse.php index a0fc878..71222ba 100644 --- a/generated/Model/CreateChatCompletionResponse.php +++ b/generated/Model/CreateChatCompletionResponse.php @@ -37,12 +37,12 @@ class CreateChatCompletionResponse extends ArrayObject Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. */ - protected ?string $systemFingerprint = null; + protected ?string $system_fingerprint = null; /** * The object type, which is always `chat.completion`. */ - protected ?string $object = null; + protected string $object = 'chat.completion'; /** * Usage statistics for the completion request. @@ -54,12 +54,12 @@ class CreateChatCompletionResponse extends ArrayObject * @param CreateChatCompletionResponseChoicesItem[] $choices A list of chat completion choices. Can be more than one if `n` is greater than 1. * @param int $created The Unix timestamp (in seconds) of when the chat completion was created. * @param string $model The model used for the chat completion. - * @param string $systemFingerprint This fingerprint represents the backend configuration that the model runs with. - * Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. - * @param string $object The object type, which is always `chat.completion`. + * @param string|null $system_fingerprint This fingerprint represents the backend configuration that the model runs with. + * Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. * @param CompletionUsage $usage Usage statistics for the completion request. + * @param string $object The object type, which is always `chat.completion`. */ - public function __construct($id = null, $choices = null, $created = null, $model = null, $systemFingerprint = null, $object = null, $usage = null) + public function __construct($id = null, $choices = null, $created = null, $model = null, $system_fingerprint = null, $usage = null, $object = null) { if ($id !== null) { $this->setId($id); @@ -73,15 +73,15 @@ public function __construct($id = null, $choices = null, $created = null, $model if ($model !== null) { $this->setModel($model); } - if ($systemFingerprint !== null) { - $this->setSystemFingerprint($systemFingerprint); - } - if ($object !== null) { - $this->setObject($object); + if ($system_fingerprint !== null) { + $this->setSystem_fingerprint($system_fingerprint); } if ($usage !== null) { $this->setUsage($usage); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool @@ -170,9 +170,9 @@ public function setModel(string $model): self Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. */ - public function getSystemFingerprint(): string + public function getSystemFingerprint(): ?string { - return $this->systemFingerprint; + return $this->system_fingerprint; } /** @@ -180,10 +180,10 @@ public function getSystemFingerprint(): string Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. */ - public function setSystemFingerprint(string $systemFingerprint): self + public function setSystemFingerprint(?string $system_fingerprint): self { - $this->initialized['systemFingerprint'] = true; - $this->systemFingerprint = $systemFingerprint; + $this->initialized['system_fingerprint'] = true; + $this->system_fingerprint = $system_fingerprint; return $this; } diff --git a/generated/Model/CreateChatCompletionStreamResponse.php b/generated/Model/CreateChatCompletionStreamResponse.php index 4e45ff2..352029f 100644 --- a/generated/Model/CreateChatCompletionStreamResponse.php +++ b/generated/Model/CreateChatCompletionStreamResponse.php @@ -41,7 +41,7 @@ class CreateChatCompletionStreamResponse extends ArrayObject /** * The object type, which is always `chat.completion.chunk`. */ - protected ?string $object = null; + protected string $object = 'chat.completion.chunk'; /** * @param string $id A unique identifier for the chat completion. Each chunk has the same ID. diff --git a/generated/Model/CreateCompletionRequest.php b/generated/Model/CreateCompletionRequest.php index 22c3457..1cbf10b 100644 --- a/generated/Model/CreateCompletionRequest.php +++ b/generated/Model/CreateCompletionRequest.php @@ -13,7 +13,7 @@ class CreateCompletionRequest extends ArrayObject /** * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. * - * @var mixed + * @var string|string */ protected $model = null; @@ -21,7 +21,7 @@ class CreateCompletionRequest extends ArrayObject * The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays. * - * @var mixed|null + * @var string|string[]|int[]|int[][]|null */ protected string $prompt = '<|endoftext|>'; @@ -93,7 +93,7 @@ class CreateCompletionRequest extends ArrayObject /** * Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence. * - * @var mixed|null + * @var string|string[]|null */ protected $stop = null; @@ -129,42 +129,60 @@ class CreateCompletionRequest extends ArrayObject protected ?string $user = null; /** - * @param mixed $model ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. - * @param mixed|null $prompt The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays. - * Note that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document. + * @param string|string $model ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + * @param array|null $logitBias Modify the likelihood of specified tokens appearing in the completion. + * Accepts a JSON object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](/tokenizer?view=bpe) (which works for both GPT-2 and GPT-3) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. + * As an example, you can pass `{"50256": -100}` to prevent the <|endoftext|> token from being generated. + * @param int|null $logprobs Include the log probabilities on the `logprobs` most likely output tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. + * The maximum value for `logprobs` is 5. + * @param int|null $seed If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. + * Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. + * @param string|string[]|null $stop Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence. + * @param string|null $suffix The suffix that comes after a completion of inserted text. + * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). + * @param string|string[]|int[]|int[][]|null $prompt The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays. + * Note that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document. * @param int|null $bestOf Generates `best_of` completions server-side and returns the "best" (the one with the highest log probability per token). Results cannot be streamed. * When used with `n`, `best_of` controls the number of candidate completions and `n` specifies how many to return – `best_of` must be greater than `n`. * **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. * @param bool|null $echo Echo back the prompt in addition to the completion * @param float|null $frequencyPenalty Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. * [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) - * @param array|null $logitBias Modify the likelihood of specified tokens appearing in the completion. - * Accepts a JSON object that maps tokens (specified by their token ID in the GPT tokenizer) to an associated bias value from -100 to 100. You can use this [tokenizer tool](/tokenizer?view=bpe) (which works for both GPT-2 and GPT-3) to convert text to token IDs. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. - * As an example, you can pass `{"50256": -100}` to prevent the <|endoftext|> token from being generated. - * @param int|null $logprobs Include the log probabilities on the `logprobs` most likely output tokens, as well the chosen tokens. For example, if `logprobs` is 5, the API will return a list of the 5 most likely tokens. The API will always return the `logprob` of the sampled token, so there may be up to `logprobs+1` elements in the response. - * The maximum value for `logprobs` is 5. * @param int|null $maxTokens The maximum number of [tokens](/tokenizer) that can be generated in the completion. * The token count of your prompt plus `max_tokens` cannot exceed the model's context length. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. * @param int|null $n How many completions to generate for each prompt. * **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. * @param float|null $presencePenalty Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. * [See more information about frequency and presence penalties.](/docs/guides/text-generation/parameter-details) - * @param int|null $seed If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result. - * Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend. - * @param mixed|null $stop Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence. * @param bool|null $stream Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message. [Example Python code](https://cookbook.openai.com/examples/how_to_stream_completions). - * @param string|null $suffix The suffix that comes after a completion of inserted text. * @param float|null $temperature What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. * We generally recommend altering this or `top_p` but not both. * @param float|null $topP An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. * We generally recommend altering this or `temperature` but not both. - * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). */ - public function __construct(mixed $model = null, $prompt = '<|endoftext|>', $bestOf = 1, $echo = false, $frequencyPenalty = 0, $logitBias = null, $logprobs = null, $maxTokens = 16, $n = 1, $presencePenalty = 0, $seed = null, $stop = null, $stream = false, $suffix = null, $temperature = 1, $topP = 1, $user = null) + public function __construct($model = null, $logitBias = null, $logprobs = null, $seed = null, $stop = null, $suffix = null, $user = null, $prompt = '<|endoftext|>', $bestOf = 1, $echo = false, $frequencyPenalty = 0, $maxTokens = 16, $n = 1, $presencePenalty = 0, $stream = false, $temperature = 1, $topP = 1) { if ($model !== null) { $this->setModel($model); } + if ($logitBias !== null) { + $this->setLogitBias($logitBias); + } + if ($logprobs !== null) { + $this->setLogprobs($logprobs); + } + if ($seed !== null) { + $this->setSeed($seed); + } + if ($stop !== null) { + $this->setStop($stop); + } + if ($suffix !== null) { + $this->setSuffix($suffix); + } + if ($user !== null) { + $this->setUser($user); + } if ($prompt !== null) { $this->setPrompt($prompt); } @@ -177,12 +195,6 @@ public function __construct(mixed $model = null, $prompt = '<|endoftext|>', $bes if ($frequencyPenalty !== null) { $this->setFrequencyPenalty($frequencyPenalty); } - if ($logitBias !== null) { - $this->setLogitBias($logitBias); - } - if ($logprobs !== null) { - $this->setLogprobs($logprobs); - } if ($maxTokens !== null) { $this->setMaxTokens($maxTokens); } @@ -192,27 +204,15 @@ public function __construct(mixed $model = null, $prompt = '<|endoftext|>', $bes if ($presencePenalty !== null) { $this->setPresencePenalty($presencePenalty); } - if ($seed !== null) { - $this->setSeed($seed); - } - if ($stop !== null) { - $this->setStop($stop); - } if ($stream !== null) { $this->setStream($stream); } - if ($suffix !== null) { - $this->setSuffix($suffix); - } if ($temperature !== null) { $this->setTemperature($temperature); } if ($topP !== null) { $this->setTopP($topP); } - if ($user !== null) { - $this->setUser($user); - } } public function isInitialized($property): bool @@ -223,7 +223,7 @@ public function isInitialized($property): bool /** * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. * - * @return mixed + * @return string|string */ public function getModel() { @@ -232,8 +232,10 @@ public function getModel() /** * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + * + * @param string|string $model */ - public function setModel(mixed $model): self + public function setModel($model): self { $this->initialized['model'] = true; $this->model = $model; @@ -244,7 +246,7 @@ public function setModel(mixed $model): self * The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays. * - * @return mixed + * @return string|string[]|int[]|int[][]|null */ public function getPrompt(): string { @@ -254,9 +256,10 @@ public function getPrompt(): string /** * The prompt(s) to generate completions for, encoded as a string, array of strings, array of tokens, or array of token arrays. - Note that <|endoftext|> is the document separator that the model sees during training, so if a prompt is not specified the model will generate as if from the beginning of a new document. + * + * @param string|string[]|int[]|int[][]|null $prompt */ - public function setPrompt(mixed $prompt): self + public function setPrompt(string $prompt): self { $this->initialized['prompt'] = true; $this->prompt = $prompt; @@ -464,7 +467,7 @@ public function setSeed(?int $seed): self /** * Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence. * - * @return mixed + * @return string|string[]|null */ public function getStop() { @@ -473,8 +476,10 @@ public function getStop() /** * Up to 4 sequences where the API will stop generating further tokens. The returned text will not contain the stop sequence. + * + * @param string|string[]|null $stop */ - public function setStop(mixed $stop): self + public function setStop($stop): self { $this->initialized['stop'] = true; $this->stop = $stop; diff --git a/generated/Model/CreateCompletionResponse.php b/generated/Model/CreateCompletionResponse.php index 319b011..92cee12 100644 --- a/generated/Model/CreateCompletionResponse.php +++ b/generated/Model/CreateCompletionResponse.php @@ -42,7 +42,7 @@ class CreateCompletionResponse extends ArrayObject /** * The object type, which is always "text_completion" */ - protected ?string $object = null; + protected string $object = 'text_completion'; /** * Usage statistics for the completion request. @@ -56,10 +56,10 @@ class CreateCompletionResponse extends ArrayObject * @param string $model The model used for completion. * @param string $systemFingerprint This fingerprint represents the backend configuration that the model runs with. * Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism. - * @param string $object The object type, which is always "text_completion" * @param CompletionUsage $usage Usage statistics for the completion request. + * @param string $object The object type, which is always "text_completion" */ - public function __construct($id = null, $choices = null, $created = null, $model = null, $systemFingerprint = null, $object = null, $usage = null) + public function __construct($id = null, $choices = null, $created = null, $model = null, $systemFingerprint = null, $usage = null, $object = null) { if ($id !== null) { $this->setId($id); @@ -76,12 +76,12 @@ public function __construct($id = null, $choices = null, $created = null, $model if ($systemFingerprint !== null) { $this->setSystemFingerprint($systemFingerprint); } - if ($object !== null) { - $this->setObject($object); - } if ($usage !== null) { $this->setUsage($usage); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool diff --git a/generated/Model/CreateEditRequest.php b/generated/Model/CreateEditRequest.php index bcca02f..48059e6 100644 --- a/generated/Model/CreateEditRequest.php +++ b/generated/Model/CreateEditRequest.php @@ -18,7 +18,7 @@ class CreateEditRequest extends ArrayObject /** * ID of the model to use. You can use the `text-davinci-edit-001` or `code-davinci-edit-001` model with this endpoint. * - * @var mixed + * @var string|string */ protected $model = null; @@ -50,7 +50,7 @@ class CreateEditRequest extends ArrayObject /** * @param string $instruction The instruction that tells the model how to edit the prompt. - * @param mixed $model ID of the model to use. You can use the `text-davinci-edit-001` or `code-davinci-edit-001` model with this endpoint. + * @param string|string $model ID of the model to use. You can use the `text-davinci-edit-001` or `code-davinci-edit-001` model with this endpoint. * @param string|null $input The input text to use as a starting point for the edit. * @param int|null $n How many edits to generate for the input and instruction. * @param float|null $temperature What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. @@ -58,7 +58,7 @@ class CreateEditRequest extends ArrayObject * @param float|null $topP An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. * We generally recommend altering this or `temperature` but not both. */ - public function __construct($instruction = null, mixed $model = null, $input = '', $n = 1, $temperature = 1, $topP = 1) + public function __construct($instruction = null, $model = null, $input = '', $n = 1, $temperature = 1, $topP = 1) { if ($instruction !== null) { $this->setInstruction($instruction); @@ -106,7 +106,7 @@ public function setInstruction(string $instruction): self /** * ID of the model to use. You can use the `text-davinci-edit-001` or `code-davinci-edit-001` model with this endpoint. * - * @return mixed + * @return string|string */ public function getModel() { @@ -115,8 +115,10 @@ public function getModel() /** * ID of the model to use. You can use the `text-davinci-edit-001` or `code-davinci-edit-001` model with this endpoint. + * + * @param string|string $model */ - public function setModel(mixed $model): self + public function setModel($model): self { $this->initialized['model'] = true; $this->model = $model; diff --git a/generated/Model/CreateEditResponse.php b/generated/Model/CreateEditResponse.php index 4ed6715..06ddbc9 100644 --- a/generated/Model/CreateEditResponse.php +++ b/generated/Model/CreateEditResponse.php @@ -23,7 +23,7 @@ class CreateEditResponse extends ArrayObject /** * The object type, which is always `edit`. */ - protected ?string $object = null; + protected string $object = 'edit'; /** * The Unix timestamp (in seconds) of when the edit was created. @@ -37,24 +37,24 @@ class CreateEditResponse extends ArrayObject /** * @param CreateEditResponseChoicesItem[] $choices A list of edit choices. Can be more than one if `n` is greater than 1. - * @param string $object The object type, which is always `edit`. * @param int $created The Unix timestamp (in seconds) of when the edit was created. * @param CompletionUsage $usage Usage statistics for the completion request. + * @param string $object The object type, which is always `edit`. */ - public function __construct($choices = null, $object = null, $created = null, $usage = null) + public function __construct($choices = null, $created = null, $usage = null, $object = null) { if ($choices !== null) { $this->setChoices($choices); } - if ($object !== null) { - $this->setObject($object); - } if ($created !== null) { $this->setCreated($created); } if ($usage !== null) { $this->setUsage($usage); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool diff --git a/generated/Model/CreateEmbeddingRequest.php b/generated/Model/CreateEmbeddingRequest.php index 710a4c5..1f8a848 100644 --- a/generated/Model/CreateEmbeddingRequest.php +++ b/generated/Model/CreateEmbeddingRequest.php @@ -11,14 +11,14 @@ class CreateEmbeddingRequest /** * Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. * - * @var mixed + * @var string|string[]|int[]|int[][] */ protected $input = null; /** * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. * - * @var mixed + * @var string|string */ protected $model = null; @@ -33,12 +33,12 @@ class CreateEmbeddingRequest protected ?string $user = null; /** - * @param mixed $input Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. - * @param mixed $model ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. - * @param string $encodingFormat The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/). + * @param string|string[]|int[]|int[][] $input Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. + * @param string|string $model ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). + * @param string $encodingFormat The format to return the embeddings in. Can be either `float` or [`base64`](https://pypi.org/project/pybase64/). */ - public function __construct(mixed $input = null, mixed $model = null, $encodingFormat = 'float', $user = null) + public function __construct($input = null, $model = null, $user = null, $encodingFormat = 'float') { if ($input !== null) { $this->setInput($input); @@ -46,12 +46,12 @@ public function __construct(mixed $input = null, mixed $model = null, $encodingF if ($model !== null) { $this->setModel($model); } - if ($encodingFormat !== null) { - $this->setEncodingFormat($encodingFormat); - } if ($user !== null) { $this->setUser($user); } + if ($encodingFormat !== null) { + $this->setEncodingFormat($encodingFormat); + } } public function isInitialized($property): bool @@ -62,7 +62,7 @@ public function isInitialized($property): bool /** * Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. * - * @return mixed + * @return string|string[]|int[]|int[][] */ public function getInput() { @@ -71,8 +71,10 @@ public function getInput() /** * Input text to embed, encoded as a string or array of tokens. To embed multiple inputs in a single request, pass an array of strings or array of token arrays. The input must not exceed the max input tokens for the model (8192 tokens for `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048 dimensions or less. [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken) for counting tokens. + * + * @param string|string[]|int[]|int[][] $input */ - public function setInput(mixed $input): self + public function setInput($input): self { $this->initialized['input'] = true; $this->input = $input; @@ -82,7 +84,7 @@ public function setInput(mixed $input): self /** * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. * - * @return mixed + * @return string|string */ public function getModel() { @@ -91,8 +93,10 @@ public function getModel() /** * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + * + * @param string|string $model */ - public function setModel(mixed $model): self + public function setModel($model): self { $this->initialized['model'] = true; $this->model = $model; diff --git a/generated/Model/CreateEmbeddingResponse.php b/generated/Model/CreateEmbeddingResponse.php index b07ad5d..db5aa32 100644 --- a/generated/Model/CreateEmbeddingResponse.php +++ b/generated/Model/CreateEmbeddingResponse.php @@ -25,7 +25,7 @@ class CreateEmbeddingResponse extends ArrayObject /** * The object type, which is always "list". */ - protected ?string $object = null; + protected string $object = 'list'; /** * The usage information for the request. @@ -35,10 +35,10 @@ class CreateEmbeddingResponse extends ArrayObject /** * @param Embedding[] $data The list of embeddings generated by the model. * @param string $model The name of the model used to generate the embedding. - * @param string $object The object type, which is always "list". * @param CreateEmbeddingResponseUsage $usage The usage information for the request. + * @param string $object The object type, which is always "list". */ - public function __construct($data = null, $model = null, $object = null, $usage = null) + public function __construct($data = null, $model = null, $usage = null, $object = null) { if ($data !== null) { $this->setData($data); @@ -46,12 +46,12 @@ public function __construct($data = null, $model = null, $object = null, $usage if ($model !== null) { $this->setModel($model); } - if ($object !== null) { - $this->setObject($object); - } if ($usage !== null) { $this->setUsage($usage); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool diff --git a/generated/Model/CreateFineTuneRequest.php b/generated/Model/CreateFineTuneRequest.php index 3da6b50..38ab623 100644 --- a/generated/Model/CreateFineTuneRequest.php +++ b/generated/Model/CreateFineTuneRequest.php @@ -63,8 +63,7 @@ class CreateFineTuneRequest extends ArrayObject /** * The name of the base model to fine-tune. You can select one of "ada", - * - * @var mixed|null + [Models](/docs/models) documentation. */ protected string $model = 'curie'; @@ -113,13 +112,6 @@ class CreateFineTuneRequest extends ArrayObject * @param string|null $classificationPositiveClass The positive class in binary classification. * This parameter is needed to generate precision, recall, and F1 * metrics when doing binary classification. - * @param bool|null $computeClassificationMetrics If set, we calculate classification-specific metrics such as accuracy - * and F-1 score using the validation set at the end of every epoch. - * These metrics can be viewed in the [results file](/docs/guides/legacy-fine-tuning/analyzing-your-fine-tuned-model). - * In order to compute classification metrics, you must provide a - * `validation_file`. Additionally, you must - * specify `classification_n_classes` for multiclass classification or - * `classification_positive_class` for binary classification. * @param CreateFineTuneRequestHyperparameters $hyperparameters The hyperparameters used for the fine-tuning job. * @param float|null $learningRateMultiplier The learning rate multiplier to use for training. * The fine-tuning learning rate is the original learning rate used for @@ -129,17 +121,6 @@ class CreateFineTuneRequest extends ArrayObject * perform better with larger batch sizes). We recommend experimenting * with values in the range 0.02 to 0.2 to see what produces the best * results. - * @param mixed|null $model The name of the base model to fine-tune. You can select one of "ada", - * "babbage", "curie", "davinci", or a fine-tuned model created after 2022-04-21 and before 2023-08-22. - * To learn more about these models, see the - * [Models](/docs/models) documentation. - * @param float|null $promptLossWeight The weight to use for loss on the prompt tokens. This controls how - * much the model tries to learn to generate the prompt (as compared - * to the completion which always has a weight of 1.0), and can add - * a stabilizing effect to training when completions are short. - * If prompts are extremely long (relative to completions), it may make - * sense to reduce this weight so as to avoid over-prioritizing - * learning the prompt. * @param string|null $suffix A string of up to 40 characters that will be added to your fine-tuned model name. * For example, a `suffix` of "custom-model-name" would produce a model name like `ada:ft-your-org:custom-model-name-2022-02-15-04-21-04`. * @param string|null $validationFile The ID of an uploaded file that contains validation data. @@ -151,8 +132,26 @@ class CreateFineTuneRequest extends ArrayObject * example is a JSON object with the keys "prompt" and "completion". * Additionally, you must upload your file with the purpose `fine-tune`. * See the [fine-tuning guide](/docs/guides/legacy-fine-tuning/creating-training-data) for more details. + * @param bool|null $computeClassificationMetrics If set, we calculate classification-specific metrics such as accuracy + * and F-1 score using the validation set at the end of every epoch. + * These metrics can be viewed in the [results file](/docs/guides/legacy-fine-tuning/analyzing-your-fine-tuned-model). + * In order to compute classification metrics, you must provide a + * `validation_file`. Additionally, you must + * specify `classification_n_classes` for multiclass classification or + * `classification_positive_class` for binary classification. + * @param string|string|null $model The name of the base model to fine-tune. You can select one of "ada", + * "babbage", "curie", "davinci", or a fine-tuned model created after 2022-04-21 and before 2023-08-22. + * To learn more about these models, see the + * [Models](/docs/models) documentation. + * @param float|null $promptLossWeight The weight to use for loss on the prompt tokens. This controls how + * much the model tries to learn to generate the prompt (as compared + * to the completion which always has a weight of 1.0), and can add + * a stabilizing effect to training when completions are short. + * If prompts are extremely long (relative to completions), it may make + * sense to reduce this weight so as to avoid over-prioritizing + * learning the prompt. */ - public function __construct($trainingFile = null, $batchSize = null, $classificationBetas = null, $classificationNClasses = null, $classificationPositiveClass = null, $computeClassificationMetrics = false, $hyperparameters = null, $learningRateMultiplier = null, $model = 'curie', $promptLossWeight = 0.01, $suffix = null, $validationFile = null) + public function __construct($trainingFile = null, $batchSize = null, $classificationBetas = null, $classificationNClasses = null, $classificationPositiveClass = null, $hyperparameters = null, $learningRateMultiplier = null, $suffix = null, $validationFile = null, $computeClassificationMetrics = false, $model = 'curie', $promptLossWeight = 0.01) { if ($trainingFile !== null) { $this->setTrainingFile($trainingFile); @@ -169,27 +168,27 @@ public function __construct($trainingFile = null, $batchSize = null, $classifica if ($classificationPositiveClass !== null) { $this->setClassificationPositiveClass($classificationPositiveClass); } - if ($computeClassificationMetrics !== null) { - $this->setComputeClassificationMetrics($computeClassificationMetrics); - } if ($hyperparameters !== null) { $this->setHyperparameters($hyperparameters); } if ($learningRateMultiplier !== null) { $this->setLearningRateMultiplier($learningRateMultiplier); } - if ($model !== null) { - $this->setModel($model); - } - if ($promptLossWeight !== null) { - $this->setPromptLossWeight($promptLossWeight); - } if ($suffix !== null) { $this->setSuffix($suffix); } if ($validationFile !== null) { $this->setValidationFile($validationFile); } + if ($computeClassificationMetrics !== null) { + $this->setComputeClassificationMetrics($computeClassificationMetrics); + } + if ($model !== null) { + $this->setModel($model); + } + if ($promptLossWeight !== null) { + $this->setPromptLossWeight($promptLossWeight); + } } public function isInitialized($property): bool @@ -366,7 +365,7 @@ public function setLearningRateMultiplier(?float $learningRateMultiplier): self /** * The name of the base model to fine-tune. You can select one of "ada", * - * @return mixed + * @return string|string|null */ public function getModel(): string { @@ -375,9 +374,10 @@ public function getModel(): string /** * The name of the base model to fine-tune. You can select one of "ada", - [Models](/docs/models) documentation. + * + * @param string|string|null $model */ - public function setModel(mixed $model): self + public function setModel(string $model): self { $this->initialized['model'] = true; $this->model = $model; diff --git a/generated/Model/CreateFineTuneRequestHyperparameters.php b/generated/Model/CreateFineTuneRequestHyperparameters.php index 2e6bcd1..0e7a052 100644 --- a/generated/Model/CreateFineTuneRequestHyperparameters.php +++ b/generated/Model/CreateFineTuneRequestHyperparameters.php @@ -12,16 +12,15 @@ class CreateFineTuneRequestHyperparameters extends ArrayObject /** * The number of epochs to train the model for. An epoch refers to one - * - * @var mixed + full cycle through the training dataset. */ protected string $nEpochs = 'auto'; /** - * @param mixed $nEpochs The number of epochs to train the model for. An epoch refers to one - * full cycle through the training dataset. + * @param string|int $nEpochs The number of epochs to train the model for. An epoch refers to one + * full cycle through the training dataset. */ - public function __construct(mixed $nEpochs = 'auto') + public function __construct($nEpochs = 'auto') { if ($nEpochs !== null) { $this->setNEpochs($nEpochs); @@ -36,7 +35,7 @@ public function isInitialized($property): bool /** * The number of epochs to train the model for. An epoch refers to one * - * @return mixed + * @return string|int */ public function getNEpochs(): string { @@ -45,9 +44,10 @@ public function getNEpochs(): string /** * The number of epochs to train the model for. An epoch refers to one - full cycle through the training dataset. + * + * @param string|int $nEpochs */ - public function setNEpochs(mixed $nEpochs): self + public function setNEpochs(string $nEpochs): self { $this->initialized['nEpochs'] = true; $this->nEpochs = $nEpochs; diff --git a/generated/Model/CreateFineTuningJobRequest.php b/generated/Model/CreateFineTuningJobRequest.php index cc31cda..e69fb29 100644 --- a/generated/Model/CreateFineTuningJobRequest.php +++ b/generated/Model/CreateFineTuningJobRequest.php @@ -13,7 +13,7 @@ class CreateFineTuningJobRequest extends ArrayObject /** * The name of the model to fine-tune. You can select one of the * - * @var mixed + * @var string|string */ protected $model = null; @@ -44,8 +44,8 @@ class CreateFineTuningJobRequest extends ArrayObject protected ?string $validationFile = null; /** - * @param mixed $model The name of the model to fine-tune. You can select one of the - * [supported models](/docs/guides/fine-tuning/what-models-can-be-fine-tuned). + * @param string|string $model The name of the model to fine-tune. You can select one of the + * [supported models](/docs/guides/fine-tuning/what-models-can-be-fine-tuned). * @param string $trainingFile The ID of an uploaded file that contains training data. * See [upload file](/docs/api-reference/files/upload) for how to upload a file. * Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose `fine-tune`. @@ -61,7 +61,7 @@ class CreateFineTuningJobRequest extends ArrayObject * Your dataset must be formatted as a JSONL file. You must upload your file with the purpose `fine-tune`. * See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. */ - public function __construct(mixed $model = null, $trainingFile = null, $hyperparameters = null, $suffix = null, $validationFile = null) + public function __construct($model = null, $trainingFile = null, $hyperparameters = null, $suffix = null, $validationFile = null) { if ($model !== null) { $this->setModel($model); @@ -88,7 +88,7 @@ public function isInitialized($property): bool /** * The name of the model to fine-tune. You can select one of the * - * @return mixed + * @return string|string */ public function getModel() { @@ -97,9 +97,10 @@ public function getModel() /** * The name of the model to fine-tune. You can select one of the - [supported models](/docs/guides/fine-tuning/what-models-can-be-fine-tuned). + * + * @param string|string $model */ - public function setModel(mixed $model): self + public function setModel($model): self { $this->initialized['model'] = true; $this->model = $model; diff --git a/generated/Model/CreateFineTuningJobRequestHyperparameters.php b/generated/Model/CreateFineTuningJobRequestHyperparameters.php index 6aed9f8..a6ee472 100644 --- a/generated/Model/CreateFineTuningJobRequestHyperparameters.php +++ b/generated/Model/CreateFineTuningJobRequestHyperparameters.php @@ -12,34 +12,31 @@ class CreateFineTuningJobRequestHyperparameters extends ArrayObject /** * Number of examples in each batch. A larger batch size means that model parameters - * - * @var mixed + are updated less frequently, but with lower variance. */ protected string $batchSize = 'auto'; /** * Scaling factor for the learning rate. A smaller learning rate may be useful to avoid - * - * @var mixed + overfitting. */ protected string $learningRateMultiplier = 'auto'; /** * The number of epochs to train the model for. An epoch refers to one full cycle - * - * @var mixed + through the training dataset. */ protected string $nEpochs = 'auto'; /** - * @param mixed $batchSize Number of examples in each batch. A larger batch size means that model parameters - * are updated less frequently, but with lower variance. - * @param mixed $learningRateMultiplier Scaling factor for the learning rate. A smaller learning rate may be useful to avoid - * overfitting. - * @param mixed $nEpochs The number of epochs to train the model for. An epoch refers to one full cycle - * through the training dataset. + * @param string|int $batchSize Number of examples in each batch. A larger batch size means that model parameters + * are updated less frequently, but with lower variance. + * @param string|float $learningRateMultiplier Scaling factor for the learning rate. A smaller learning rate may be useful to avoid + * overfitting. + * @param string|int $nEpochs The number of epochs to train the model for. An epoch refers to one full cycle + * through the training dataset. */ - public function __construct(mixed $batchSize = 'auto', mixed $learningRateMultiplier = 'auto', mixed $nEpochs = 'auto') + public function __construct($batchSize = 'auto', $learningRateMultiplier = 'auto', $nEpochs = 'auto') { if ($batchSize !== null) { $this->setBatchSize($batchSize); @@ -60,7 +57,7 @@ public function isInitialized($property): bool /** * Number of examples in each batch. A larger batch size means that model parameters * - * @return mixed + * @return string|int */ public function getBatchSize(): string { @@ -69,9 +66,10 @@ public function getBatchSize(): string /** * Number of examples in each batch. A larger batch size means that model parameters - are updated less frequently, but with lower variance. + * + * @param string|int $batchSize */ - public function setBatchSize(mixed $batchSize): self + public function setBatchSize(string $batchSize): self { $this->initialized['batchSize'] = true; $this->batchSize = $batchSize; @@ -81,7 +79,7 @@ public function setBatchSize(mixed $batchSize): self /** * Scaling factor for the learning rate. A smaller learning rate may be useful to avoid * - * @return mixed + * @return string|float */ public function getLearningRateMultiplier(): string { @@ -90,9 +88,10 @@ public function getLearningRateMultiplier(): string /** * Scaling factor for the learning rate. A smaller learning rate may be useful to avoid - overfitting. + * + * @param string|float $learningRateMultiplier */ - public function setLearningRateMultiplier(mixed $learningRateMultiplier): self + public function setLearningRateMultiplier(string $learningRateMultiplier): self { $this->initialized['learningRateMultiplier'] = true; $this->learningRateMultiplier = $learningRateMultiplier; @@ -102,7 +101,7 @@ public function setLearningRateMultiplier(mixed $learningRateMultiplier): self /** * The number of epochs to train the model for. An epoch refers to one full cycle * - * @return mixed + * @return string|int */ public function getNEpochs(): string { @@ -111,9 +110,10 @@ public function getNEpochs(): string /** * The number of epochs to train the model for. An epoch refers to one full cycle - through the training dataset. + * + * @param string|int $nEpochs */ - public function setNEpochs(mixed $nEpochs): self + public function setNEpochs(string $nEpochs): self { $this->initialized['nEpochs'] = true; $this->nEpochs = $nEpochs; diff --git a/generated/Model/CreateImageEditRequest.php b/generated/Model/CreateImageEditRequest.php index a61a73a..5623c4c 100644 --- a/generated/Model/CreateImageEditRequest.php +++ b/generated/Model/CreateImageEditRequest.php @@ -27,8 +27,6 @@ class CreateImageEditRequest extends ArrayObject /** * The model to use for image generation. Only `dall-e-2` is supported at this time. - * - * @var mixed|null */ protected string $model = 'dall-e-2'; @@ -56,13 +54,13 @@ class CreateImageEditRequest extends ArrayObject * @param string $image The image to edit. Must be a valid PNG file, less than 4MB, and square. If mask is not provided, image must have transparency, which will be used as the mask. * @param string $prompt A text description of the desired image(s). The maximum length is 1000 characters. * @param string $mask An additional image whose fully transparent areas (e.g. where alpha is zero) indicate where `image` should be edited. Must be a valid PNG file, less than 4MB, and have the same dimensions as `image`. - * @param mixed|null $model The model to use for image generation. Only `dall-e-2` is supported at this time. + * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). + * @param string|string|null $model The model to use for image generation. Only `dall-e-2` is supported at this time. * @param int|null $n The number of images to generate. Must be between 1 and 10. * @param string|null $size The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. * @param string|null $responseFormat The format in which the generated images are returned. Must be one of `url` or `b64_json`. - * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). */ - public function __construct($image = null, $prompt = null, $mask = null, $model = 'dall-e-2', $n = 1, $size = '1024x1024', $responseFormat = 'url', $user = null) + public function __construct($image = null, $prompt = null, $mask = null, $user = null, $model = 'dall-e-2', $n = 1, $size = '1024x1024', $responseFormat = 'url') { if ($image !== null) { $this->setImage($image); @@ -73,6 +71,9 @@ public function __construct($image = null, $prompt = null, $mask = null, $model if ($mask !== null) { $this->setMask($mask); } + if ($user !== null) { + $this->setUser($user); + } if ($model !== null) { $this->setModel($model); } @@ -85,9 +86,6 @@ public function __construct($image = null, $prompt = null, $mask = null, $model if ($responseFormat !== null) { $this->setResponseFormat($responseFormat); } - if ($user !== null) { - $this->setUser($user); - } } public function isInitialized($property): bool @@ -152,7 +150,7 @@ public function setMask(string $mask): self /** * The model to use for image generation. Only `dall-e-2` is supported at this time. * - * @return mixed + * @return string|string|null */ public function getModel(): string { @@ -161,8 +159,10 @@ public function getModel(): string /** * The model to use for image generation. Only `dall-e-2` is supported at this time. + * + * @param string|string|null $model */ - public function setModel(mixed $model): self + public function setModel(string $model): self { $this->initialized['model'] = true; $this->model = $model; diff --git a/generated/Model/CreateImageRequest.php b/generated/Model/CreateImageRequest.php index c4f036e..6407299 100644 --- a/generated/Model/CreateImageRequest.php +++ b/generated/Model/CreateImageRequest.php @@ -17,8 +17,6 @@ class CreateImageRequest extends ArrayObject /** * The model to use for image generation. - * - * @var mixed|null */ protected string $model = 'dall-e-2'; @@ -54,19 +52,22 @@ class CreateImageRequest extends ArrayObject /** * @param string $prompt A text description of the desired image(s). The maximum length is 1000 characters for `dall-e-2` and 4000 characters for `dall-e-3`. - * @param mixed|null $model The model to use for image generation. + * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). + * @param string|string|null $model The model to use for image generation. * @param int|null $n The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported. * @param string $quality The quality of the image that will be generated. `hd` creates images with finer details and greater consistency across the image. This param is only supported for `dall-e-3`. * @param string|null $responseFormat The format in which the generated images are returned. Must be one of `url` or `b64_json`. * @param string|null $size The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024` for `dall-e-2`. Must be one of `1024x1024`, `1792x1024`, or `1024x1792` for `dall-e-3` models. * @param string|null $style The style of the generated images. Must be one of `vivid` or `natural`. Vivid causes the model to lean towards generating hyper-real and dramatic images. Natural causes the model to produce more natural, less hyper-real looking images. This param is only supported for `dall-e-3`. - * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). */ - public function __construct($prompt = null, $model = 'dall-e-2', $n = 1, $quality = 'standard', $responseFormat = 'url', $size = '1024x1024', $style = 'vivid', $user = null) + public function __construct($prompt = null, $user = null, $model = 'dall-e-2', $n = 1, $quality = 'standard', $responseFormat = 'url', $size = '1024x1024', $style = 'vivid') { if ($prompt !== null) { $this->setPrompt($prompt); } + if ($user !== null) { + $this->setUser($user); + } if ($model !== null) { $this->setModel($model); } @@ -85,9 +86,6 @@ public function __construct($prompt = null, $model = 'dall-e-2', $n = 1, $qualit if ($style !== null) { $this->setStyle($style); } - if ($user !== null) { - $this->setUser($user); - } } public function isInitialized($property): bool @@ -116,7 +114,7 @@ public function setPrompt(string $prompt): self /** * The model to use for image generation. * - * @return mixed + * @return string|string|null */ public function getModel(): string { @@ -125,8 +123,10 @@ public function getModel(): string /** * The model to use for image generation. + * + * @param string|string|null $model */ - public function setModel(mixed $model): self + public function setModel(string $model): self { $this->initialized['model'] = true; $this->model = $model; diff --git a/generated/Model/CreateImageVariationRequest.php b/generated/Model/CreateImageVariationRequest.php index 46f2329..d6c10c6 100644 --- a/generated/Model/CreateImageVariationRequest.php +++ b/generated/Model/CreateImageVariationRequest.php @@ -17,8 +17,6 @@ class CreateImageVariationRequest extends ArrayObject /** * The model to use for image generation. Only `dall-e-2` is supported at this time. - * - * @var mixed|null */ protected string $model = 'dall-e-2'; @@ -44,17 +42,20 @@ class CreateImageVariationRequest extends ArrayObject /** * @param string $image The image to use as the basis for the variation(s). Must be a valid PNG file, less than 4MB, and square. - * @param mixed|null $model The model to use for image generation. Only `dall-e-2` is supported at this time. + * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). + * @param string|string|null $model The model to use for image generation. Only `dall-e-2` is supported at this time. * @param int|null $n The number of images to generate. Must be between 1 and 10. For `dall-e-3`, only `n=1` is supported. * @param string|null $responseFormat The format in which the generated images are returned. Must be one of `url` or `b64_json`. * @param string|null $size The size of the generated images. Must be one of `256x256`, `512x512`, or `1024x1024`. - * @param string $user A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices/end-user-ids). */ - public function __construct($image = null, $model = 'dall-e-2', $n = 1, $responseFormat = 'url', $size = '1024x1024', $user = null) + public function __construct($image = null, $user = null, $model = 'dall-e-2', $n = 1, $responseFormat = 'url', $size = '1024x1024') { if ($image !== null) { $this->setImage($image); } + if ($user !== null) { + $this->setUser($user); + } if ($model !== null) { $this->setModel($model); } @@ -67,9 +68,6 @@ public function __construct($image = null, $model = 'dall-e-2', $n = 1, $respons if ($size !== null) { $this->setSize($size); } - if ($user !== null) { - $this->setUser($user); - } } public function isInitialized($property): bool @@ -98,7 +96,7 @@ public function setImage(string $image): self /** * The model to use for image generation. Only `dall-e-2` is supported at this time. * - * @return mixed + * @return string|string|null */ public function getModel(): string { @@ -107,8 +105,10 @@ public function getModel(): string /** * The model to use for image generation. Only `dall-e-2` is supported at this time. + * + * @param string|string|null $model */ - public function setModel(mixed $model): self + public function setModel(string $model): self { $this->initialized['model'] = true; $this->model = $model; diff --git a/generated/Model/CreateMessageRequest.php b/generated/Model/CreateMessageRequest.php index 4fdd8b0..bcf0564 100644 --- a/generated/Model/CreateMessageRequest.php +++ b/generated/Model/CreateMessageRequest.php @@ -11,7 +11,7 @@ class CreateMessageRequest /** * The role of the entity that is creating the message. Currently only `user` is supported. */ - protected ?string $role = null; + protected string $role = 'user'; /** * The content of the message. @@ -33,25 +33,25 @@ class CreateMessageRequest protected $metadata = null; /** - * @param string $role The role of the entity that is creating the message. Currently only `user` is supported. * @param string $content The content of the message. - * @param string[] $fileIds A list of [File](/docs/api-reference/files) IDs that the message should use. There can be a maximum of 10 files attached to a message. Useful for tools like `retrieval` and `code_interpreter` that can access and use files. * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * @param string $role The role of the entity that is creating the message. Currently only `user` is supported. + * @param string[] $fileIds A list of [File](/docs/api-reference/files) IDs that the message should use. There can be a maximum of 10 files attached to a message. Useful for tools like `retrieval` and `code_interpreter` that can access and use files. */ - public function __construct($role = null, $content = null, $fileIds = [], $metadata = null) + public function __construct($content = null, $metadata = null, $role = null, $fileIds = []) { - if ($role !== null) { - $this->setRole($role); - } if ($content !== null) { $this->setContent($content); } - if ($fileIds !== null) { - $this->setFileIds($fileIds); - } if ($metadata !== null) { $this->setMetadata($metadata); } + if ($role !== null) { + $this->setRole($role); + } + if ($fileIds !== null) { + $this->setFileIds($fileIds); + } } public function isInitialized($property): bool diff --git a/generated/Model/CreateModerationRequest.php b/generated/Model/CreateModerationRequest.php index d650289..b28ab9c 100644 --- a/generated/Model/CreateModerationRequest.php +++ b/generated/Model/CreateModerationRequest.php @@ -13,24 +13,23 @@ class CreateModerationRequest extends ArrayObject /** * The input text to classify * - * @var mixed + * @var string|string[] */ protected $input = null; /** * Two content moderations models are available: `text-moderation-stable` and `text-moderation-latest`. - * - * @var mixed + The default is `text-moderation-latest` which will be automatically upgraded over time. This ensures you are always using our most accurate model. If you use `text-moderation-stable`, we will provide advanced notice before updating the model. Accuracy of `text-moderation-stable` may be slightly lower than for `text-moderation-latest`. */ protected string $model = 'text-moderation-latest'; /** - * @param mixed $input The input text to classify - * @param mixed $model Two content moderations models are available: `text-moderation-stable` and `text-moderation-latest`. - * The default is `text-moderation-latest` which will be automatically upgraded over time. This ensures you are always using our most accurate model. If you use `text-moderation-stable`, we will provide advanced notice before updating the model. Accuracy of `text-moderation-stable` may be slightly lower than for `text-moderation-latest`. + * @param string|string[] $input The input text to classify + * @param string|string $model Two content moderations models are available: `text-moderation-stable` and `text-moderation-latest`. + * The default is `text-moderation-latest` which will be automatically upgraded over time. This ensures you are always using our most accurate model. If you use `text-moderation-stable`, we will provide advanced notice before updating the model. Accuracy of `text-moderation-stable` may be slightly lower than for `text-moderation-latest`. */ - public function __construct(mixed $input = null, mixed $model = 'text-moderation-latest') + public function __construct($input = null, $model = 'text-moderation-latest') { if ($input !== null) { $this->setInput($input); @@ -48,7 +47,7 @@ public function isInitialized($property): bool /** * The input text to classify * - * @return mixed + * @return string|string[] */ public function getInput() { @@ -57,8 +56,10 @@ public function getInput() /** * The input text to classify + * + * @param string|string[] $input */ - public function setInput(mixed $input): self + public function setInput($input): self { $this->initialized['input'] = true; $this->input = $input; @@ -69,7 +70,7 @@ public function setInput(mixed $input): self * Two content moderations models are available: `text-moderation-stable` and `text-moderation-latest`. * - * @return mixed + * @return string|string */ public function getModel(): string { @@ -79,9 +80,10 @@ public function getModel(): string /** * Two content moderations models are available: `text-moderation-stable` and `text-moderation-latest`. - The default is `text-moderation-latest` which will be automatically upgraded over time. This ensures you are always using our most accurate model. If you use `text-moderation-stable`, we will provide advanced notice before updating the model. Accuracy of `text-moderation-stable` may be slightly lower than for `text-moderation-latest`. + * + * @param string|string $model */ - public function setModel(mixed $model): self + public function setModel(string $model): self { $this->initialized['model'] = true; $this->model = $model; diff --git a/generated/Model/CreateRunRequest.php b/generated/Model/CreateRunRequest.php index 956d96b..a2b3e0a 100644 --- a/generated/Model/CreateRunRequest.php +++ b/generated/Model/CreateRunRequest.php @@ -31,9 +31,9 @@ class CreateRunRequest /** * Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. * - * @var mixed[]|null + * @var AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[]|null */ - protected ?array $tools = null; + protected $tools = null; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. @@ -47,7 +47,7 @@ class CreateRunRequest * @param string|null $model The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used. * @param string|null $instructions Overrides the [instructions](/docs/api-reference/assistants/createAssistant) of the assistant. This is useful for modifying the behavior on a per-run basis. * @param string|null $additionalInstructions Appends additional instructions at the end of the instructions for the run. This is useful for modifying the behavior on a per-run basis without overriding other instructions. - * @param mixed[]|null $tools Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. + * @param AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[]|null $tools Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. */ public function __construct($assistantId = null, $model = null, $instructions = null, $additionalInstructions = null, $tools = null, $metadata = null) @@ -152,7 +152,7 @@ public function setAdditionalInstructions(?string $additionalInstructions): self /** * Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. * - * @return mixed[]|null + * @return AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[]|null */ public function getTools(): ?array { @@ -162,7 +162,7 @@ public function getTools(): ?array /** * Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. * - * @param mixed[]|null $tools + * @param AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[]|null $tools */ public function setTools(?array $tools): self { diff --git a/generated/Model/CreateSpeechRequest.php b/generated/Model/CreateSpeechRequest.php index 2a59d55..5e30e55 100644 --- a/generated/Model/CreateSpeechRequest.php +++ b/generated/Model/CreateSpeechRequest.php @@ -11,7 +11,7 @@ class CreateSpeechRequest /** * One of the available [TTS models](/docs/models/tts): `tts-1` or `tts-1-hd` * - * @var mixed + * @var string|string */ protected $model = null; @@ -36,13 +36,13 @@ class CreateSpeechRequest protected float $speed = 1.0; /** - * @param mixed $model One of the available [TTS models](/docs/models/tts): `tts-1` or `tts-1-hd` + * @param string|string $model One of the available [TTS models](/docs/models/tts): `tts-1` or `tts-1-hd` * @param string $input The text to generate audio for. The maximum length is 4096 characters. * @param string $voice The voice to use when generating the audio. Supported voices are `alloy`, `echo`, `fable`, `onyx`, `nova`, and `shimmer`. Previews of the voices are available in the [Text to speech guide](/docs/guides/text-to-speech/voice-options). * @param string $responseFormat The format to audio in. Supported formats are `mp3`, `opus`, `aac`, and `flac`. * @param float $speed The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is the default. */ - public function __construct(mixed $model = null, $input = null, $voice = null, $responseFormat = 'mp3', $speed = 1.0) + public function __construct($model = null, $input = null, $voice = null, $responseFormat = 'mp3', $speed = 1.0) { if ($model !== null) { $this->setModel($model); @@ -69,7 +69,7 @@ public function isInitialized($property): bool /** * One of the available [TTS models](/docs/models/tts): `tts-1` or `tts-1-hd` * - * @return mixed + * @return string|string */ public function getModel() { @@ -78,8 +78,10 @@ public function getModel() /** * One of the available [TTS models](/docs/models/tts): `tts-1` or `tts-1-hd` + * + * @param string|string $model */ - public function setModel(mixed $model): self + public function setModel($model): self { $this->initialized['model'] = true; $this->model = $model; diff --git a/generated/Model/CreateThreadAndRunRequest.php b/generated/Model/CreateThreadAndRunRequest.php index 7540c69..558796a 100644 --- a/generated/Model/CreateThreadAndRunRequest.php +++ b/generated/Model/CreateThreadAndRunRequest.php @@ -28,9 +28,9 @@ class CreateThreadAndRunRequest /** * Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. * - * @var mixed[]|null + * @var AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[]|null */ - protected ?array $tools = null; + protected $tools = null; /** * Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. @@ -44,7 +44,7 @@ class CreateThreadAndRunRequest * @param CreateThreadRequest $thread * @param string|null $model The ID of the [Model](/docs/api-reference/models) to be used to execute this run. If a value is provided here, it will override the model associated with the assistant. If not, the model associated with the assistant will be used. * @param string|null $instructions Override the default system message of the assistant. This is useful for modifying the behavior on a per-run basis. - * @param mixed[]|null $tools Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. + * @param AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[]|null $tools Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. */ public function __construct($assistantId = null, $thread = null, $model = null, $instructions = null, $tools = null, $metadata = null) @@ -143,7 +143,7 @@ public function setInstructions(?string $instructions): self /** * Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. * - * @return mixed[]|null + * @return AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[]|null */ public function getTools(): ?array { @@ -153,7 +153,7 @@ public function getTools(): ?array /** * Override the tools the assistant can use for this run. This is useful for modifying the behavior on a per-run basis. * - * @param mixed[]|null $tools + * @param AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[]|null $tools */ public function setTools(?array $tools): self { diff --git a/generated/Model/CreateTranscriptionRequest.php b/generated/Model/CreateTranscriptionRequest.php index 86f1ead..46246d9 100644 --- a/generated/Model/CreateTranscriptionRequest.php +++ b/generated/Model/CreateTranscriptionRequest.php @@ -16,7 +16,7 @@ class CreateTranscriptionRequest /** * ID of the model to use. Only `whisper-1` is currently available. * - * @var mixed + * @var string|string */ protected $model = null; @@ -44,13 +44,13 @@ class CreateTranscriptionRequest /** * @param string $file The audio file object (not file name) to transcribe, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. - * @param mixed $model ID of the model to use. Only `whisper-1` is currently available. + * @param string|string $model ID of the model to use. Only `whisper-1` is currently available. * @param string $language The language of the input audio. Supplying the input language in [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) format will improve accuracy and latency. * @param string $prompt An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should match the audio language. * @param string $responseFormat The format of the transcript output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`. * @param float $temperature The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit. */ - public function __construct($file = null, mixed $model = null, $language = null, $prompt = null, $responseFormat = 'json', $temperature = 0) + public function __construct($file = null, $model = null, $language = null, $prompt = null, $responseFormat = 'json', $temperature = 0) { if ($file !== null) { $this->setFile($file); @@ -98,7 +98,7 @@ public function setFile(string $file): self /** * ID of the model to use. Only `whisper-1` is currently available. * - * @return mixed + * @return string|string */ public function getModel() { @@ -107,8 +107,10 @@ public function getModel() /** * ID of the model to use. Only `whisper-1` is currently available. + * + * @param string|string $model */ - public function setModel(mixed $model): self + public function setModel($model): self { $this->initialized['model'] = true; $this->model = $model; diff --git a/generated/Model/CreateTranslationRequest.php b/generated/Model/CreateTranslationRequest.php index 85f8e18..3511988 100644 --- a/generated/Model/CreateTranslationRequest.php +++ b/generated/Model/CreateTranslationRequest.php @@ -16,7 +16,7 @@ class CreateTranslationRequest /** * ID of the model to use. Only `whisper-1` is currently available. * - * @var mixed + * @var string|string */ protected $model = null; @@ -39,12 +39,12 @@ class CreateTranslationRequest /** * @param string $file The audio file object (not file name) translate, in one of these formats: flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. - * @param mixed $model ID of the model to use. Only `whisper-1` is currently available. + * @param string|string $model ID of the model to use. Only `whisper-1` is currently available. * @param string $prompt An optional text to guide the model's style or continue a previous audio segment. The [prompt](/docs/guides/speech-to-text/prompting) should be in English. * @param string $responseFormat The format of the transcript output, in one of these options: `json`, `text`, `srt`, `verbose_json`, or `vtt`. * @param float $temperature The sampling temperature, between 0 and 1. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. If set to 0, the model will use [log probability](https://en.wikipedia.org/wiki/Log_probability) to automatically increase the temperature until certain thresholds are hit. */ - public function __construct($file = null, mixed $model = null, $prompt = null, $responseFormat = 'json', $temperature = 0) + public function __construct($file = null, $model = null, $prompt = null, $responseFormat = 'json', $temperature = 0) { if ($file !== null) { $this->setFile($file); @@ -89,7 +89,7 @@ public function setFile(string $file): self /** * ID of the model to use. Only `whisper-1` is currently available. * - * @return mixed + * @return string|string */ public function getModel() { @@ -98,8 +98,10 @@ public function getModel() /** * ID of the model to use. Only `whisper-1` is currently available. + * + * @param string|string $model */ - public function setModel(mixed $model): self + public function setModel($model): self { $this->initialized['model'] = true; $this->model = $model; diff --git a/generated/Model/DeleteAssistantFileResponse.php b/generated/Model/DeleteAssistantFileResponse.php index c58b307..2ceda1b 100644 --- a/generated/Model/DeleteAssistantFileResponse.php +++ b/generated/Model/DeleteAssistantFileResponse.php @@ -14,7 +14,7 @@ class DeleteAssistantFileResponse extends ArrayObject protected ?bool $deleted = null; - protected ?string $object = null; + protected string $object = 'assistant.file.deleted'; /** * @param string $id diff --git a/generated/Model/DeleteAssistantResponse.php b/generated/Model/DeleteAssistantResponse.php index 04e868c..084f135 100644 --- a/generated/Model/DeleteAssistantResponse.php +++ b/generated/Model/DeleteAssistantResponse.php @@ -14,7 +14,7 @@ class DeleteAssistantResponse extends ArrayObject protected ?bool $deleted = null; - protected ?string $object = null; + protected string $object = 'assistant.deleted'; /** * @param string $id diff --git a/generated/Model/DeleteFileResponse.php b/generated/Model/DeleteFileResponse.php index 99c3647..ea4a260 100644 --- a/generated/Model/DeleteFileResponse.php +++ b/generated/Model/DeleteFileResponse.php @@ -12,26 +12,26 @@ class DeleteFileResponse extends ArrayObject protected ?string $id = null; - protected ?string $object = null; + protected string $object = 'file'; protected ?bool $deleted = null; /** * @param string $id - * @param string $object * @param bool $deleted + * @param string $object */ - public function __construct($id = null, $object = null, $deleted = null) + public function __construct($id = null, $deleted = null, $object = null) { if ($id !== null) { $this->setId($id); } - if ($object !== null) { - $this->setObject($object); - } if ($deleted !== null) { $this->setDeleted($deleted); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool diff --git a/generated/Model/DeleteMessageResponse.php b/generated/Model/DeleteMessageResponse.php index ecfe9d2..df324fd 100644 --- a/generated/Model/DeleteMessageResponse.php +++ b/generated/Model/DeleteMessageResponse.php @@ -14,7 +14,7 @@ class DeleteMessageResponse extends ArrayObject protected ?bool $deleted = null; - protected ?string $object = null; + protected string $object = 'thread.message.deleted'; /** * @param string $id diff --git a/generated/Model/DeleteThreadResponse.php b/generated/Model/DeleteThreadResponse.php index d98316e..7f3d471 100644 --- a/generated/Model/DeleteThreadResponse.php +++ b/generated/Model/DeleteThreadResponse.php @@ -14,7 +14,7 @@ class DeleteThreadResponse extends ArrayObject protected ?bool $deleted = null; - protected ?string $object = null; + protected string $object = 'thread.deleted'; /** * @param string $id diff --git a/generated/Model/Embedding.php b/generated/Model/Embedding.php index c95c94d..7d86750 100644 --- a/generated/Model/Embedding.php +++ b/generated/Model/Embedding.php @@ -25,7 +25,7 @@ class Embedding extends ArrayObject /** * The object type, which is always "embedding". */ - protected ?string $object = null; + protected string $object = 'embedding'; /** * @param int $index The index of the embedding in the list of embeddings. diff --git a/generated/Model/FineTune.php b/generated/Model/FineTune.php index 7f54963..a10286b 100644 --- a/generated/Model/FineTune.php +++ b/generated/Model/FineTune.php @@ -48,7 +48,7 @@ class FineTune extends ArrayObject /** * The object type, which is always "fine-tune". */ - protected ?string $object = null; + protected string $object = 'fine-tune'; /** * The organization that owns the fine-tuning job. @@ -93,15 +93,15 @@ class FineTune extends ArrayObject * @param string|null $fineTunedModel The name of the fine-tuned model that is being created. * @param FineTuneHyperparams $hyperparams The hyperparameters used for the fine-tuning job. See the [fine-tuning guide](/docs/guides/legacy-fine-tuning/hyperparameters) for more details. * @param string $model The base model that is being fine-tuned. - * @param string $object The object type, which is always "fine-tune". * @param string $organizationId The organization that owns the fine-tuning job. * @param OpenAIFile[] $resultFiles The compiled results files for the fine-tuning job. * @param string $status The current status of the fine-tuning job, which can be either `created`, `running`, `succeeded`, `failed`, or `cancelled`. * @param OpenAIFile[] $trainingFiles The list of files used for training. * @param int $updatedAt The Unix timestamp (in seconds) for when the fine-tuning job was last updated. * @param OpenAIFile[] $validationFiles The list of files used for validation. + * @param string $object The object type, which is always "fine-tune". */ - public function __construct($id = null, $createdAt = null, $events = null, $fineTunedModel = null, $hyperparams = null, $model = null, $object = null, $organizationId = null, $resultFiles = null, $status = null, $trainingFiles = null, $updatedAt = null, $validationFiles = null) + public function __construct($id = null, $createdAt = null, $events = null, $fineTunedModel = null, $hyperparams = null, $model = null, $organizationId = null, $resultFiles = null, $status = null, $trainingFiles = null, $updatedAt = null, $validationFiles = null, $object = null) { if ($id !== null) { $this->setId($id); @@ -121,9 +121,6 @@ public function __construct($id = null, $createdAt = null, $events = null, $fine if ($model !== null) { $this->setModel($model); } - if ($object !== null) { - $this->setObject($object); - } if ($organizationId !== null) { $this->setOrganizationId($organizationId); } @@ -142,6 +139,9 @@ public function __construct($id = null, $createdAt = null, $events = null, $fine if ($validationFiles !== null) { $this->setValidationFiles($validationFiles); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool diff --git a/generated/Model/FineTuneEvent.php b/generated/Model/FineTuneEvent.php index a832945..3eda1d1 100644 --- a/generated/Model/FineTuneEvent.php +++ b/generated/Model/FineTuneEvent.php @@ -19,7 +19,7 @@ class FineTuneEvent extends ArrayObject protected ?string $message = null; - protected ?string $object = null; + protected string $object = 'fine-tune-event'; /** * @param int $createdAt diff --git a/generated/Model/FineTuningJob.php b/generated/Model/FineTuningJob.php index 6437cb2..0ba0c88 100644 --- a/generated/Model/FineTuningJob.php +++ b/generated/Model/FineTuningJob.php @@ -48,7 +48,7 @@ class FineTuningJob extends ArrayObject /** * The object type, which is always "fine_tuning.job". */ - protected ?string $object = null; + protected string $object = 'fine_tuning.job'; /** * The organization that owns the fine-tuning job. @@ -90,15 +90,15 @@ class FineTuningJob extends ArrayObject * @param int|null $finishedAt The Unix timestamp (in seconds) for when the fine-tuning job was finished. The value will be null if the fine-tuning job is still running. * @param FineTuningJobHyperparameters $hyperparameters The hyperparameters used for the fine-tuning job. See the [fine-tuning guide](/docs/guides/fine-tuning) for more details. * @param string $model The base model that is being fine-tuned. - * @param string $object The object type, which is always "fine_tuning.job". * @param string $organizationId The organization that owns the fine-tuning job. * @param string[] $resultFiles The compiled results file ID(s) for the fine-tuning job. You can retrieve the results with the [Files API](/docs/api-reference/files/retrieve-contents). * @param string $status The current status of the fine-tuning job, which can be either `validating_files`, `queued`, `running`, `succeeded`, `failed`, or `cancelled`. * @param int|null $trainedTokens The total number of billable tokens processed by this fine-tuning job. The value will be null if the fine-tuning job is still running. * @param string $trainingFile The file ID used for training. You can retrieve the training data with the [Files API](/docs/api-reference/files/retrieve-contents). * @param string|null $validationFile The file ID used for validation. You can retrieve the validation results with the [Files API](/docs/api-reference/files/retrieve-contents). + * @param string $object The object type, which is always "fine_tuning.job". */ - public function __construct($id = null, $createdAt = null, $error = null, $fineTunedModel = null, $finishedAt = null, $hyperparameters = null, $model = null, $object = null, $organizationId = null, $resultFiles = null, $status = null, $trainedTokens = null, $trainingFile = null, $validationFile = null) + public function __construct($id = null, $createdAt = null, $error = null, $fineTunedModel = null, $finishedAt = null, $hyperparameters = null, $model = null, $organizationId = null, $resultFiles = null, $status = null, $trainedTokens = null, $trainingFile = null, $validationFile = null, $object = null) { if ($id !== null) { $this->setId($id); @@ -121,9 +121,6 @@ public function __construct($id = null, $createdAt = null, $error = null, $fineT if ($model !== null) { $this->setModel($model); } - if ($object !== null) { - $this->setObject($object); - } if ($organizationId !== null) { $this->setOrganizationId($organizationId); } @@ -142,6 +139,9 @@ public function __construct($id = null, $createdAt = null, $error = null, $fineT if ($validationFile !== null) { $this->setValidationFile($validationFile); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool diff --git a/generated/Model/FineTuningJobEvent.php b/generated/Model/FineTuningJobEvent.php index 7915fb3..997ca4a 100644 --- a/generated/Model/FineTuningJobEvent.php +++ b/generated/Model/FineTuningJobEvent.php @@ -18,7 +18,7 @@ class FineTuningJobEvent extends ArrayObject protected ?string $message = null; - protected ?string $object = null; + protected string $object = 'fine_tuning.job.event'; /** * @param string $id diff --git a/generated/Model/FineTuningJobHyperparameters.php b/generated/Model/FineTuningJobHyperparameters.php index e1aee66..04b2181 100644 --- a/generated/Model/FineTuningJobHyperparameters.php +++ b/generated/Model/FineTuningJobHyperparameters.php @@ -12,16 +12,15 @@ class FineTuningJobHyperparameters extends ArrayObject /** * The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. - * - * @var mixed + "auto" decides the optimal number of epochs based on the size of the dataset. If setting the number manually, we support any number between 1 and 50 epochs. */ protected string $nEpochs = 'auto'; /** - * @param mixed $nEpochs The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. - * "auto" decides the optimal number of epochs based on the size of the dataset. If setting the number manually, we support any number between 1 and 50 epochs. + * @param string|int $nEpochs The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. + * "auto" decides the optimal number of epochs based on the size of the dataset. If setting the number manually, we support any number between 1 and 50 epochs. */ - public function __construct(mixed $nEpochs = 'auto') + public function __construct($nEpochs = 'auto') { if ($nEpochs !== null) { $this->setNEpochs($nEpochs); @@ -36,7 +35,7 @@ public function isInitialized($property): bool /** * The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. * - * @return mixed + * @return string|int */ public function getNEpochs(): string { @@ -45,9 +44,10 @@ public function getNEpochs(): string /** * The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset. - "auto" decides the optimal number of epochs based on the size of the dataset. If setting the number manually, we support any number between 1 and 50 epochs. + * + * @param string|int $nEpochs */ - public function setNEpochs(mixed $nEpochs): self + public function setNEpochs(string $nEpochs): self { $this->initialized['nEpochs'] = true; $this->nEpochs = $nEpochs; diff --git a/generated/Model/ListFilesResponse.php b/generated/Model/ListFilesResponse.php index e89f294..428d395 100644 --- a/generated/Model/ListFilesResponse.php +++ b/generated/Model/ListFilesResponse.php @@ -15,7 +15,7 @@ class ListFilesResponse extends ArrayObject */ protected ?array $data = null; - protected ?string $object = null; + protected string $object = 'list'; /** * @param OpenAIFile[] $data diff --git a/generated/Model/ListFineTuneEventsResponse.php b/generated/Model/ListFineTuneEventsResponse.php index cb31bb0..23b66b9 100644 --- a/generated/Model/ListFineTuneEventsResponse.php +++ b/generated/Model/ListFineTuneEventsResponse.php @@ -15,7 +15,7 @@ class ListFineTuneEventsResponse extends ArrayObject */ protected ?array $data = null; - protected ?string $object = null; + protected string $object = 'list'; /** * @param FineTuneEvent[] $data diff --git a/generated/Model/ListFineTunesResponse.php b/generated/Model/ListFineTunesResponse.php index 59eb721..d54da7e 100644 --- a/generated/Model/ListFineTunesResponse.php +++ b/generated/Model/ListFineTunesResponse.php @@ -15,7 +15,7 @@ class ListFineTunesResponse extends ArrayObject */ protected ?array $data = null; - protected ?string $object = null; + protected string $object = 'list'; /** * @param FineTune[] $data diff --git a/generated/Model/ListFineTuningJobEventsResponse.php b/generated/Model/ListFineTuningJobEventsResponse.php index 172df60..255b252 100644 --- a/generated/Model/ListFineTuningJobEventsResponse.php +++ b/generated/Model/ListFineTuningJobEventsResponse.php @@ -15,7 +15,7 @@ class ListFineTuningJobEventsResponse extends ArrayObject */ protected ?array $data = null; - protected ?string $object = null; + protected string $object = 'list'; /** * @param FineTuningJobEvent[] $data diff --git a/generated/Model/ListModelsResponse.php b/generated/Model/ListModelsResponse.php index 2f85bbd..f0c3838 100644 --- a/generated/Model/ListModelsResponse.php +++ b/generated/Model/ListModelsResponse.php @@ -10,7 +10,7 @@ class ListModelsResponse extends ArrayObject { protected array $initialized = []; - protected ?string $object = null; + protected string $object = 'list'; /** * @var Model[] @@ -18,17 +18,17 @@ class ListModelsResponse extends ArrayObject protected ?array $data = null; /** - * @param string $object * @param Model[] $data + * @param string $object */ - public function __construct($object = null, $data = null) + public function __construct($data = null, $object = null) { - if ($object !== null) { - $this->setObject($object); - } if ($data !== null) { $this->setData($data); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool diff --git a/generated/Model/ListPaginatedFineTuningJobsResponse.php b/generated/Model/ListPaginatedFineTuningJobsResponse.php index 52af845..a0e7de3 100644 --- a/generated/Model/ListPaginatedFineTuningJobsResponse.php +++ b/generated/Model/ListPaginatedFineTuningJobsResponse.php @@ -17,7 +17,7 @@ class ListPaginatedFineTuningJobsResponse extends ArrayObject protected ?bool $hasMore = null; - protected ?string $object = null; + protected string $object = 'list'; /** * @param FineTuningJob[] $data diff --git a/generated/Model/MessageContentImageFileObject.php b/generated/Model/MessageContentImageFileObject.php index 5adde16..7c319b1 100644 --- a/generated/Model/MessageContentImageFileObject.php +++ b/generated/Model/MessageContentImageFileObject.php @@ -13,22 +13,22 @@ class MessageContentImageFileObject extends ArrayObject /** * Always `image_file`. */ - protected ?string $type = null; + protected string $type = 'image_file'; protected ?MessageContentImageFileObjectImageFile $imageFile = null; /** - * @param string $type Always `image_file`. * @param MessageContentImageFileObjectImageFile $imageFile + * @param string $type Always `image_file`. */ - public function __construct($type = null, $imageFile = null) + public function __construct($imageFile = null, $type = null) { - if ($type !== null) { - $this->setType($type); - } if ($imageFile !== null) { $this->setImageFile($imageFile); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/MessageContentTextAnnotationsFileCitationObject.php b/generated/Model/MessageContentTextAnnotationsFileCitationObject.php index baa30f9..8fde9a2 100644 --- a/generated/Model/MessageContentTextAnnotationsFileCitationObject.php +++ b/generated/Model/MessageContentTextAnnotationsFileCitationObject.php @@ -13,7 +13,7 @@ class MessageContentTextAnnotationsFileCitationObject extends ArrayObject /** * Always `file_citation`. */ - protected ?string $type = null; + protected string $type = 'file_citation'; /** * The text in the message content that needs to be replaced. @@ -27,17 +27,14 @@ class MessageContentTextAnnotationsFileCitationObject extends ArrayObject protected ?int $endIndex = null; /** - * @param string $type Always `file_citation`. * @param string $text The text in the message content that needs to be replaced. * @param MessageContentTextAnnotationsFileCitationObjectFileCitation $fileCitation * @param int $startIndex * @param int $endIndex + * @param string $type Always `file_citation`. */ - public function __construct($type = null, $text = null, $fileCitation = null, $startIndex = null, $endIndex = null) + public function __construct($text = null, $fileCitation = null, $startIndex = null, $endIndex = null, $type = null) { - if ($type !== null) { - $this->setType($type); - } if ($text !== null) { $this->setText($text); } @@ -50,6 +47,9 @@ public function __construct($type = null, $text = null, $fileCitation = null, $s if ($endIndex !== null) { $this->setEndIndex($endIndex); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/MessageContentTextAnnotationsFilePathObject.php b/generated/Model/MessageContentTextAnnotationsFilePathObject.php index bed908e..7de298b 100644 --- a/generated/Model/MessageContentTextAnnotationsFilePathObject.php +++ b/generated/Model/MessageContentTextAnnotationsFilePathObject.php @@ -13,7 +13,7 @@ class MessageContentTextAnnotationsFilePathObject extends ArrayObject /** * Always `file_path`. */ - protected ?string $type = null; + protected string $type = 'file_path'; /** * The text in the message content that needs to be replaced. @@ -27,17 +27,14 @@ class MessageContentTextAnnotationsFilePathObject extends ArrayObject protected ?int $endIndex = null; /** - * @param string $type Always `file_path`. * @param string $text The text in the message content that needs to be replaced. * @param MessageContentTextAnnotationsFilePathObjectFilePath $filePath * @param int $startIndex * @param int $endIndex + * @param string $type Always `file_path`. */ - public function __construct($type = null, $text = null, $filePath = null, $startIndex = null, $endIndex = null) + public function __construct($text = null, $filePath = null, $startIndex = null, $endIndex = null, $type = null) { - if ($type !== null) { - $this->setType($type); - } if ($text !== null) { $this->setText($text); } @@ -50,6 +47,9 @@ public function __construct($type = null, $text = null, $filePath = null, $start if ($endIndex !== null) { $this->setEndIndex($endIndex); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/MessageContentTextObject.php b/generated/Model/MessageContentTextObject.php index d6413dc..c849d8d 100644 --- a/generated/Model/MessageContentTextObject.php +++ b/generated/Model/MessageContentTextObject.php @@ -13,22 +13,22 @@ class MessageContentTextObject extends ArrayObject /** * Always `text`. */ - protected ?string $type = null; + protected string $type = 'text'; protected ?MessageContentTextObjectText $text = null; /** - * @param string $type Always `text`. * @param MessageContentTextObjectText $text + * @param string $type Always `text`. */ - public function __construct($type = null, $text = null) + public function __construct($text = null, $type = null) { - if ($type !== null) { - $this->setType($type); - } if ($text !== null) { $this->setText($text); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/MessageContentTextObjectText.php b/generated/Model/MessageContentTextObjectText.php index 097f20d..55d6c06 100644 --- a/generated/Model/MessageContentTextObjectText.php +++ b/generated/Model/MessageContentTextObjectText.php @@ -16,13 +16,13 @@ class MessageContentTextObjectText extends ArrayObject protected ?string $value = null; /** - * @var mixed[] + * @var MessageContentTextAnnotationsFileCitationObject[]|MessageContentTextAnnotationsFilePathObject[] */ protected ?array $annotations = null; /** * @param string $value The data that makes up the text. - * @param mixed[] $annotations + * @param MessageContentTextAnnotationsFileCitationObject[]|MessageContentTextAnnotationsFilePathObject[] $annotations */ public function __construct($value = null, $annotations = null) { @@ -58,7 +58,7 @@ public function setValue(string $value): self } /** - * @return mixed[] + * @return MessageContentTextAnnotationsFileCitationObject[]|MessageContentTextAnnotationsFilePathObject[] */ public function getAnnotations(): array { @@ -66,7 +66,7 @@ public function getAnnotations(): array } /** - * @param mixed[] $annotations + * @param MessageContentTextAnnotationsFileCitationObject[]|MessageContentTextAnnotationsFilePathObject[] $annotations */ public function setAnnotations(array $annotations): self { diff --git a/generated/Model/MessageFileObject.php b/generated/Model/MessageFileObject.php index 253585e..1185872 100644 --- a/generated/Model/MessageFileObject.php +++ b/generated/Model/MessageFileObject.php @@ -18,7 +18,7 @@ class MessageFileObject extends ArrayObject /** * The object type, which is always `thread.message.file`. */ - protected ?string $object = null; + protected string $object = 'thread.message.file'; /** * The Unix timestamp (in seconds) for when the message file was created. @@ -32,24 +32,24 @@ class MessageFileObject extends ArrayObject /** * @param string $id The identifier, which can be referenced in API endpoints. - * @param string $object The object type, which is always `thread.message.file`. * @param int $createdAt The Unix timestamp (in seconds) for when the message file was created. * @param string $messageId The ID of the [message](/docs/api-reference/messages) that the [File](/docs/api-reference/files) is attached to. + * @param string $object The object type, which is always `thread.message.file`. */ - public function __construct($id = null, $object = null, $createdAt = null, $messageId = null) + public function __construct($id = null, $createdAt = null, $messageId = null, $object = null) { if ($id !== null) { $this->setId($id); } - if ($object !== null) { - $this->setObject($object); - } if ($createdAt !== null) { $this->setCreatedAt($createdAt); } if ($messageId !== null) { $this->setMessageId($messageId); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool diff --git a/generated/Model/MessageObject.php b/generated/Model/MessageObject.php index 37cbf5a..3145393 100644 --- a/generated/Model/MessageObject.php +++ b/generated/Model/MessageObject.php @@ -18,7 +18,7 @@ class MessageObject extends ArrayObject /** * The object type, which is always `thread.message`. */ - protected ?string $object = null; + protected string $object = 'thread.message'; /** * The Unix timestamp (in seconds) for when the message was created. @@ -38,7 +38,7 @@ class MessageObject extends ArrayObject /** * The content of the message in array of text and/or images. * - * @var mixed[] + * @var MessageContentImageFileObject[]|MessageContentTextObject[] */ protected ?array $content = null; @@ -68,24 +68,21 @@ class MessageObject extends ArrayObject /** * @param string $id The identifier, which can be referenced in API endpoints. - * @param string $object The object type, which is always `thread.message`. * @param int $createdAt The Unix timestamp (in seconds) for when the message was created. * @param string $threadId The [thread](/docs/api-reference/threads) ID that this message belongs to. * @param string $role The entity that produced the message. One of `user` or `assistant`. - * @param mixed[] $content The content of the message in array of text and/or images. + * @param MessageContentImageFileObject[]|MessageContentTextObject[] $content The content of the message in array of text and/or images. * @param string|null $assistantId If applicable, the ID of the [assistant](/docs/api-reference/assistants) that authored this message. * @param string|null $runId If applicable, the ID of the [run](/docs/api-reference/runs) associated with the authoring of this message. - * @param string[] $fileIds A list of [file](/docs/api-reference/files) IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can access files. A maximum of 10 files can be attached to a message. * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * @param string $object The object type, which is always `thread.message`. + * @param string[] $fileIds A list of [file](/docs/api-reference/files) IDs that the assistant should use. Useful for tools like retrieval and code_interpreter that can access files. A maximum of 10 files can be attached to a message. */ - public function __construct($id = null, $object = null, $createdAt = null, $threadId = null, $role = null, $content = null, $assistantId = null, $runId = null, $fileIds = [], $metadata = null) + public function __construct($id = null, $createdAt = null, $threadId = null, $role = null, $content = null, $assistantId = null, $runId = null, $metadata = null, $object = null, $fileIds = []) { if ($id !== null) { $this->setId($id); } - if ($object !== null) { - $this->setObject($object); - } if ($createdAt !== null) { $this->setCreatedAt($createdAt); } @@ -104,12 +101,15 @@ public function __construct($id = null, $object = null, $createdAt = null, $thre if ($runId !== null) { $this->setRunId($runId); } - if ($fileIds !== null) { - $this->setFileIds($fileIds); - } if ($metadata !== null) { $this->setMetadata($metadata); } + if ($object !== null) { + $this->setObject($object); + } + if ($fileIds !== null) { + $this->setFileIds($fileIds); + } } public function isInitialized($property): bool @@ -210,7 +210,7 @@ public function setRole(string $role): self /** * The content of the message in array of text and/or images. * - * @return mixed[] + * @return MessageContentImageFileObject[]|MessageContentTextObject[] */ public function getContent(): array { @@ -220,7 +220,7 @@ public function getContent(): array /** * The content of the message in array of text and/or images. * - * @param mixed[] $content + * @param MessageContentImageFileObject[]|MessageContentTextObject[] $content */ public function setContent(array $content): self { diff --git a/generated/Model/Model.php b/generated/Model/Model.php index 5d42462..ea3429f 100644 --- a/generated/Model/Model.php +++ b/generated/Model/Model.php @@ -23,7 +23,7 @@ class Model extends ArrayObject /** * The object type, which is always "model". */ - protected ?string $object = null; + protected string $object = 'model'; /** * The organization that owns the model. @@ -33,10 +33,10 @@ class Model extends ArrayObject /** * @param string $id The model identifier, which can be referenced in the API endpoints. * @param int $created The Unix timestamp (in seconds) when the model was created. - * @param string $object The object type, which is always "model". * @param string $ownedBy The organization that owns the model. + * @param string $object The object type, which is always "model". */ - public function __construct($id = null, $created = null, $object = null, $ownedBy = null) + public function __construct($id = null, $created = null, $ownedBy = null, $object = null) { if ($id !== null) { $this->setId($id); @@ -44,12 +44,12 @@ public function __construct($id = null, $created = null, $object = null, $ownedB if ($created !== null) { $this->setCreated($created); } - if ($object !== null) { - $this->setObject($object); - } if ($ownedBy !== null) { $this->setOwnedBy($ownedBy); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool diff --git a/generated/Model/ModifyAssistantRequest.php b/generated/Model/ModifyAssistantRequest.php index 3287935..5cd08b6 100644 --- a/generated/Model/ModifyAssistantRequest.php +++ b/generated/Model/ModifyAssistantRequest.php @@ -10,10 +10,8 @@ class ModifyAssistantRequest /** * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. - * - * @var mixed */ - protected $model = null; + protected ?string $model = null; /** * The name of the assistant. The maximum length is 256 characters. @@ -33,7 +31,7 @@ class ModifyAssistantRequest /** * A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. * - * @var mixed[] + * @var AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[] */ protected array $tools = []; @@ -52,15 +50,15 @@ class ModifyAssistantRequest protected $metadata = null; /** - * @param mixed $model ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. + * @param string $model ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. * @param string|null $name The name of the assistant. The maximum length is 256 characters. * @param string|null $description The description of the assistant. The maximum length is 512 characters. * @param string|null $instructions The system instructions that the assistant uses. The maximum length is 32768 characters. - * @param mixed[] $tools A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. - * @param string[] $fileIds A list of [File](/docs/api-reference/files) IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. If a file was previously attached to the list but does not show up in the list, it will be deleted from the assistant. * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * @param AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[] $tools A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. + * @param string[] $fileIds A list of [File](/docs/api-reference/files) IDs attached to this assistant. There can be a maximum of 20 files attached to the assistant. Files are ordered by their creation date in ascending order. If a file was previously attached to the list but does not show up in the list, it will be deleted from the assistant. */ - public function __construct(mixed $model = null, $name = null, $description = null, $instructions = null, $tools = [], $fileIds = [], $metadata = null) + public function __construct($model = null, $name = null, $description = null, $instructions = null, $metadata = null, $tools = [], $fileIds = []) { if ($model !== null) { $this->setModel($model); @@ -74,15 +72,15 @@ public function __construct(mixed $model = null, $name = null, $description = nu if ($instructions !== null) { $this->setInstructions($instructions); } + if ($metadata !== null) { + $this->setMetadata($metadata); + } if ($tools !== null) { $this->setTools($tools); } if ($fileIds !== null) { $this->setFileIds($fileIds); } - if ($metadata !== null) { - $this->setMetadata($metadata); - } } public function isInitialized($property): bool @@ -92,10 +90,8 @@ public function isInitialized($property): bool /** * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. - * - * @return mixed */ - public function getModel() + public function getModel(): string { return $this->model; } @@ -103,7 +99,7 @@ public function getModel() /** * ID of the model to use. You can use the [List models](/docs/api-reference/models/list) API to see all of your available models, or see our [Model overview](/docs/models/overview) for descriptions of them. */ - public function setModel(mixed $model): self + public function setModel(string $model): self { $this->initialized['model'] = true; $this->model = $model; @@ -167,7 +163,7 @@ public function setInstructions(?string $instructions): self /** * A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. * - * @return mixed[] + * @return AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[] */ public function getTools(): array { @@ -177,7 +173,7 @@ public function getTools(): array /** * A list of tool enabled on the assistant. There can be a maximum of 128 tools per assistant. Tools can be of types `code_interpreter`, `retrieval`, or `function`. * - * @param mixed[] $tools + * @param AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[] $tools */ public function setTools(array $tools): self { diff --git a/generated/Model/OpenAIFile.php b/generated/Model/OpenAIFile.php index d52948d..0ebd6e2 100644 --- a/generated/Model/OpenAIFile.php +++ b/generated/Model/OpenAIFile.php @@ -33,7 +33,7 @@ class OpenAIFile extends ArrayObject /** * The object type, which is always `file`. */ - protected ?string $object = null; + protected string $object = 'file'; /** * The intended purpose of the file. Supported values are `fine-tune`, `fine-tune-results`, `assistants`, and `assistants_output`. @@ -59,12 +59,12 @@ class OpenAIFile extends ArrayObject * @param int $bytes The size of the file, in bytes. * @param int $createdAt The Unix timestamp (in seconds) for when the file was created. * @param string $filename The name of the file. - * @param string $object The object type, which is always `file`. * @param string $purpose The intended purpose of the file. Supported values are `fine-tune`, `fine-tune-results`, `assistants`, and `assistants_output`. * @param string $status Deprecated. The current status of the file, which can be either `uploaded`, `processed`, or `error`. * @param string $statusDetails Deprecated. For details on why a fine-tuning training file failed validation, see the `error` field on `fine_tuning.job`. + * @param string $object The object type, which is always `file`. */ - public function __construct($id = null, $bytes = null, $createdAt = null, $filename = null, $object = null, $purpose = null, $status = null, $statusDetails = null) + public function __construct($id = null, $bytes = null, $createdAt = null, $filename = null, $purpose = null, $status = null, $statusDetails = null, $object = null) { if ($id !== null) { $this->setId($id); @@ -78,9 +78,6 @@ public function __construct($id = null, $bytes = null, $createdAt = null, $filen if ($filename !== null) { $this->setFilename($filename); } - if ($object !== null) { - $this->setObject($object); - } if ($purpose !== null) { $this->setPurpose($purpose); } @@ -90,6 +87,9 @@ public function __construct($id = null, $bytes = null, $createdAt = null, $filen if ($statusDetails !== null) { $this->setStatusDetails($statusDetails); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool diff --git a/generated/Model/RunObject.php b/generated/Model/RunObject.php index cb85fd4..2ba3e5b 100644 --- a/generated/Model/RunObject.php +++ b/generated/Model/RunObject.php @@ -18,7 +18,7 @@ class RunObject extends ArrayObject /** * The object type, which is always `thread.run`. */ - protected ?string $object = null; + protected string $object = 'thread.run'; /** * The Unix timestamp (in seconds) for when the run was created. @@ -88,7 +88,7 @@ class RunObject extends ArrayObject /** * The list of tools that the [assistant](/docs/api-reference/assistants) used for this run. * - * @var mixed[] + * @var AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[] */ protected array $tools = []; @@ -108,7 +108,6 @@ class RunObject extends ArrayObject /** * @param string $id The identifier, which can be referenced in API endpoints. - * @param string $object The object type, which is always `thread.run`. * @param int $createdAt The Unix timestamp (in seconds) for when the run was created. * @param string $threadId The ID of the [thread](/docs/api-reference/threads) that was executed on as a part of this run. * @param string $assistantId The ID of the [assistant](/docs/api-reference/assistants) used for execution of this run. @@ -122,18 +121,16 @@ class RunObject extends ArrayObject * @param int|null $completedAt The Unix timestamp (in seconds) for when the run was completed. * @param string $model The model that the [assistant](/docs/api-reference/assistants) used for this run. * @param string $instructions The instructions that the [assistant](/docs/api-reference/assistants) used for this run. - * @param mixed[] $tools The list of tools that the [assistant](/docs/api-reference/assistants) used for this run. - * @param string[] $fileIds The list of [File](/docs/api-reference/files) IDs the [assistant](/docs/api-reference/assistants) used for this run. * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * @param string $object The object type, which is always `thread.run`. + * @param AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[] $tools The list of tools that the [assistant](/docs/api-reference/assistants) used for this run. + * @param string[] $fileIds The list of [File](/docs/api-reference/files) IDs the [assistant](/docs/api-reference/assistants) used for this run. */ - public function __construct($id = null, $object = null, $createdAt = null, $threadId = null, $assistantId = null, $status = null, $requiredAction = null, $lastError = null, $expiresAt = null, $startedAt = null, $cancelledAt = null, $failedAt = null, $completedAt = null, $model = null, $instructions = null, $tools = [], $fileIds = [], $metadata = null) + public function __construct($id = null, $createdAt = null, $threadId = null, $assistantId = null, $status = null, $requiredAction = null, $lastError = null, $expiresAt = null, $startedAt = null, $cancelledAt = null, $failedAt = null, $completedAt = null, $model = null, $instructions = null, $metadata = null, $object = null, $tools = [], $fileIds = []) { if ($id !== null) { $this->setId($id); } - if ($object !== null) { - $this->setObject($object); - } if ($createdAt !== null) { $this->setCreatedAt($createdAt); } @@ -173,15 +170,18 @@ public function __construct($id = null, $object = null, $createdAt = null, $thre if ($instructions !== null) { $this->setInstructions($instructions); } + if ($metadata !== null) { + $this->setMetadata($metadata); + } + if ($object !== null) { + $this->setObject($object); + } if ($tools !== null) { $this->setTools($tools); } if ($fileIds !== null) { $this->setFileIds($fileIds); } - if ($metadata !== null) { - $this->setMetadata($metadata); - } } public function isInitialized($property): bool @@ -462,7 +462,7 @@ public function setInstructions(string $instructions): self /** * The list of tools that the [assistant](/docs/api-reference/assistants) used for this run. * - * @return mixed[] + * @return AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[] */ public function getTools(): array { @@ -472,7 +472,7 @@ public function getTools(): array /** * The list of tools that the [assistant](/docs/api-reference/assistants) used for this run. * - * @param mixed[] $tools + * @param AssistantToolsCode[]|AssistantToolsRetrieval[]|AssistantToolsFunction[] $tools */ public function setTools(array $tools): self { diff --git a/generated/Model/RunObjectRequiredAction.php b/generated/Model/RunObjectRequiredAction.php index b03c9e3..30ae556 100644 --- a/generated/Model/RunObjectRequiredAction.php +++ b/generated/Model/RunObjectRequiredAction.php @@ -13,7 +13,7 @@ class RunObjectRequiredAction extends ArrayObject /** * For now, this is always `submit_tool_outputs`. */ - protected ?string $type = null; + protected string $type = 'submit_tool_outputs'; /** * Details on the tool outputs needed for this run to continue. @@ -21,17 +21,17 @@ class RunObjectRequiredAction extends ArrayObject protected ?RunObjectRequiredActionSubmitToolOutputs $submitToolOutputs = null; /** - * @param string $type For now, this is always `submit_tool_outputs`. * @param RunObjectRequiredActionSubmitToolOutputs $submitToolOutputs Details on the tool outputs needed for this run to continue. + * @param string $type For now, this is always `submit_tool_outputs`. */ - public function __construct($type = null, $submitToolOutputs = null) + public function __construct($submitToolOutputs = null, $type = null) { - if ($type !== null) { - $this->setType($type); - } if ($submitToolOutputs !== null) { $this->setSubmitToolOutputs($submitToolOutputs); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/RunStepDetailsMessageCreationObject.php b/generated/Model/RunStepDetailsMessageCreationObject.php index 2e96b4a..a60491f 100644 --- a/generated/Model/RunStepDetailsMessageCreationObject.php +++ b/generated/Model/RunStepDetailsMessageCreationObject.php @@ -13,22 +13,22 @@ class RunStepDetailsMessageCreationObject extends ArrayObject /** * Always `message_creation`. */ - protected ?string $type = null; + protected string $type = 'message_creation'; protected ?RunStepDetailsMessageCreationObjectMessageCreation $messageCreation = null; /** - * @param string $type Always `message_creation`. * @param RunStepDetailsMessageCreationObjectMessageCreation $messageCreation + * @param string $type Always `message_creation`. */ - public function __construct($type = null, $messageCreation = null) + public function __construct($messageCreation = null, $type = null) { - if ($type !== null) { - $this->setType($type); - } if ($messageCreation !== null) { $this->setMessageCreation($messageCreation); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/RunStepDetailsToolCallsCodeObject.php b/generated/Model/RunStepDetailsToolCallsCodeObject.php index be42e13..a7c7d22 100644 --- a/generated/Model/RunStepDetailsToolCallsCodeObject.php +++ b/generated/Model/RunStepDetailsToolCallsCodeObject.php @@ -18,7 +18,7 @@ class RunStepDetailsToolCallsCodeObject extends ArrayObject /** * The type of tool call. This is always going to be `code_interpreter` for this type of tool call. */ - protected ?string $type = null; + protected string $type = 'code_interpreter'; /** * The Code Interpreter tool call definition. @@ -27,20 +27,20 @@ class RunStepDetailsToolCallsCodeObject extends ArrayObject /** * @param string $id The ID of the tool call. - * @param string $type The type of tool call. This is always going to be `code_interpreter` for this type of tool call. * @param RunStepDetailsToolCallsCodeObjectCodeInterpreter $codeInterpreter The Code Interpreter tool call definition. + * @param string $type The type of tool call. This is always going to be `code_interpreter` for this type of tool call. */ - public function __construct($id = null, $type = null, $codeInterpreter = null) + public function __construct($id = null, $codeInterpreter = null, $type = null) { if ($id !== null) { $this->setId($id); } - if ($type !== null) { - $this->setType($type); - } if ($codeInterpreter !== null) { $this->setCodeInterpreter($codeInterpreter); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/RunStepDetailsToolCallsCodeOutputImageObject.php b/generated/Model/RunStepDetailsToolCallsCodeOutputImageObject.php index 75f7931..0fe495c 100644 --- a/generated/Model/RunStepDetailsToolCallsCodeOutputImageObject.php +++ b/generated/Model/RunStepDetailsToolCallsCodeOutputImageObject.php @@ -13,22 +13,22 @@ class RunStepDetailsToolCallsCodeOutputImageObject extends ArrayObject /** * Always `image`. */ - protected ?string $type = null; + protected string $type = 'image'; protected ?RunStepDetailsToolCallsCodeOutputImageObjectImage $image = null; /** - * @param string $type Always `image`. * @param RunStepDetailsToolCallsCodeOutputImageObjectImage $image + * @param string $type Always `image`. */ - public function __construct($type = null, $image = null) + public function __construct($image = null, $type = null) { - if ($type !== null) { - $this->setType($type); - } if ($image !== null) { $this->setImage($image); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/RunStepDetailsToolCallsCodeOutputLogsObject.php b/generated/Model/RunStepDetailsToolCallsCodeOutputLogsObject.php index d48258d..6bd8d8d 100644 --- a/generated/Model/RunStepDetailsToolCallsCodeOutputLogsObject.php +++ b/generated/Model/RunStepDetailsToolCallsCodeOutputLogsObject.php @@ -13,7 +13,7 @@ class RunStepDetailsToolCallsCodeOutputLogsObject extends ArrayObject /** * Always `logs`. */ - protected ?string $type = null; + protected string $type = 'logs'; /** * The text output from the Code Interpreter tool call. @@ -21,17 +21,17 @@ class RunStepDetailsToolCallsCodeOutputLogsObject extends ArrayObject protected ?string $logs = null; /** - * @param string $type Always `logs`. * @param string $logs The text output from the Code Interpreter tool call. + * @param string $type Always `logs`. */ - public function __construct($type = null, $logs = null) + public function __construct($logs = null, $type = null) { - if ($type !== null) { - $this->setType($type); - } if ($logs !== null) { $this->setLogs($logs); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/RunStepDetailsToolCallsFunctionObject.php b/generated/Model/RunStepDetailsToolCallsFunctionObject.php index 62e58bb..7938095 100644 --- a/generated/Model/RunStepDetailsToolCallsFunctionObject.php +++ b/generated/Model/RunStepDetailsToolCallsFunctionObject.php @@ -18,7 +18,7 @@ class RunStepDetailsToolCallsFunctionObject extends ArrayObject /** * The type of tool call. This is always going to be `function` for this type of tool call. */ - protected ?string $type = null; + protected string $type = 'function'; /** * The definition of the function that was called. @@ -27,20 +27,20 @@ class RunStepDetailsToolCallsFunctionObject extends ArrayObject /** * @param string $id The ID of the tool call object. - * @param string $type The type of tool call. This is always going to be `function` for this type of tool call. * @param RunStepDetailsToolCallsFunctionObjectFunction $function The definition of the function that was called. + * @param string $type The type of tool call. This is always going to be `function` for this type of tool call. */ - public function __construct($id = null, $type = null, $function = null) + public function __construct($id = null, $function = null, $type = null) { if ($id !== null) { $this->setId($id); } - if ($type !== null) { - $this->setType($type); - } if ($function !== null) { $this->setFunction($function); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/RunStepDetailsToolCallsObject.php b/generated/Model/RunStepDetailsToolCallsObject.php index 77847e6..b6faef9 100644 --- a/generated/Model/RunStepDetailsToolCallsObject.php +++ b/generated/Model/RunStepDetailsToolCallsObject.php @@ -13,7 +13,7 @@ class RunStepDetailsToolCallsObject extends ArrayObject /** * Always `tool_calls`. */ - protected ?string $type = null; + protected string $type = 'tool_calls'; /** * An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `retrieval`, or `function`. @@ -23,17 +23,17 @@ class RunStepDetailsToolCallsObject extends ArrayObject protected ?array $toolCalls = null; /** - * @param string $type Always `tool_calls`. * @param array[] $toolCalls An array of tool calls the run step was involved in. These can be associated with one of three types of tools: `code_interpreter`, `retrieval`, or `function`. + * @param string $type Always `tool_calls`. */ - public function __construct($type = null, $toolCalls = null) + public function __construct($toolCalls = null, $type = null) { - if ($type !== null) { - $this->setType($type); - } if ($toolCalls !== null) { $this->setToolCalls($toolCalls); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/RunStepDetailsToolCallsRetrievalObject.php b/generated/Model/RunStepDetailsToolCallsRetrievalObject.php index 99eb9f3..9129929 100644 --- a/generated/Model/RunStepDetailsToolCallsRetrievalObject.php +++ b/generated/Model/RunStepDetailsToolCallsRetrievalObject.php @@ -18,7 +18,7 @@ class RunStepDetailsToolCallsRetrievalObject extends ArrayObject /** * The type of tool call. This is always going to be `retrieval` for this type of tool call. */ - protected ?string $type = null; + protected string $type = 'retrieval'; /** * For now, this is always going to be an empty object. @@ -29,20 +29,20 @@ class RunStepDetailsToolCallsRetrievalObject extends ArrayObject /** * @param string $id The ID of the tool call object. - * @param string $type The type of tool call. This is always going to be `retrieval` for this type of tool call. * @param array $retrieval For now, this is always going to be an empty object. + * @param string $type The type of tool call. This is always going to be `retrieval` for this type of tool call. */ - public function __construct($id = null, $type = null, $retrieval = null) + public function __construct($id = null, $retrieval = null, $type = null) { if ($id !== null) { $this->setId($id); } - if ($type !== null) { - $this->setType($type); - } if ($retrieval !== null) { $this->setRetrieval($retrieval); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/RunStepObject.php b/generated/Model/RunStepObject.php index b8459e7..42d5509 100644 --- a/generated/Model/RunStepObject.php +++ b/generated/Model/RunStepObject.php @@ -18,7 +18,7 @@ class RunStepObject extends ArrayObject /** * The object type, which is always `thread.run.step`. */ - protected ?string $object = null; + protected string $object = 'thread.run.step'; /** * The Unix timestamp (in seconds) for when the run step was created. @@ -91,7 +91,6 @@ class RunStepObject extends ArrayObject /** * @param string $id The identifier of the run step, which can be referenced in API endpoints. - * @param string $object The object type, which is always `thread.run.step`. * @param int $createdAt The Unix timestamp (in seconds) for when the run step was created. * @param string $assistantId The ID of the [assistant](/docs/api-reference/assistants) associated with the run step. * @param string $threadId The ID of the [thread](/docs/api-reference/threads) that was run. @@ -105,15 +104,13 @@ class RunStepObject extends ArrayObject * @param int|null $failedAt The Unix timestamp (in seconds) for when the run step failed. * @param int|null $completedAt The Unix timestamp (in seconds) for when the run step completed. * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * @param string $object The object type, which is always `thread.run.step`. */ - public function __construct($id = null, $object = null, $createdAt = null, $assistantId = null, $threadId = null, $runId = null, $type = null, $status = null, $stepDetails = null, $lastError = null, $expiredAt = null, $cancelledAt = null, $failedAt = null, $completedAt = null, $metadata = null) + public function __construct($id = null, $createdAt = null, $assistantId = null, $threadId = null, $runId = null, $type = null, $status = null, $stepDetails = null, $lastError = null, $expiredAt = null, $cancelledAt = null, $failedAt = null, $completedAt = null, $metadata = null, $object = null) { if ($id !== null) { $this->setId($id); } - if ($object !== null) { - $this->setObject($object); - } if ($createdAt !== null) { $this->setCreatedAt($createdAt); } @@ -153,6 +150,9 @@ public function __construct($id = null, $object = null, $createdAt = null, $assi if ($metadata !== null) { $this->setMetadata($metadata); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool diff --git a/generated/Model/RunToolCallObject.php b/generated/Model/RunToolCallObject.php index 8b793f5..bcec652 100644 --- a/generated/Model/RunToolCallObject.php +++ b/generated/Model/RunToolCallObject.php @@ -18,7 +18,7 @@ class RunToolCallObject extends ArrayObject /** * The type of tool call the output is required for. For now, this is always `function`. */ - protected ?string $type = null; + protected string $type = 'function'; /** * The function definition. @@ -27,20 +27,20 @@ class RunToolCallObject extends ArrayObject /** * @param string $id The ID of the tool call. This ID must be referenced when you submit the tool outputs in using the [Submit tool outputs to run](/docs/api-reference/runs/submitToolOutputs) endpoint. - * @param string $type The type of tool call the output is required for. For now, this is always `function`. * @param RunToolCallObjectFunction $function The function definition. + * @param string $type The type of tool call the output is required for. For now, this is always `function`. */ - public function __construct($id = null, $type = null, $function = null) + public function __construct($id = null, $function = null, $type = null) { if ($id !== null) { $this->setId($id); } - if ($type !== null) { - $this->setType($type); - } if ($function !== null) { $this->setFunction($function); } + if ($type !== null) { + $this->setType($type); + } } public function isInitialized($property): bool diff --git a/generated/Model/ThreadObject.php b/generated/Model/ThreadObject.php index 71961a4..cf66389 100644 --- a/generated/Model/ThreadObject.php +++ b/generated/Model/ThreadObject.php @@ -18,7 +18,7 @@ class ThreadObject extends ArrayObject /** * The object type, which is always `thread`. */ - protected ?string $object = null; + protected string $object = 'thread'; /** * The Unix timestamp (in seconds) for when the thread was created. @@ -34,24 +34,24 @@ class ThreadObject extends ArrayObject /** * @param string $id The identifier, which can be referenced in API endpoints. - * @param string $object The object type, which is always `thread`. * @param int $createdAt The Unix timestamp (in seconds) for when the thread was created. * @param array|null $metadata Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format. Keys can be a maximum of 64 characters long and values can be a maxium of 512 characters long. + * @param string $object The object type, which is always `thread`. */ - public function __construct($id = null, $object = null, $createdAt = null, $metadata = null) + public function __construct($id = null, $createdAt = null, $metadata = null, $object = null) { if ($id !== null) { $this->setId($id); } - if ($object !== null) { - $this->setObject($object); - } if ($createdAt !== null) { $this->setCreatedAt($createdAt); } if ($metadata !== null) { $this->setMetadata($metadata); } + if ($object !== null) { + $this->setObject($object); + } } public function isInitialized($property): bool diff --git a/generated/Normalizer/AssistantFileObjectNormalizer.php b/generated/Normalizer/AssistantFileObjectNormalizer.php index 80bbd53..63fc8fb 100644 --- a/generated/Normalizer/AssistantFileObjectNormalizer.php +++ b/generated/Normalizer/AssistantFileObjectNormalizer.php @@ -52,10 +52,6 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('created_at', $data)) { $object->setCreatedAt($data['created_at']); unset($data['created_at']); @@ -64,6 +60,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setAssistantId($data['assistant_id']); unset($data['assistant_id']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -79,9 +79,9 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['object'] = $object->getObject(); $data['created_at'] = $object->getCreatedAt(); $data['assistant_id'] = $object->getAssistantId(); + $data['object'] = $object->getObject(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/AssistantObjectNormalizer.php b/generated/Normalizer/AssistantObjectNormalizer.php index bae6d07..767934c 100644 --- a/generated/Normalizer/AssistantObjectNormalizer.php +++ b/generated/Normalizer/AssistantObjectNormalizer.php @@ -7,6 +7,9 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; use Sourceability\OpenAIClient\Generated\Model\AssistantObject; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsCode; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsFunction; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsRetrieval; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; use Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface; @@ -52,10 +55,6 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('created_at', $data)) { $object->setCreatedAt($data['created_at']); unset($data['created_at']); @@ -82,35 +81,47 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('instructions', $data) && $data['instructions'] === null) { $object->setInstructions(null); } + if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { + $values = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['metadata'] as $key => $value) { + $values[$key] = $value; + } + $object->setMetadata($values); + unset($data['metadata']); + } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { + $object->setMetadata(null); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } if (\array_key_exists('tools', $data)) { - $values = []; - foreach ($data['tools'] as $value) { - $values[] = $value; + $values_1 = []; + foreach ($data['tools'] as $value_1) { + $value_2 = $value_1; + if (is_array($value_1) and (isset($value_1['type']) and $value_1['type'] === 'code_interpreter')) { + $value_2 = $this->denormalizer->denormalize($value_1, AssistantToolsCode::class, 'json', $context); + } elseif (is_array($value_1) and (isset($value_1['type']) and $value_1['type'] === 'retrieval')) { + $value_2 = $this->denormalizer->denormalize($value_1, AssistantToolsRetrieval::class, 'json', $context); + } elseif (is_array($value_1) and (isset($value_1['type']) and $value_1['type'] === 'function') and isset($value_1['function'])) { + $value_2 = $this->denormalizer->denormalize($value_1, AssistantToolsFunction::class, 'json', $context); + } + $values_1[] = $value_2; } - $object->setTools($values); + $object->setTools($values_1); unset($data['tools']); } if (\array_key_exists('file_ids', $data)) { - $values_1 = []; - foreach ($data['file_ids'] as $value_1) { - $values_1[] = $value_1; + $values_2 = []; + foreach ($data['file_ids'] as $value_3) { + $values_2[] = $value_3; } - $object->setFileIds($values_1); + $object->setFileIds($values_2); unset($data['file_ids']); } - if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { - $values_2 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - foreach ($data['metadata'] as $key => $value_2) { - $values_2[$key] = $value_2; - } - $object->setMetadata($values_2); - unset($data['metadata']); - } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { - $object->setMetadata(null); - } - foreach ($data as $key_1 => $value_3) { + foreach ($data as $key_1 => $value_4) { if (preg_match('/.*/', (string) $key_1)) { - $object[$key_1] = $value_3; + $object[$key_1] = $value_4; } } return $object; @@ -123,30 +134,38 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['object'] = $object->getObject(); $data['created_at'] = $object->getCreatedAt(); $data['name'] = $object->getName(); $data['description'] = $object->getDescription(); $data['model'] = $object->getModel(); $data['instructions'] = $object->getInstructions(); $values = []; - foreach ($object->getTools() as $value) { - $values[] = $value; + foreach ($object->getMetadata() as $key => $value) { + $values[$key] = $value; } - $data['tools'] = $values; + $data['metadata'] = $values; + $data['object'] = $object->getObject(); $values_1 = []; - foreach ($object->getFileIds() as $value_1) { - $values_1[] = $value_1; + foreach ($object->getTools() as $value_1) { + $value_2 = $value_1; + if (is_object($value_1)) { + $value_2 = $this->normalizer->normalize($value_1, 'json', $context); + } elseif (is_object($value_1)) { + $value_2 = $this->normalizer->normalize($value_1, 'json', $context); + } elseif (is_object($value_1)) { + $value_2 = $this->normalizer->normalize($value_1, 'json', $context); + } + $values_1[] = $value_2; } - $data['file_ids'] = $values_1; + $data['tools'] = $values_1; $values_2 = []; - foreach ($object->getMetadata() as $key => $value_2) { - $values_2[$key] = $value_2; + foreach ($object->getFileIds() as $value_3) { + $values_2[] = $value_3; } - $data['metadata'] = $values_2; - foreach ($object as $key_1 => $value_3) { + $data['file_ids'] = $values_2; + foreach ($object as $key_1 => $value_4) { if (preg_match('/.*/', (string) $key_1)) { - $data[$key_1] = $value_3; + $data[$key_1] = $value_4; } } return $data; diff --git a/generated/Normalizer/AssistantToolsFunctionNormalizer.php b/generated/Normalizer/AssistantToolsFunctionNormalizer.php index 372de91..7eab250 100644 --- a/generated/Normalizer/AssistantToolsFunctionNormalizer.php +++ b/generated/Normalizer/AssistantToolsFunctionNormalizer.php @@ -49,14 +49,14 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('function', $data)) { $object->setFunction($this->denormalizer->denormalize($data['function'], FunctionObject::class, 'json', $context)); unset($data['function']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -71,8 +71,8 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['type'] = $object->getType(); $data['function'] = $this->normalizer->normalize($object->getFunction(), 'json', $context); + $data['type'] = $object->getType(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/ChatCompletionMessageToolCallChunkNormalizer.php b/generated/Normalizer/ChatCompletionMessageToolCallChunkNormalizer.php index ed56ec9..fb2221e 100644 --- a/generated/Normalizer/ChatCompletionMessageToolCallChunkNormalizer.php +++ b/generated/Normalizer/ChatCompletionMessageToolCallChunkNormalizer.php @@ -57,14 +57,14 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('function', $data)) { $object->setFunction($this->denormalizer->denormalize($data['function'], ChatCompletionMessageToolCallChunkFunction::class, 'json', $context)); unset($data['function']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -83,12 +83,12 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('id') && $object->getId() !== null) { $data['id'] = $object->getId(); } - if ($object->isInitialized('type') && $object->getType() !== null) { - $data['type'] = $object->getType(); - } if ($object->isInitialized('function') && $object->getFunction() !== null) { $data['function'] = $this->normalizer->normalize($object->getFunction(), 'json', $context); } + if ($object->isInitialized('type') && $object->getType() !== null) { + $data['type'] = $object->getType(); + } foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/ChatCompletionMessageToolCallNormalizer.php b/generated/Normalizer/ChatCompletionMessageToolCallNormalizer.php index 157540c..ad369f6 100644 --- a/generated/Normalizer/ChatCompletionMessageToolCallNormalizer.php +++ b/generated/Normalizer/ChatCompletionMessageToolCallNormalizer.php @@ -53,14 +53,14 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('function', $data)) { $object->setFunction($this->denormalizer->denormalize($data['function'], ChatCompletionMessageToolCallFunction::class, 'json', $context)); unset($data['function']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -76,8 +76,8 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['type'] = $object->getType(); $data['function'] = $this->normalizer->normalize($object->getFunction(), 'json', $context); + $data['type'] = $object->getType(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/ChatCompletionNamedToolChoiceNormalizer.php b/generated/Normalizer/ChatCompletionNamedToolChoiceNormalizer.php index 6042426..0735462 100644 --- a/generated/Normalizer/ChatCompletionNamedToolChoiceNormalizer.php +++ b/generated/Normalizer/ChatCompletionNamedToolChoiceNormalizer.php @@ -49,14 +49,14 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('function', $data)) { $object->setFunction($this->denormalizer->denormalize($data['function'], ChatCompletionNamedToolChoiceFunction::class, 'json', $context)); unset($data['function']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -71,8 +71,8 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['type'] = $object->getType(); $data['function'] = $this->normalizer->normalize($object->getFunction(), 'json', $context); + $data['type'] = $object->getType(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/ChatCompletionRequestAssistantMessageNormalizer.php b/generated/Normalizer/ChatCompletionRequestAssistantMessageNormalizer.php index 71bdd09..f3fa155 100644 --- a/generated/Normalizer/ChatCompletionRequestAssistantMessageNormalizer.php +++ b/generated/Normalizer/ChatCompletionRequestAssistantMessageNormalizer.php @@ -56,10 +56,6 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('content', $data) && $data['content'] === null) { $object->setContent(null); } - if (\array_key_exists('role', $data)) { - $object->setRole($data['role']); - unset($data['role']); - } if (\array_key_exists('name', $data)) { $object->setName($data['name']); unset($data['name']); @@ -76,6 +72,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setFunctionCall($this->denormalizer->denormalize($data['function_call'], ChatCompletionRequestAssistantMessageFunctionCall::class, 'json', $context)); unset($data['function_call']); } + if (\array_key_exists('role', $data)) { + $object->setRole($data['role']); + unset($data['role']); + } foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value_1; @@ -93,7 +93,6 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('content') && $object->getContent() !== null) { $data['content'] = $object->getContent(); } - $data['role'] = $object->getRole(); if ($object->isInitialized('name') && $object->getName() !== null) { $data['name'] = $object->getName(); } @@ -107,6 +106,7 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('functionCall') && $object->getFunctionCall() !== null) { $data['function_call'] = $this->normalizer->normalize($object->getFunctionCall(), 'json', $context); } + $data['role'] = $object->getRole(); foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value_1; diff --git a/generated/Normalizer/ChatCompletionRequestFunctionMessageNormalizer.php b/generated/Normalizer/ChatCompletionRequestFunctionMessageNormalizer.php index 9e2cc89..d3080bc 100644 --- a/generated/Normalizer/ChatCompletionRequestFunctionMessageNormalizer.php +++ b/generated/Normalizer/ChatCompletionRequestFunctionMessageNormalizer.php @@ -48,10 +48,6 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('role', $data)) { - $object->setRole($data['role']); - unset($data['role']); - } if (\array_key_exists('content', $data) && $data['content'] !== null) { $object->setContent($data['content']); unset($data['content']); @@ -62,6 +58,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setName($data['name']); unset($data['name']); } + if (\array_key_exists('role', $data)) { + $object->setRole($data['role']); + unset($data['role']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -76,9 +76,9 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['role'] = $object->getRole(); $data['content'] = $object->getContent(); $data['name'] = $object->getName(); + $data['role'] = $object->getRole(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/ChatCompletionRequestMessageContentPartImageNormalizer.php b/generated/Normalizer/ChatCompletionRequestMessageContentPartImageNormalizer.php index 354755f..30e6b4d 100644 --- a/generated/Normalizer/ChatCompletionRequestMessageContentPartImageNormalizer.php +++ b/generated/Normalizer/ChatCompletionRequestMessageContentPartImageNormalizer.php @@ -49,14 +49,14 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('image_url', $data)) { $object->setImageUrl($this->denormalizer->denormalize($data['image_url'], ChatCompletionRequestMessageContentPartImageImageUrl::class, 'json', $context)); unset($data['image_url']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -71,8 +71,8 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['type'] = $object->getType(); $data['image_url'] = $this->normalizer->normalize($object->getImageUrl(), 'json', $context); + $data['type'] = $object->getType(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/ChatCompletionRequestMessageContentPartTextNormalizer.php b/generated/Normalizer/ChatCompletionRequestMessageContentPartTextNormalizer.php index 38c2f73..a2ff8af 100644 --- a/generated/Normalizer/ChatCompletionRequestMessageContentPartTextNormalizer.php +++ b/generated/Normalizer/ChatCompletionRequestMessageContentPartTextNormalizer.php @@ -48,14 +48,14 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('text', $data)) { $object->setText($data['text']); unset($data['text']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -70,8 +70,8 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['type'] = $object->getType(); $data['text'] = $object->getText(); + $data['type'] = $object->getType(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/ChatCompletionRequestSystemMessageNormalizer.php b/generated/Normalizer/ChatCompletionRequestSystemMessageNormalizer.php index 6911393..dd5a558 100644 --- a/generated/Normalizer/ChatCompletionRequestSystemMessageNormalizer.php +++ b/generated/Normalizer/ChatCompletionRequestSystemMessageNormalizer.php @@ -52,14 +52,14 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setContent($data['content']); unset($data['content']); } - if (\array_key_exists('role', $data)) { - $object->setRole($data['role']); - unset($data['role']); - } if (\array_key_exists('name', $data)) { $object->setName($data['name']); unset($data['name']); } + if (\array_key_exists('role', $data)) { + $object->setRole($data['role']); + unset($data['role']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -75,10 +75,10 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['content'] = $object->getContent(); - $data['role'] = $object->getRole(); if ($object->isInitialized('name') && $object->getName() !== null) { $data['name'] = $object->getName(); } + $data['role'] = $object->getRole(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/ChatCompletionRequestToolMessageNormalizer.php b/generated/Normalizer/ChatCompletionRequestToolMessageNormalizer.php index 558bcc7..8c936bd 100644 --- a/generated/Normalizer/ChatCompletionRequestToolMessageNormalizer.php +++ b/generated/Normalizer/ChatCompletionRequestToolMessageNormalizer.php @@ -48,10 +48,6 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('role', $data)) { - $object->setRole($data['role']); - unset($data['role']); - } if (\array_key_exists('content', $data)) { $object->setContent($data['content']); unset($data['content']); @@ -60,6 +56,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setToolCallId($data['tool_call_id']); unset($data['tool_call_id']); } + if (\array_key_exists('role', $data)) { + $object->setRole($data['role']); + unset($data['role']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -74,9 +74,9 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['role'] = $object->getRole(); $data['content'] = $object->getContent(); $data['tool_call_id'] = $object->getToolCallId(); + $data['role'] = $object->getRole(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/ChatCompletionRequestUserMessageNormalizer.php b/generated/Normalizer/ChatCompletionRequestUserMessageNormalizer.php index d672299..604f0e6 100644 --- a/generated/Normalizer/ChatCompletionRequestUserMessageNormalizer.php +++ b/generated/Normalizer/ChatCompletionRequestUserMessageNormalizer.php @@ -6,6 +6,8 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestMessageContentPartImage; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestMessageContentPartText; use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestUserMessage; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; @@ -49,20 +51,36 @@ public function denormalize($data, $class, $format = null, array $context = []) return $object; } if (\array_key_exists('content', $data)) { - $object->setContent($data['content']); + $value = $data['content']; + if (is_string($data['content'])) { + $value = $data['content']; + } elseif (is_array($data['content']) && $this->isOnlyNumericKeys($data['content'])) { + $values = []; + foreach ($data['content'] as $value_1) { + $value_2 = $value_1; + if (is_array($value_1) and (isset($value_1['type']) and $value_1['type'] === 'text') and isset($value_1['text'])) { + $value_2 = $this->denormalizer->denormalize($value_1, ChatCompletionRequestMessageContentPartText::class, 'json', $context); + } elseif (is_array($value_1) and (isset($value_1['type']) and $value_1['type'] === 'image_url') and isset($value_1['image_url'])) { + $value_2 = $this->denormalizer->denormalize($value_1, ChatCompletionRequestMessageContentPartImage::class, 'json', $context); + } + $values[] = $value_2; + } + $value = $values; + } + $object->setContent($value); unset($data['content']); } - if (\array_key_exists('role', $data)) { - $object->setRole($data['role']); - unset($data['role']); - } if (\array_key_exists('name', $data)) { $object->setName($data['name']); unset($data['name']); } - foreach ($data as $key => $value) { + if (\array_key_exists('role', $data)) { + $object->setRole($data['role']); + unset($data['role']); + } + foreach ($data as $key => $value_3) { if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + $object[$key] = $value_3; } } return $object; @@ -74,14 +92,30 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['content'] = $object->getContent(); - $data['role'] = $object->getRole(); + $value = $object->getContent(); + if (is_string($object->getContent())) { + $value = $object->getContent(); + } elseif (is_array($object->getContent())) { + $values = []; + foreach ($object->getContent() as $value_1) { + $value_2 = $value_1; + if (is_object($value_1)) { + $value_2 = $this->normalizer->normalize($value_1, 'json', $context); + } elseif (is_object($value_1)) { + $value_2 = $this->normalizer->normalize($value_1, 'json', $context); + } + $values[] = $value_2; + } + $value = $values; + } + $data['content'] = $value; if ($object->isInitialized('name') && $object->getName() !== null) { $data['name'] = $object->getName(); } - foreach ($object as $key => $value) { + $data['role'] = $object->getRole(); + foreach ($object as $key => $value_3) { if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + $data[$key] = $value_3; } } return $data; diff --git a/generated/Normalizer/ChatCompletionResponseMessageNormalizer.php b/generated/Normalizer/ChatCompletionResponseMessageNormalizer.php index aeb9462..e139c57 100644 --- a/generated/Normalizer/ChatCompletionResponseMessageNormalizer.php +++ b/generated/Normalizer/ChatCompletionResponseMessageNormalizer.php @@ -64,14 +64,14 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setToolCalls($values); unset($data['tool_calls']); } - if (\array_key_exists('role', $data)) { - $object->setRole($data['role']); - unset($data['role']); - } if (\array_key_exists('function_call', $data)) { $object->setFunctionCall($this->denormalizer->denormalize($data['function_call'], ChatCompletionResponseMessageFunctionCall::class, 'json', $context)); unset($data['function_call']); } + if (\array_key_exists('role', $data)) { + $object->setRole($data['role']); + unset($data['role']); + } foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value_1; @@ -94,10 +94,10 @@ public function normalize($object, $format = null, array $context = []) } $data['tool_calls'] = $values; } - $data['role'] = $object->getRole(); if ($object->isInitialized('functionCall') && $object->getFunctionCall() !== null) { $data['function_call'] = $this->normalizer->normalize($object->getFunctionCall(), 'json', $context); } + $data['role'] = $object->getRole(); foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value_1; diff --git a/generated/Normalizer/ChatCompletionToolNormalizer.php b/generated/Normalizer/ChatCompletionToolNormalizer.php index f322eac..e6de539 100644 --- a/generated/Normalizer/ChatCompletionToolNormalizer.php +++ b/generated/Normalizer/ChatCompletionToolNormalizer.php @@ -49,14 +49,14 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('function', $data)) { $object->setFunction($this->denormalizer->denormalize($data['function'], FunctionObject::class, 'json', $context)); unset($data['function']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -71,8 +71,8 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['type'] = $object->getType(); $data['function'] = $this->normalizer->normalize($object->getFunction(), 'json', $context); + $data['type'] = $object->getType(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/CreateAssistantRequestNormalizer.php b/generated/Normalizer/CreateAssistantRequestNormalizer.php index 8db6689..1478d13 100644 --- a/generated/Normalizer/CreateAssistantRequestNormalizer.php +++ b/generated/Normalizer/CreateAssistantRequestNormalizer.php @@ -6,6 +6,9 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsCode; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsFunction; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsRetrieval; use Sourceability\OpenAIClient\Generated\Model\CreateAssistantRequest; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; @@ -49,7 +52,11 @@ public function denormalize($data, $class, $format = null, array $context = []) return $object; } if (\array_key_exists('model', $data)) { - $object->setModel($data['model']); + $value = $data['model']; + if (is_string($data['model'])) { + $value = $data['model']; + } + $object->setModel($value); } if (\array_key_exists('name', $data) && $data['name'] !== null) { $object->setName($data['name']); @@ -66,28 +73,36 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('instructions', $data) && $data['instructions'] === null) { $object->setInstructions(null); } - if (\array_key_exists('tools', $data)) { - $values = []; - foreach ($data['tools'] as $value) { - $values[] = $value; + if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { + $values = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['metadata'] as $key => $value_1) { + $values[$key] = $value_1; } - $object->setTools($values); + $object->setMetadata($values); + } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { + $object->setMetadata(null); } - if (\array_key_exists('file_ids', $data)) { + if (\array_key_exists('tools', $data)) { $values_1 = []; - foreach ($data['file_ids'] as $value_1) { - $values_1[] = $value_1; + foreach ($data['tools'] as $value_2) { + $value_3 = $value_2; + if (is_array($value_2) and (isset($value_2['type']) and $value_2['type'] === 'code_interpreter')) { + $value_3 = $this->denormalizer->denormalize($value_2, AssistantToolsCode::class, 'json', $context); + } elseif (is_array($value_2) and (isset($value_2['type']) and $value_2['type'] === 'retrieval')) { + $value_3 = $this->denormalizer->denormalize($value_2, AssistantToolsRetrieval::class, 'json', $context); + } elseif (is_array($value_2) and (isset($value_2['type']) and $value_2['type'] === 'function') and isset($value_2['function'])) { + $value_3 = $this->denormalizer->denormalize($value_2, AssistantToolsFunction::class, 'json', $context); + } + $values_1[] = $value_3; } - $object->setFileIds($values_1); + $object->setTools($values_1); } - if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { - $values_2 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - foreach ($data['metadata'] as $key => $value_2) { - $values_2[$key] = $value_2; + if (\array_key_exists('file_ids', $data)) { + $values_2 = []; + foreach ($data['file_ids'] as $value_4) { + $values_2[] = $value_4; } - $object->setMetadata($values_2); - } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { - $object->setMetadata(null); + $object->setFileIds($values_2); } return $object; } @@ -98,7 +113,11 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['model'] = $object->getModel(); + $value = $object->getModel(); + if (is_string($object->getModel())) { + $value = $object->getModel(); + } + $data['model'] = $value; if ($object->isInitialized('name') && $object->getName() !== null) { $data['name'] = $object->getName(); } @@ -108,26 +127,34 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('instructions') && $object->getInstructions() !== null) { $data['instructions'] = $object->getInstructions(); } - if ($object->isInitialized('tools') && $object->getTools() !== null) { + if ($object->isInitialized('metadata') && $object->getMetadata() !== null) { $values = []; - foreach ($object->getTools() as $value) { - $values[] = $value; + foreach ($object->getMetadata() as $key => $value_1) { + $values[$key] = $value_1; } - $data['tools'] = $values; + $data['metadata'] = $values; } - if ($object->isInitialized('fileIds') && $object->getFileIds() !== null) { + if ($object->isInitialized('tools') && $object->getTools() !== null) { $values_1 = []; - foreach ($object->getFileIds() as $value_1) { - $values_1[] = $value_1; + foreach ($object->getTools() as $value_2) { + $value_3 = $value_2; + if (is_object($value_2)) { + $value_3 = $this->normalizer->normalize($value_2, 'json', $context); + } elseif (is_object($value_2)) { + $value_3 = $this->normalizer->normalize($value_2, 'json', $context); + } elseif (is_object($value_2)) { + $value_3 = $this->normalizer->normalize($value_2, 'json', $context); + } + $values_1[] = $value_3; } - $data['file_ids'] = $values_1; + $data['tools'] = $values_1; } - if ($object->isInitialized('metadata') && $object->getMetadata() !== null) { + if ($object->isInitialized('fileIds') && $object->getFileIds() !== null) { $values_2 = []; - foreach ($object->getMetadata() as $key => $value_2) { - $values_2[$key] = $value_2; + foreach ($object->getFileIds() as $value_4) { + $values_2[] = $value_4; } - $data['metadata'] = $values_2; + $data['file_ids'] = $values_2; } return $data; } diff --git a/generated/Normalizer/CreateChatCompletionFunctionResponseNormalizer.php b/generated/Normalizer/CreateChatCompletionFunctionResponseNormalizer.php index db8f68a..c38d678 100644 --- a/generated/Normalizer/CreateChatCompletionFunctionResponseNormalizer.php +++ b/generated/Normalizer/CreateChatCompletionFunctionResponseNormalizer.php @@ -74,14 +74,14 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setSystemFingerprint($data['system_fingerprint']); unset($data['system_fingerprint']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('usage', $data)) { $object->setUsage($this->denormalizer->denormalize($data['usage'], CompletionUsage::class, 'json', $context)); unset($data['usage']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value_1; @@ -107,10 +107,10 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('systemFingerprint') && $object->getSystemFingerprint() !== null) { $data['system_fingerprint'] = $object->getSystemFingerprint(); } - $data['object'] = $object->getObject(); if ($object->isInitialized('usage') && $object->getUsage() !== null) { $data['usage'] = $this->normalizer->normalize($object->getUsage(), 'json', $context); } + $data['object'] = $object->getObject(); foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value_1; diff --git a/generated/Normalizer/CreateChatCompletionRequestNormalizer.php b/generated/Normalizer/CreateChatCompletionRequestNormalizer.php index b985268..90172eb 100644 --- a/generated/Normalizer/CreateChatCompletionRequestNormalizer.php +++ b/generated/Normalizer/CreateChatCompletionRequestNormalizer.php @@ -6,7 +6,14 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionFunctionCallOption; use Sourceability\OpenAIClient\Generated\Model\ChatCompletionFunctions; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionNamedToolChoice; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestAssistantMessage; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestFunctionMessage; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestSystemMessage; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestToolMessage; +use Sourceability\OpenAIClient\Generated\Model\ChatCompletionRequestUserMessage; use Sourceability\OpenAIClient\Generated\Model\ChatCompletionTool; use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionRequest; use Sourceability\OpenAIClient\Generated\Model\CreateChatCompletionRequestResponseFormat; @@ -66,37 +73,43 @@ public function denormalize($data, $class, $format = null, array $context = []) if (\array_key_exists('messages', $data)) { $values = []; foreach ($data['messages'] as $value) { - $values[] = $value; + $value_1 = $value; + if (is_array($value) and isset($value['content']) and (isset($value['role']) and $value['role'] === 'system')) { + $value_1 = $this->denormalizer->denormalize($value, ChatCompletionRequestSystemMessage::class, 'json', $context); + } elseif (is_array($value) and isset($value['content']) and (isset($value['role']) and $value['role'] === 'user')) { + $value_1 = $this->denormalizer->denormalize($value, ChatCompletionRequestUserMessage::class, 'json', $context); + } elseif (is_array($value) and (isset($value['role']) and $value['role'] === 'assistant')) { + $value_1 = $this->denormalizer->denormalize($value, ChatCompletionRequestAssistantMessage::class, 'json', $context); + } elseif (is_array($value) and (isset($value['role']) and $value['role'] === 'tool') and isset($value['content']) and isset($value['tool_call_id'])) { + $value_1 = $this->denormalizer->denormalize($value, ChatCompletionRequestToolMessage::class, 'json', $context); + } elseif (is_array($value) and (isset($value['role']) and $value['role'] === 'function') and isset($value['content']) and isset($value['name'])) { + $value_1 = $this->denormalizer->denormalize($value, ChatCompletionRequestFunctionMessage::class, 'json', $context); + } + $values[] = $value_1; } $object->setMessages($values); unset($data['messages']); } if (\array_key_exists('model', $data)) { - $object->setModel($data['model']); + $value_2 = $data['model']; + if (is_string($data['model'])) { + $value_2 = $data['model']; + } elseif (is_string($data['model'])) { + $value_2 = $data['model']; + } + $object->setModel($value_2); unset($data['model']); } - if (\array_key_exists('frequency_penalty', $data) && $data['frequency_penalty'] !== null) { - $object->setFrequencyPenalty($data['frequency_penalty']); - unset($data['frequency_penalty']); - } elseif (\array_key_exists('frequency_penalty', $data) && $data['frequency_penalty'] === null) { - $object->setFrequencyPenalty(null); - } if (\array_key_exists('logit_bias', $data) && $data['logit_bias'] !== null) { $values_1 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - foreach ($data['logit_bias'] as $key => $value_1) { - $values_1[$key] = $value_1; + foreach ($data['logit_bias'] as $key => $value_3) { + $values_1[$key] = $value_3; } $object->setLogitBias($values_1); unset($data['logit_bias']); } elseif (\array_key_exists('logit_bias', $data) && $data['logit_bias'] === null) { $object->setLogitBias(null); } - if (\array_key_exists('logprobs', $data) && $data['logprobs'] !== null) { - $object->setLogprobs($data['logprobs']); - unset($data['logprobs']); - } elseif (\array_key_exists('logprobs', $data) && $data['logprobs'] === null) { - $object->setLogprobs(null); - } if (\array_key_exists('top_logprobs', $data) && $data['top_logprobs'] !== null) { $object->setTopLogprobs($data['top_logprobs']); unset($data['top_logprobs']); @@ -109,18 +122,6 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('max_tokens', $data) && $data['max_tokens'] === null) { $object->setMaxTokens(null); } - if (\array_key_exists('n', $data) && $data['n'] !== null) { - $object->setN($data['n']); - unset($data['n']); - } elseif (\array_key_exists('n', $data) && $data['n'] === null) { - $object->setN(null); - } - if (\array_key_exists('presence_penalty', $data) && $data['presence_penalty'] !== null) { - $object->setPresencePenalty($data['presence_penalty']); - unset($data['presence_penalty']); - } elseif (\array_key_exists('presence_penalty', $data) && $data['presence_penalty'] === null) { - $object->setPresencePenalty(null); - } if (\array_key_exists('response_format', $data)) { $object->setResponseFormat($this->denormalizer->denormalize($data['response_format'], CreateChatCompletionRequestResponseFormat::class, 'json', $context)); unset($data['response_format']); @@ -132,37 +133,35 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setSeed(null); } if (\array_key_exists('stop', $data)) { - $object->setStop($data['stop']); + $value_4 = $data['stop']; + if (is_string($data['stop'])) { + $value_4 = $data['stop']; + } elseif (is_array($data['stop']) && $this->isOnlyNumericKeys($data['stop'])) { + $values_2 = []; + foreach ($data['stop'] as $value_5) { + $values_2[] = $value_5; + } + $value_4 = $values_2; + } + $object->setStop($value_4); unset($data['stop']); } - if (\array_key_exists('stream', $data) && $data['stream'] !== null) { - $object->setStream($data['stream']); - unset($data['stream']); - } elseif (\array_key_exists('stream', $data) && $data['stream'] === null) { - $object->setStream(null); - } - if (\array_key_exists('temperature', $data) && $data['temperature'] !== null) { - $object->setTemperature($data['temperature']); - unset($data['temperature']); - } elseif (\array_key_exists('temperature', $data) && $data['temperature'] === null) { - $object->setTemperature(null); - } - if (\array_key_exists('top_p', $data) && $data['top_p'] !== null) { - $object->setTopP($data['top_p']); - unset($data['top_p']); - } elseif (\array_key_exists('top_p', $data) && $data['top_p'] === null) { - $object->setTopP(null); - } if (\array_key_exists('tools', $data)) { - $values_2 = []; - foreach ($data['tools'] as $value_2) { - $values_2[] = $this->denormalizer->denormalize($value_2, ChatCompletionTool::class, 'json', $context); + $values_3 = []; + foreach ($data['tools'] as $value_6) { + $values_3[] = $this->denormalizer->denormalize($value_6, ChatCompletionTool::class, 'json', $context); } - $object->setTools($values_2); + $object->setTools($values_3); unset($data['tools']); } if (\array_key_exists('tool_choice', $data)) { - $object->setToolChoice($data['tool_choice']); + $value_7 = $data['tool_choice']; + if (is_string($data['tool_choice'])) { + $value_7 = $data['tool_choice']; + } elseif (is_array($data['tool_choice']) and (isset($data['tool_choice']['type']) and $data['tool_choice']['type'] === 'function') and isset($data['tool_choice']['function'])) { + $value_7 = $this->denormalizer->denormalize($data['tool_choice'], ChatCompletionNamedToolChoice::class, 'json', $context); + } + $object->setToolChoice($value_7); unset($data['tool_choice']); } if (\array_key_exists('user', $data)) { @@ -170,20 +169,68 @@ public function denormalize($data, $class, $format = null, array $context = []) unset($data['user']); } if (\array_key_exists('function_call', $data)) { - $object->setFunctionCall($data['function_call']); + $value_8 = $data['function_call']; + if (is_string($data['function_call'])) { + $value_8 = $data['function_call']; + } elseif (is_array($data['function_call']) and isset($data['function_call']['name'])) { + $value_8 = $this->denormalizer->denormalize($data['function_call'], ChatCompletionFunctionCallOption::class, 'json', $context); + } + $object->setFunctionCall($value_8); unset($data['function_call']); } if (\array_key_exists('functions', $data)) { - $values_3 = []; - foreach ($data['functions'] as $value_3) { - $values_3[] = $this->denormalizer->denormalize($value_3, ChatCompletionFunctions::class, 'json', $context); + $values_4 = []; + foreach ($data['functions'] as $value_9) { + $values_4[] = $this->denormalizer->denormalize($value_9, ChatCompletionFunctions::class, 'json', $context); } - $object->setFunctions($values_3); + $object->setFunctions($values_4); unset($data['functions']); } - foreach ($data as $key_1 => $value_4) { + if (\array_key_exists('frequency_penalty', $data) && $data['frequency_penalty'] !== null) { + $object->setFrequencyPenalty($data['frequency_penalty']); + unset($data['frequency_penalty']); + } elseif (\array_key_exists('frequency_penalty', $data) && $data['frequency_penalty'] === null) { + $object->setFrequencyPenalty(null); + } + if (\array_key_exists('logprobs', $data) && $data['logprobs'] !== null) { + $object->setLogprobs($data['logprobs']); + unset($data['logprobs']); + } elseif (\array_key_exists('logprobs', $data) && $data['logprobs'] === null) { + $object->setLogprobs(null); + } + if (\array_key_exists('n', $data) && $data['n'] !== null) { + $object->setN($data['n']); + unset($data['n']); + } elseif (\array_key_exists('n', $data) && $data['n'] === null) { + $object->setN(null); + } + if (\array_key_exists('presence_penalty', $data) && $data['presence_penalty'] !== null) { + $object->setPresencePenalty($data['presence_penalty']); + unset($data['presence_penalty']); + } elseif (\array_key_exists('presence_penalty', $data) && $data['presence_penalty'] === null) { + $object->setPresencePenalty(null); + } + if (\array_key_exists('stream', $data) && $data['stream'] !== null) { + $object->setStream($data['stream']); + unset($data['stream']); + } elseif (\array_key_exists('stream', $data) && $data['stream'] === null) { + $object->setStream(null); + } + if (\array_key_exists('temperature', $data) && $data['temperature'] !== null) { + $object->setTemperature($data['temperature']); + unset($data['temperature']); + } elseif (\array_key_exists('temperature', $data) && $data['temperature'] === null) { + $object->setTemperature(null); + } + if (\array_key_exists('top_p', $data) && $data['top_p'] !== null) { + $object->setTopP($data['top_p']); + unset($data['top_p']); + } elseif (\array_key_exists('top_p', $data) && $data['top_p'] === null) { + $object->setTopP(null); + } + foreach ($data as $key_1 => $value_10) { if (preg_match('/.*/', (string) $key_1)) { - $object[$key_1] = $value_4; + $object[$key_1] = $value_10; } } return $object; @@ -197,35 +244,41 @@ public function normalize($object, $format = null, array $context = []) $data = []; $values = []; foreach ($object->getMessages() as $value) { - $values[] = $value; + $value_1 = $value; + if (is_object($value)) { + $value_1 = $this->normalizer->normalize($value, 'json', $context); + } elseif (is_object($value)) { + $value_1 = $this->normalizer->normalize($value, 'json', $context); + } elseif (is_object($value)) { + $value_1 = $this->normalizer->normalize($value, 'json', $context); + } elseif (is_object($value)) { + $value_1 = $this->normalizer->normalize($value, 'json', $context); + } elseif (is_object($value)) { + $value_1 = $this->normalizer->normalize($value, 'json', $context); + } + $values[] = $value_1; } $data['messages'] = $values; - $data['model'] = $object->getModel(); - if ($object->isInitialized('frequencyPenalty') && $object->getFrequencyPenalty() !== null) { - $data['frequency_penalty'] = $object->getFrequencyPenalty(); + $value_2 = $object->getModel(); + if (is_string($object->getModel())) { + $value_2 = $object->getModel(); + } elseif (is_string($object->getModel())) { + $value_2 = $object->getModel(); } + $data['model'] = $value_2; if ($object->isInitialized('logitBias') && $object->getLogitBias() !== null) { $values_1 = []; - foreach ($object->getLogitBias() as $key => $value_1) { - $values_1[$key] = $value_1; + foreach ($object->getLogitBias() as $key => $value_3) { + $values_1[$key] = $value_3; } $data['logit_bias'] = $values_1; } - if ($object->isInitialized('logprobs') && $object->getLogprobs() !== null) { - $data['logprobs'] = $object->getLogprobs(); - } if ($object->isInitialized('topLogprobs') && $object->getTopLogprobs() !== null) { $data['top_logprobs'] = $object->getTopLogprobs(); } if ($object->isInitialized('maxTokens') && $object->getMaxTokens() !== null) { $data['max_tokens'] = $object->getMaxTokens(); } - if ($object->isInitialized('n') && $object->getN() !== null) { - $data['n'] = $object->getN(); - } - if ($object->isInitialized('presencePenalty') && $object->getPresencePenalty() !== null) { - $data['presence_penalty'] = $object->getPresencePenalty(); - } if ($object->isInitialized('responseFormat') && $object->getResponseFormat() !== null) { $data['response_format'] = $this->normalizer->normalize($object->getResponseFormat(), 'json', $context); } @@ -233,43 +286,77 @@ public function normalize($object, $format = null, array $context = []) $data['seed'] = $object->getSeed(); } if ($object->isInitialized('stop') && $object->getStop() !== null) { - $data['stop'] = $object->getStop(); - } - if ($object->isInitialized('stream') && $object->getStream() !== null) { - $data['stream'] = $object->getStream(); - } - if ($object->isInitialized('temperature') && $object->getTemperature() !== null) { - $data['temperature'] = $object->getTemperature(); - } - if ($object->isInitialized('topP') && $object->getTopP() !== null) { - $data['top_p'] = $object->getTopP(); + $value_4 = $object->getStop(); + if (is_string($object->getStop())) { + $value_4 = $object->getStop(); + } elseif (is_array($object->getStop())) { + $values_2 = []; + foreach ($object->getStop() as $value_5) { + $values_2[] = $value_5; + } + $value_4 = $values_2; + } + $data['stop'] = $value_4; } if ($object->isInitialized('tools') && $object->getTools() !== null) { - $values_2 = []; - foreach ($object->getTools() as $value_2) { - $values_2[] = $this->normalizer->normalize($value_2, 'json', $context); + $values_3 = []; + foreach ($object->getTools() as $value_6) { + $values_3[] = $this->normalizer->normalize($value_6, 'json', $context); } - $data['tools'] = $values_2; + $data['tools'] = $values_3; } if ($object->isInitialized('toolChoice') && $object->getToolChoice() !== null) { - $data['tool_choice'] = $object->getToolChoice(); + $value_7 = $object->getToolChoice(); + if (is_string($object->getToolChoice())) { + $value_7 = $object->getToolChoice(); + } elseif (is_object($object->getToolChoice())) { + $value_7 = $this->normalizer->normalize($object->getToolChoice(), 'json', $context); + } + $data['tool_choice'] = $value_7; } if ($object->isInitialized('user') && $object->getUser() !== null) { $data['user'] = $object->getUser(); } if ($object->isInitialized('functionCall') && $object->getFunctionCall() !== null) { - $data['function_call'] = $object->getFunctionCall(); + $value_8 = $object->getFunctionCall(); + if (is_string($object->getFunctionCall())) { + $value_8 = $object->getFunctionCall(); + } elseif (is_object($object->getFunctionCall())) { + $value_8 = $this->normalizer->normalize($object->getFunctionCall(), 'json', $context); + } + $data['function_call'] = $value_8; } if ($object->isInitialized('functions') && $object->getFunctions() !== null) { - $values_3 = []; - foreach ($object->getFunctions() as $value_3) { - $values_3[] = $this->normalizer->normalize($value_3, 'json', $context); + $values_4 = []; + foreach ($object->getFunctions() as $value_9) { + $values_4[] = $this->normalizer->normalize($value_9, 'json', $context); } - $data['functions'] = $values_3; + $data['functions'] = $values_4; + } + if ($object->isInitialized('frequencyPenalty') && $object->getFrequencyPenalty() !== null) { + $data['frequency_penalty'] = $object->getFrequencyPenalty(); + } + if ($object->isInitialized('logprobs') && $object->getLogprobs() !== null) { + $data['logprobs'] = $object->getLogprobs(); + } + if ($object->isInitialized('n') && $object->getN() !== null) { + $data['n'] = $object->getN(); + } + if ($object->isInitialized('presencePenalty') && $object->getPresencePenalty() !== null) { + $data['presence_penalty'] = $object->getPresencePenalty(); + } + if ($object->isInitialized('stream') && $object->getStream() !== null) { + $data['stream'] = $object->getStream(); + } + if ($object->isInitialized('temperature') && $object->getTemperature() !== null) { + $data['temperature'] = $object->getTemperature(); + } + if ($object->isInitialized('topP') && $object->getTopP() !== null) { + $data['top_p'] = $object->getTopP(); } - foreach ($object as $key_1 => $value_4) { + foreach ($object as $key_1 => $value_10) { if (preg_match('/.*/', (string) $key_1)) { - $data[$key_1] = $value_4; + $data[$key_1] = $value_10; } } return $data; diff --git a/generated/Normalizer/CreateChatCompletionResponseNormalizer.php b/generated/Normalizer/CreateChatCompletionResponseNormalizer.php index 093f329..73fa31d 100644 --- a/generated/Normalizer/CreateChatCompletionResponseNormalizer.php +++ b/generated/Normalizer/CreateChatCompletionResponseNormalizer.php @@ -70,18 +70,20 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setModel($data['model']); unset($data['model']); } - if (\array_key_exists('system_fingerprint', $data)) { + if (\array_key_exists('system_fingerprint', $data) && $data['system_fingerprint'] !== null) { $object->setSystemFingerprint($data['system_fingerprint']); unset($data['system_fingerprint']); - } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); + } elseif (\array_key_exists('system_fingerprint', $data) && $data['system_fingerprint'] === null) { + $object->setSystemFingerprint(null); } if (\array_key_exists('usage', $data)) { $object->setUsage($this->denormalizer->denormalize($data['usage'], CompletionUsage::class, 'json', $context)); unset($data['usage']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value_1; @@ -104,13 +106,13 @@ public function normalize($object, $format = null, array $context = []) $data['choices'] = $values; $data['created'] = $object->getCreated(); $data['model'] = $object->getModel(); - if ($object->isInitialized('systemFingerprint') && $object->getSystemFingerprint() !== null) { + if ($object->isInitialized('system_fingerprint') && $object->getSystemFingerprint() !== null) { $data['system_fingerprint'] = $object->getSystemFingerprint(); } - $data['object'] = $object->getObject(); if ($object->isInitialized('usage') && $object->getUsage() !== null) { $data['usage'] = $this->normalizer->normalize($object->getUsage(), 'json', $context); } + $data['object'] = $object->getObject(); foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value_1; diff --git a/generated/Normalizer/CreateCompletionRequestNormalizer.php b/generated/Normalizer/CreateCompletionRequestNormalizer.php index 9dc0ab4..bccd0d6 100644 --- a/generated/Normalizer/CreateCompletionRequestNormalizer.php +++ b/generated/Normalizer/CreateCompletionRequestNormalizer.php @@ -61,11 +61,91 @@ public function denormalize($data, $class, $format = null, array $context = []) return $object; } if (\array_key_exists('model', $data)) { - $object->setModel($data['model']); + $value = $data['model']; + if (is_string($data['model'])) { + $value = $data['model']; + } elseif (is_string($data['model'])) { + $value = $data['model']; + } + $object->setModel($value); unset($data['model']); } + if (\array_key_exists('logit_bias', $data) && $data['logit_bias'] !== null) { + $values = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['logit_bias'] as $key => $value_1) { + $values[$key] = $value_1; + } + $object->setLogitBias($values); + unset($data['logit_bias']); + } elseif (\array_key_exists('logit_bias', $data) && $data['logit_bias'] === null) { + $object->setLogitBias(null); + } + if (\array_key_exists('logprobs', $data) && $data['logprobs'] !== null) { + $object->setLogprobs($data['logprobs']); + unset($data['logprobs']); + } elseif (\array_key_exists('logprobs', $data) && $data['logprobs'] === null) { + $object->setLogprobs(null); + } + if (\array_key_exists('seed', $data) && $data['seed'] !== null) { + $object->setSeed($data['seed']); + unset($data['seed']); + } elseif (\array_key_exists('seed', $data) && $data['seed'] === null) { + $object->setSeed(null); + } + if (\array_key_exists('stop', $data) && $data['stop'] !== null) { + $value_2 = $data['stop']; + if (is_string($data['stop'])) { + $value_2 = $data['stop']; + } elseif (is_array($data['stop']) && $this->isOnlyNumericKeys($data['stop'])) { + $values_1 = []; + foreach ($data['stop'] as $value_3) { + $values_1[] = $value_3; + } + $value_2 = $values_1; + } + $object->setStop($value_2); + unset($data['stop']); + } elseif (\array_key_exists('stop', $data) && $data['stop'] === null) { + $object->setStop(null); + } + if (\array_key_exists('suffix', $data) && $data['suffix'] !== null) { + $object->setSuffix($data['suffix']); + unset($data['suffix']); + } elseif (\array_key_exists('suffix', $data) && $data['suffix'] === null) { + $object->setSuffix(null); + } + if (\array_key_exists('user', $data)) { + $object->setUser($data['user']); + unset($data['user']); + } if (\array_key_exists('prompt', $data) && $data['prompt'] !== null) { - $object->setPrompt($data['prompt']); + $value_4 = $data['prompt']; + if (is_string($data['prompt'])) { + $value_4 = $data['prompt']; + } elseif (is_array($data['prompt']) && $this->isOnlyNumericKeys($data['prompt'])) { + $values_2 = []; + foreach ($data['prompt'] as $value_5) { + $values_2[] = $value_5; + } + $value_4 = $values_2; + } elseif (is_array($data['prompt']) && $this->isOnlyNumericKeys($data['prompt'])) { + $values_3 = []; + foreach ($data['prompt'] as $value_6) { + $values_3[] = $value_6; + } + $value_4 = $values_3; + } elseif (is_array($data['prompt']) && $this->isOnlyNumericKeys($data['prompt'])) { + $values_4 = []; + foreach ($data['prompt'] as $value_7) { + $values_5 = []; + foreach ($value_7 as $value_8) { + $values_5[] = $value_8; + } + $values_4[] = $values_5; + } + $value_4 = $values_4; + } + $object->setPrompt($value_4); unset($data['prompt']); } elseif (\array_key_exists('prompt', $data) && $data['prompt'] === null) { $object->setPrompt(null); @@ -88,22 +168,6 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('frequency_penalty', $data) && $data['frequency_penalty'] === null) { $object->setFrequencyPenalty(null); } - if (\array_key_exists('logit_bias', $data) && $data['logit_bias'] !== null) { - $values = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - foreach ($data['logit_bias'] as $key => $value) { - $values[$key] = $value; - } - $object->setLogitBias($values); - unset($data['logit_bias']); - } elseif (\array_key_exists('logit_bias', $data) && $data['logit_bias'] === null) { - $object->setLogitBias(null); - } - if (\array_key_exists('logprobs', $data) && $data['logprobs'] !== null) { - $object->setLogprobs($data['logprobs']); - unset($data['logprobs']); - } elseif (\array_key_exists('logprobs', $data) && $data['logprobs'] === null) { - $object->setLogprobs(null); - } if (\array_key_exists('max_tokens', $data) && $data['max_tokens'] !== null) { $object->setMaxTokens($data['max_tokens']); unset($data['max_tokens']); @@ -122,30 +186,12 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('presence_penalty', $data) && $data['presence_penalty'] === null) { $object->setPresencePenalty(null); } - if (\array_key_exists('seed', $data) && $data['seed'] !== null) { - $object->setSeed($data['seed']); - unset($data['seed']); - } elseif (\array_key_exists('seed', $data) && $data['seed'] === null) { - $object->setSeed(null); - } - if (\array_key_exists('stop', $data) && $data['stop'] !== null) { - $object->setStop($data['stop']); - unset($data['stop']); - } elseif (\array_key_exists('stop', $data) && $data['stop'] === null) { - $object->setStop(null); - } if (\array_key_exists('stream', $data) && $data['stream'] !== null) { $object->setStream($data['stream']); unset($data['stream']); } elseif (\array_key_exists('stream', $data) && $data['stream'] === null) { $object->setStream(null); } - if (\array_key_exists('suffix', $data) && $data['suffix'] !== null) { - $object->setSuffix($data['suffix']); - unset($data['suffix']); - } elseif (\array_key_exists('suffix', $data) && $data['suffix'] === null) { - $object->setSuffix(null); - } if (\array_key_exists('temperature', $data) && $data['temperature'] !== null) { $object->setTemperature($data['temperature']); unset($data['temperature']); @@ -158,13 +204,9 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('top_p', $data) && $data['top_p'] === null) { $object->setTopP(null); } - if (\array_key_exists('user', $data)) { - $object->setUser($data['user']); - unset($data['user']); - } - foreach ($data as $key_1 => $value_1) { + foreach ($data as $key_1 => $value_9) { if (preg_match('/.*/', (string) $key_1)) { - $object[$key_1] = $value_1; + $object[$key_1] = $value_9; } } return $object; @@ -176,27 +218,81 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['model'] = $object->getModel(); - $data['prompt'] = $object->getPrompt(); - if ($object->isInitialized('bestOf') && $object->getBestOf() !== null) { - $data['best_of'] = $object->getBestOf(); - } - if ($object->isInitialized('echo') && $object->getEcho() !== null) { - $data['echo'] = $object->getEcho(); - } - if ($object->isInitialized('frequencyPenalty') && $object->getFrequencyPenalty() !== null) { - $data['frequency_penalty'] = $object->getFrequencyPenalty(); + $value = $object->getModel(); + if (is_string($object->getModel())) { + $value = $object->getModel(); + } elseif (is_string($object->getModel())) { + $value = $object->getModel(); } + $data['model'] = $value; if ($object->isInitialized('logitBias') && $object->getLogitBias() !== null) { $values = []; - foreach ($object->getLogitBias() as $key => $value) { - $values[$key] = $value; + foreach ($object->getLogitBias() as $key => $value_1) { + $values[$key] = $value_1; } $data['logit_bias'] = $values; } if ($object->isInitialized('logprobs') && $object->getLogprobs() !== null) { $data['logprobs'] = $object->getLogprobs(); } + if ($object->isInitialized('seed') && $object->getSeed() !== null) { + $data['seed'] = $object->getSeed(); + } + if ($object->isInitialized('stop') && $object->getStop() !== null) { + $value_2 = $object->getStop(); + if (is_string($object->getStop())) { + $value_2 = $object->getStop(); + } elseif (is_array($object->getStop())) { + $values_1 = []; + foreach ($object->getStop() as $value_3) { + $values_1[] = $value_3; + } + $value_2 = $values_1; + } + $data['stop'] = $value_2; + } + if ($object->isInitialized('suffix') && $object->getSuffix() !== null) { + $data['suffix'] = $object->getSuffix(); + } + if ($object->isInitialized('user') && $object->getUser() !== null) { + $data['user'] = $object->getUser(); + } + $value_4 = $object->getPrompt(); + if (is_string($object->getPrompt())) { + $value_4 = $object->getPrompt(); + } elseif (is_array($object->getPrompt())) { + $values_2 = []; + foreach ($object->getPrompt() as $value_5) { + $values_2[] = $value_5; + } + $value_4 = $values_2; + } elseif (is_array($object->getPrompt())) { + $values_3 = []; + foreach ($object->getPrompt() as $value_6) { + $values_3[] = $value_6; + } + $value_4 = $values_3; + } elseif (is_array($object->getPrompt())) { + $values_4 = []; + foreach ($object->getPrompt() as $value_7) { + $values_5 = []; + foreach ($value_7 as $value_8) { + $values_5[] = $value_8; + } + $values_4[] = $values_5; + } + $value_4 = $values_4; + } + $data['prompt'] = $value_4; + if ($object->isInitialized('bestOf') && $object->getBestOf() !== null) { + $data['best_of'] = $object->getBestOf(); + } + if ($object->isInitialized('echo') && $object->getEcho() !== null) { + $data['echo'] = $object->getEcho(); + } + if ($object->isInitialized('frequencyPenalty') && $object->getFrequencyPenalty() !== null) { + $data['frequency_penalty'] = $object->getFrequencyPenalty(); + } if ($object->isInitialized('maxTokens') && $object->getMaxTokens() !== null) { $data['max_tokens'] = $object->getMaxTokens(); } @@ -206,30 +302,18 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('presencePenalty') && $object->getPresencePenalty() !== null) { $data['presence_penalty'] = $object->getPresencePenalty(); } - if ($object->isInitialized('seed') && $object->getSeed() !== null) { - $data['seed'] = $object->getSeed(); - } - if ($object->isInitialized('stop') && $object->getStop() !== null) { - $data['stop'] = $object->getStop(); - } if ($object->isInitialized('stream') && $object->getStream() !== null) { $data['stream'] = $object->getStream(); } - if ($object->isInitialized('suffix') && $object->getSuffix() !== null) { - $data['suffix'] = $object->getSuffix(); - } if ($object->isInitialized('temperature') && $object->getTemperature() !== null) { $data['temperature'] = $object->getTemperature(); } if ($object->isInitialized('topP') && $object->getTopP() !== null) { $data['top_p'] = $object->getTopP(); } - if ($object->isInitialized('user') && $object->getUser() !== null) { - $data['user'] = $object->getUser(); - } - foreach ($object as $key_1 => $value_1) { + foreach ($object as $key_1 => $value_9) { if (preg_match('/.*/', (string) $key_1)) { - $data[$key_1] = $value_1; + $data[$key_1] = $value_9; } } return $data; diff --git a/generated/Normalizer/CreateCompletionResponseNormalizer.php b/generated/Normalizer/CreateCompletionResponseNormalizer.php index cb895af..382fbcd 100644 --- a/generated/Normalizer/CreateCompletionResponseNormalizer.php +++ b/generated/Normalizer/CreateCompletionResponseNormalizer.php @@ -74,14 +74,14 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setSystemFingerprint($data['system_fingerprint']); unset($data['system_fingerprint']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('usage', $data)) { $object->setUsage($this->denormalizer->denormalize($data['usage'], CompletionUsage::class, 'json', $context)); unset($data['usage']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value_1; @@ -107,10 +107,10 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('systemFingerprint') && $object->getSystemFingerprint() !== null) { $data['system_fingerprint'] = $object->getSystemFingerprint(); } - $data['object'] = $object->getObject(); if ($object->isInitialized('usage') && $object->getUsage() !== null) { $data['usage'] = $this->normalizer->normalize($object->getUsage(), 'json', $context); } + $data['object'] = $object->getObject(); foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value_1; diff --git a/generated/Normalizer/CreateEditRequestNormalizer.php b/generated/Normalizer/CreateEditRequestNormalizer.php index ce53ac7..593f9ab 100644 --- a/generated/Normalizer/CreateEditRequestNormalizer.php +++ b/generated/Normalizer/CreateEditRequestNormalizer.php @@ -59,7 +59,13 @@ public function denormalize($data, $class, $format = null, array $context = []) unset($data['instruction']); } if (\array_key_exists('model', $data)) { - $object->setModel($data['model']); + $value = $data['model']; + if (is_string($data['model'])) { + $value = $data['model']; + } elseif (is_string($data['model'])) { + $value = $data['model']; + } + $object->setModel($value); unset($data['model']); } if (\array_key_exists('input', $data) && $data['input'] !== null) { @@ -86,9 +92,9 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('top_p', $data) && $data['top_p'] === null) { $object->setTopP(null); } - foreach ($data as $key => $value) { + foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + $object[$key] = $value_1; } } return $object; @@ -101,7 +107,13 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['instruction'] = $object->getInstruction(); - $data['model'] = $object->getModel(); + $value = $object->getModel(); + if (is_string($object->getModel())) { + $value = $object->getModel(); + } elseif (is_string($object->getModel())) { + $value = $object->getModel(); + } + $data['model'] = $value; if ($object->isInitialized('input') && $object->getInput() !== null) { $data['input'] = $object->getInput(); } @@ -114,9 +126,9 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('topP') && $object->getTopP() !== null) { $data['top_p'] = $object->getTopP(); } - foreach ($object as $key => $value) { + foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + $data[$key] = $value_1; } } return $data; diff --git a/generated/Normalizer/CreateEditResponseNormalizer.php b/generated/Normalizer/CreateEditResponseNormalizer.php index b2800e4..88af9be 100644 --- a/generated/Normalizer/CreateEditResponseNormalizer.php +++ b/generated/Normalizer/CreateEditResponseNormalizer.php @@ -58,10 +58,6 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setChoices($values); unset($data['choices']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('created', $data)) { $object->setCreated($data['created']); unset($data['created']); @@ -70,6 +66,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setUsage($this->denormalizer->denormalize($data['usage'], CompletionUsage::class, 'json', $context)); unset($data['usage']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value_1; @@ -89,9 +89,9 @@ public function normalize($object, $format = null, array $context = []) $values[] = $this->normalizer->normalize($value, 'json', $context); } $data['choices'] = $values; - $data['object'] = $object->getObject(); $data['created'] = $object->getCreated(); $data['usage'] = $this->normalizer->normalize($object->getUsage(), 'json', $context); + $data['object'] = $object->getObject(); foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value_1; diff --git a/generated/Normalizer/CreateEmbeddingRequestNormalizer.php b/generated/Normalizer/CreateEmbeddingRequestNormalizer.php index 917d906..e4af717 100644 --- a/generated/Normalizer/CreateEmbeddingRequestNormalizer.php +++ b/generated/Normalizer/CreateEmbeddingRequestNormalizer.php @@ -49,17 +49,49 @@ public function denormalize($data, $class, $format = null, array $context = []) return $object; } if (\array_key_exists('input', $data)) { - $object->setInput($data['input']); + $value = $data['input']; + if (is_string($data['input'])) { + $value = $data['input']; + } elseif (is_array($data['input']) && $this->isOnlyNumericKeys($data['input'])) { + $values = []; + foreach ($data['input'] as $value_1) { + $values[] = $value_1; + } + $value = $values; + } elseif (is_array($data['input']) && $this->isOnlyNumericKeys($data['input'])) { + $values_1 = []; + foreach ($data['input'] as $value_2) { + $values_1[] = $value_2; + } + $value = $values_1; + } elseif (is_array($data['input']) && $this->isOnlyNumericKeys($data['input'])) { + $values_2 = []; + foreach ($data['input'] as $value_3) { + $values_3 = []; + foreach ($value_3 as $value_4) { + $values_3[] = $value_4; + } + $values_2[] = $values_3; + } + $value = $values_2; + } + $object->setInput($value); } if (\array_key_exists('model', $data)) { - $object->setModel($data['model']); - } - if (\array_key_exists('encoding_format', $data)) { - $object->setEncodingFormat($data['encoding_format']); + $value_5 = $data['model']; + if (is_string($data['model'])) { + $value_5 = $data['model']; + } elseif (is_string($data['model'])) { + $value_5 = $data['model']; + } + $object->setModel($value_5); } if (\array_key_exists('user', $data)) { $object->setUser($data['user']); } + if (\array_key_exists('encoding_format', $data)) { + $object->setEncodingFormat($data['encoding_format']); + } return $object; } @@ -69,14 +101,46 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['input'] = $object->getInput(); - $data['model'] = $object->getModel(); - if ($object->isInitialized('encodingFormat') && $object->getEncodingFormat() !== null) { - $data['encoding_format'] = $object->getEncodingFormat(); + $value = $object->getInput(); + if (is_string($object->getInput())) { + $value = $object->getInput(); + } elseif (is_array($object->getInput())) { + $values = []; + foreach ($object->getInput() as $value_1) { + $values[] = $value_1; + } + $value = $values; + } elseif (is_array($object->getInput())) { + $values_1 = []; + foreach ($object->getInput() as $value_2) { + $values_1[] = $value_2; + } + $value = $values_1; + } elseif (is_array($object->getInput())) { + $values_2 = []; + foreach ($object->getInput() as $value_3) { + $values_3 = []; + foreach ($value_3 as $value_4) { + $values_3[] = $value_4; + } + $values_2[] = $values_3; + } + $value = $values_2; + } + $data['input'] = $value; + $value_5 = $object->getModel(); + if (is_string($object->getModel())) { + $value_5 = $object->getModel(); + } elseif (is_string($object->getModel())) { + $value_5 = $object->getModel(); } + $data['model'] = $value_5; if ($object->isInitialized('user') && $object->getUser() !== null) { $data['user'] = $object->getUser(); } + if ($object->isInitialized('encodingFormat') && $object->getEncodingFormat() !== null) { + $data['encoding_format'] = $object->getEncodingFormat(); + } return $data; } diff --git a/generated/Normalizer/CreateEmbeddingResponseNormalizer.php b/generated/Normalizer/CreateEmbeddingResponseNormalizer.php index 1e87949..9b4ef56 100644 --- a/generated/Normalizer/CreateEmbeddingResponseNormalizer.php +++ b/generated/Normalizer/CreateEmbeddingResponseNormalizer.php @@ -62,14 +62,14 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setModel($data['model']); unset($data['model']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('usage', $data)) { $object->setUsage($this->denormalizer->denormalize($data['usage'], CreateEmbeddingResponseUsage::class, 'json', $context)); unset($data['usage']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value_1; @@ -90,8 +90,8 @@ public function normalize($object, $format = null, array $context = []) } $data['data'] = $values; $data['model'] = $object->getModel(); - $data['object'] = $object->getObject(); $data['usage'] = $this->normalizer->normalize($object->getUsage(), 'json', $context); + $data['object'] = $object->getObject(); foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value_1; diff --git a/generated/Normalizer/CreateFineTuneRequestHyperparametersNormalizer.php b/generated/Normalizer/CreateFineTuneRequestHyperparametersNormalizer.php index aa38e08..3373c91 100644 --- a/generated/Normalizer/CreateFineTuneRequestHyperparametersNormalizer.php +++ b/generated/Normalizer/CreateFineTuneRequestHyperparametersNormalizer.php @@ -49,12 +49,18 @@ public function denormalize($data, $class, $format = null, array $context = []) return $object; } if (\array_key_exists('n_epochs', $data)) { - $object->setNEpochs($data['n_epochs']); + $value = $data['n_epochs']; + if (is_string($data['n_epochs'])) { + $value = $data['n_epochs']; + } elseif (is_int($data['n_epochs'])) { + $value = $data['n_epochs']; + } + $object->setNEpochs($value); unset($data['n_epochs']); } - foreach ($data as $key => $value) { + foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + $object[$key] = $value_1; } } return $object; @@ -67,11 +73,17 @@ public function normalize($object, $format = null, array $context = []) { $data = []; if ($object->isInitialized('nEpochs') && $object->getNEpochs() !== null) { - $data['n_epochs'] = $object->getNEpochs(); + $value = $object->getNEpochs(); + if (is_string($object->getNEpochs())) { + $value = $object->getNEpochs(); + } elseif (is_int($object->getNEpochs())) { + $value = $object->getNEpochs(); + } + $data['n_epochs'] = $value; } - foreach ($object as $key => $value) { + foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + $data[$key] = $value_1; } } return $data; diff --git a/generated/Normalizer/CreateFineTuneRequestNormalizer.php b/generated/Normalizer/CreateFineTuneRequestNormalizer.php index e21dea8..bfde59b 100644 --- a/generated/Normalizer/CreateFineTuneRequestNormalizer.php +++ b/generated/Normalizer/CreateFineTuneRequestNormalizer.php @@ -87,12 +87,6 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('classification_positive_class', $data) && $data['classification_positive_class'] === null) { $object->setClassificationPositiveClass(null); } - if (\array_key_exists('compute_classification_metrics', $data) && $data['compute_classification_metrics'] !== null) { - $object->setComputeClassificationMetrics($data['compute_classification_metrics']); - unset($data['compute_classification_metrics']); - } elseif (\array_key_exists('compute_classification_metrics', $data) && $data['compute_classification_metrics'] === null) { - $object->setComputeClassificationMetrics(null); - } if (\array_key_exists('hyperparameters', $data)) { $object->setHyperparameters($this->denormalizer->denormalize($data['hyperparameters'], CreateFineTuneRequestHyperparameters::class, 'json', $context)); unset($data['hyperparameters']); @@ -103,18 +97,6 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('learning_rate_multiplier', $data) && $data['learning_rate_multiplier'] === null) { $object->setLearningRateMultiplier(null); } - if (\array_key_exists('model', $data) && $data['model'] !== null) { - $object->setModel($data['model']); - unset($data['model']); - } elseif (\array_key_exists('model', $data) && $data['model'] === null) { - $object->setModel(null); - } - if (\array_key_exists('prompt_loss_weight', $data) && $data['prompt_loss_weight'] !== null) { - $object->setPromptLossWeight($data['prompt_loss_weight']); - unset($data['prompt_loss_weight']); - } elseif (\array_key_exists('prompt_loss_weight', $data) && $data['prompt_loss_weight'] === null) { - $object->setPromptLossWeight(null); - } if (\array_key_exists('suffix', $data) && $data['suffix'] !== null) { $object->setSuffix($data['suffix']); unset($data['suffix']); @@ -127,9 +109,33 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('validation_file', $data) && $data['validation_file'] === null) { $object->setValidationFile(null); } - foreach ($data as $key => $value_1) { + if (\array_key_exists('compute_classification_metrics', $data) && $data['compute_classification_metrics'] !== null) { + $object->setComputeClassificationMetrics($data['compute_classification_metrics']); + unset($data['compute_classification_metrics']); + } elseif (\array_key_exists('compute_classification_metrics', $data) && $data['compute_classification_metrics'] === null) { + $object->setComputeClassificationMetrics(null); + } + if (\array_key_exists('model', $data) && $data['model'] !== null) { + $value_1 = $data['model']; + if (is_string($data['model'])) { + $value_1 = $data['model']; + } elseif (is_string($data['model'])) { + $value_1 = $data['model']; + } + $object->setModel($value_1); + unset($data['model']); + } elseif (\array_key_exists('model', $data) && $data['model'] === null) { + $object->setModel(null); + } + if (\array_key_exists('prompt_loss_weight', $data) && $data['prompt_loss_weight'] !== null) { + $object->setPromptLossWeight($data['prompt_loss_weight']); + unset($data['prompt_loss_weight']); + } elseif (\array_key_exists('prompt_loss_weight', $data) && $data['prompt_loss_weight'] === null) { + $object->setPromptLossWeight(null); + } + foreach ($data as $key => $value_2) { if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $object[$key] = $value_2; } } return $object; @@ -158,30 +164,36 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('classificationPositiveClass') && $object->getClassificationPositiveClass() !== null) { $data['classification_positive_class'] = $object->getClassificationPositiveClass(); } - if ($object->isInitialized('computeClassificationMetrics') && $object->getComputeClassificationMetrics() !== null) { - $data['compute_classification_metrics'] = $object->getComputeClassificationMetrics(); - } if ($object->isInitialized('hyperparameters') && $object->getHyperparameters() !== null) { $data['hyperparameters'] = $this->normalizer->normalize($object->getHyperparameters(), 'json', $context); } if ($object->isInitialized('learningRateMultiplier') && $object->getLearningRateMultiplier() !== null) { $data['learning_rate_multiplier'] = $object->getLearningRateMultiplier(); } - if ($object->isInitialized('model') && $object->getModel() !== null) { - $data['model'] = $object->getModel(); - } - if ($object->isInitialized('promptLossWeight') && $object->getPromptLossWeight() !== null) { - $data['prompt_loss_weight'] = $object->getPromptLossWeight(); - } if ($object->isInitialized('suffix') && $object->getSuffix() !== null) { $data['suffix'] = $object->getSuffix(); } if ($object->isInitialized('validationFile') && $object->getValidationFile() !== null) { $data['validation_file'] = $object->getValidationFile(); } - foreach ($object as $key => $value_1) { + if ($object->isInitialized('computeClassificationMetrics') && $object->getComputeClassificationMetrics() !== null) { + $data['compute_classification_metrics'] = $object->getComputeClassificationMetrics(); + } + if ($object->isInitialized('model') && $object->getModel() !== null) { + $value_1 = $object->getModel(); + if (is_string($object->getModel())) { + $value_1 = $object->getModel(); + } elseif (is_string($object->getModel())) { + $value_1 = $object->getModel(); + } + $data['model'] = $value_1; + } + if ($object->isInitialized('promptLossWeight') && $object->getPromptLossWeight() !== null) { + $data['prompt_loss_weight'] = $object->getPromptLossWeight(); + } + foreach ($object as $key => $value_2) { if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + $data[$key] = $value_2; } } return $data; diff --git a/generated/Normalizer/CreateFineTuningJobRequestHyperparametersNormalizer.php b/generated/Normalizer/CreateFineTuningJobRequestHyperparametersNormalizer.php index e4291dc..50527cb 100644 --- a/generated/Normalizer/CreateFineTuningJobRequestHyperparametersNormalizer.php +++ b/generated/Normalizer/CreateFineTuningJobRequestHyperparametersNormalizer.php @@ -49,20 +49,38 @@ public function denormalize($data, $class, $format = null, array $context = []) return $object; } if (\array_key_exists('batch_size', $data)) { - $object->setBatchSize($data['batch_size']); + $value = $data['batch_size']; + if (is_string($data['batch_size'])) { + $value = $data['batch_size']; + } elseif (is_int($data['batch_size'])) { + $value = $data['batch_size']; + } + $object->setBatchSize($value); unset($data['batch_size']); } if (\array_key_exists('learning_rate_multiplier', $data)) { - $object->setLearningRateMultiplier($data['learning_rate_multiplier']); + $value_1 = $data['learning_rate_multiplier']; + if (is_string($data['learning_rate_multiplier'])) { + $value_1 = $data['learning_rate_multiplier']; + } elseif (is_float($data['learning_rate_multiplier'])) { + $value_1 = $data['learning_rate_multiplier']; + } + $object->setLearningRateMultiplier($value_1); unset($data['learning_rate_multiplier']); } if (\array_key_exists('n_epochs', $data)) { - $object->setNEpochs($data['n_epochs']); + $value_2 = $data['n_epochs']; + if (is_string($data['n_epochs'])) { + $value_2 = $data['n_epochs']; + } elseif (is_int($data['n_epochs'])) { + $value_2 = $data['n_epochs']; + } + $object->setNEpochs($value_2); unset($data['n_epochs']); } - foreach ($data as $key => $value) { + foreach ($data as $key => $value_3) { if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + $object[$key] = $value_3; } } return $object; @@ -75,17 +93,35 @@ public function normalize($object, $format = null, array $context = []) { $data = []; if ($object->isInitialized('batchSize') && $object->getBatchSize() !== null) { - $data['batch_size'] = $object->getBatchSize(); + $value = $object->getBatchSize(); + if (is_string($object->getBatchSize())) { + $value = $object->getBatchSize(); + } elseif (is_int($object->getBatchSize())) { + $value = $object->getBatchSize(); + } + $data['batch_size'] = $value; } if ($object->isInitialized('learningRateMultiplier') && $object->getLearningRateMultiplier() !== null) { - $data['learning_rate_multiplier'] = $object->getLearningRateMultiplier(); + $value_1 = $object->getLearningRateMultiplier(); + if (is_string($object->getLearningRateMultiplier())) { + $value_1 = $object->getLearningRateMultiplier(); + } elseif (is_float($object->getLearningRateMultiplier())) { + $value_1 = $object->getLearningRateMultiplier(); + } + $data['learning_rate_multiplier'] = $value_1; } if ($object->isInitialized('nEpochs') && $object->getNEpochs() !== null) { - $data['n_epochs'] = $object->getNEpochs(); + $value_2 = $object->getNEpochs(); + if (is_string($object->getNEpochs())) { + $value_2 = $object->getNEpochs(); + } elseif (is_int($object->getNEpochs())) { + $value_2 = $object->getNEpochs(); + } + $data['n_epochs'] = $value_2; } - foreach ($object as $key => $value) { + foreach ($object as $key => $value_3) { if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + $data[$key] = $value_3; } } return $data; diff --git a/generated/Normalizer/CreateFineTuningJobRequestNormalizer.php b/generated/Normalizer/CreateFineTuningJobRequestNormalizer.php index 3d44aa5..ba92687 100644 --- a/generated/Normalizer/CreateFineTuningJobRequestNormalizer.php +++ b/generated/Normalizer/CreateFineTuningJobRequestNormalizer.php @@ -50,7 +50,13 @@ public function denormalize($data, $class, $format = null, array $context = []) return $object; } if (\array_key_exists('model', $data)) { - $object->setModel($data['model']); + $value = $data['model']; + if (is_string($data['model'])) { + $value = $data['model']; + } elseif (is_string($data['model'])) { + $value = $data['model']; + } + $object->setModel($value); unset($data['model']); } if (\array_key_exists('training_file', $data)) { @@ -73,9 +79,9 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('validation_file', $data) && $data['validation_file'] === null) { $object->setValidationFile(null); } - foreach ($data as $key => $value) { + foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + $object[$key] = $value_1; } } return $object; @@ -87,7 +93,13 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['model'] = $object->getModel(); + $value = $object->getModel(); + if (is_string($object->getModel())) { + $value = $object->getModel(); + } elseif (is_string($object->getModel())) { + $value = $object->getModel(); + } + $data['model'] = $value; $data['training_file'] = $object->getTrainingFile(); if ($object->isInitialized('hyperparameters') && $object->getHyperparameters() !== null) { $data['hyperparameters'] = $this->normalizer->normalize($object->getHyperparameters(), 'json', $context); @@ -98,9 +110,9 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('validationFile') && $object->getValidationFile() !== null) { $data['validation_file'] = $object->getValidationFile(); } - foreach ($object as $key => $value) { + foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + $data[$key] = $value_1; } } return $data; diff --git a/generated/Normalizer/CreateImageEditRequestNormalizer.php b/generated/Normalizer/CreateImageEditRequestNormalizer.php index ae7a557..0fc4802 100644 --- a/generated/Normalizer/CreateImageEditRequestNormalizer.php +++ b/generated/Normalizer/CreateImageEditRequestNormalizer.php @@ -60,8 +60,18 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setMask($data['mask']); unset($data['mask']); } + if (\array_key_exists('user', $data)) { + $object->setUser($data['user']); + unset($data['user']); + } if (\array_key_exists('model', $data) && $data['model'] !== null) { - $object->setModel($data['model']); + $value = $data['model']; + if (is_string($data['model'])) { + $value = $data['model']; + } elseif (is_string($data['model'])) { + $value = $data['model']; + } + $object->setModel($value); unset($data['model']); } elseif (\array_key_exists('model', $data) && $data['model'] === null) { $object->setModel(null); @@ -84,13 +94,9 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('response_format', $data) && $data['response_format'] === null) { $object->setResponseFormat(null); } - if (\array_key_exists('user', $data)) { - $object->setUser($data['user']); - unset($data['user']); - } - foreach ($data as $key => $value) { + foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + $object[$key] = $value_1; } } return $object; @@ -107,8 +113,17 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('mask') && $object->getMask() !== null) { $data['mask'] = $object->getMask(); } + if ($object->isInitialized('user') && $object->getUser() !== null) { + $data['user'] = $object->getUser(); + } if ($object->isInitialized('model') && $object->getModel() !== null) { - $data['model'] = $object->getModel(); + $value = $object->getModel(); + if (is_string($object->getModel())) { + $value = $object->getModel(); + } elseif (is_string($object->getModel())) { + $value = $object->getModel(); + } + $data['model'] = $value; } if ($object->isInitialized('n') && $object->getN() !== null) { $data['n'] = $object->getN(); @@ -119,12 +134,9 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('responseFormat') && $object->getResponseFormat() !== null) { $data['response_format'] = $object->getResponseFormat(); } - if ($object->isInitialized('user') && $object->getUser() !== null) { - $data['user'] = $object->getUser(); - } - foreach ($object as $key => $value) { + foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + $data[$key] = $value_1; } } return $data; diff --git a/generated/Normalizer/CreateImageRequestNormalizer.php b/generated/Normalizer/CreateImageRequestNormalizer.php index db13f16..8447a02 100644 --- a/generated/Normalizer/CreateImageRequestNormalizer.php +++ b/generated/Normalizer/CreateImageRequestNormalizer.php @@ -52,8 +52,18 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setPrompt($data['prompt']); unset($data['prompt']); } + if (\array_key_exists('user', $data)) { + $object->setUser($data['user']); + unset($data['user']); + } if (\array_key_exists('model', $data) && $data['model'] !== null) { - $object->setModel($data['model']); + $value = $data['model']; + if (is_string($data['model'])) { + $value = $data['model']; + } elseif (is_string($data['model'])) { + $value = $data['model']; + } + $object->setModel($value); unset($data['model']); } elseif (\array_key_exists('model', $data) && $data['model'] === null) { $object->setModel(null); @@ -86,13 +96,9 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('style', $data) && $data['style'] === null) { $object->setStyle(null); } - if (\array_key_exists('user', $data)) { - $object->setUser($data['user']); - unset($data['user']); - } - foreach ($data as $key => $value) { + foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + $object[$key] = $value_1; } } return $object; @@ -105,8 +111,17 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['prompt'] = $object->getPrompt(); + if ($object->isInitialized('user') && $object->getUser() !== null) { + $data['user'] = $object->getUser(); + } if ($object->isInitialized('model') && $object->getModel() !== null) { - $data['model'] = $object->getModel(); + $value = $object->getModel(); + if (is_string($object->getModel())) { + $value = $object->getModel(); + } elseif (is_string($object->getModel())) { + $value = $object->getModel(); + } + $data['model'] = $value; } if ($object->isInitialized('n') && $object->getN() !== null) { $data['n'] = $object->getN(); @@ -123,12 +138,9 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('style') && $object->getStyle() !== null) { $data['style'] = $object->getStyle(); } - if ($object->isInitialized('user') && $object->getUser() !== null) { - $data['user'] = $object->getUser(); - } - foreach ($object as $key => $value) { + foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + $data[$key] = $value_1; } } return $data; diff --git a/generated/Normalizer/CreateImageVariationRequestNormalizer.php b/generated/Normalizer/CreateImageVariationRequestNormalizer.php index 4915aef..77d6fd5 100644 --- a/generated/Normalizer/CreateImageVariationRequestNormalizer.php +++ b/generated/Normalizer/CreateImageVariationRequestNormalizer.php @@ -52,8 +52,18 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setImage($data['image']); unset($data['image']); } + if (\array_key_exists('user', $data)) { + $object->setUser($data['user']); + unset($data['user']); + } if (\array_key_exists('model', $data) && $data['model'] !== null) { - $object->setModel($data['model']); + $value = $data['model']; + if (is_string($data['model'])) { + $value = $data['model']; + } elseif (is_string($data['model'])) { + $value = $data['model']; + } + $object->setModel($value); unset($data['model']); } elseif (\array_key_exists('model', $data) && $data['model'] === null) { $object->setModel(null); @@ -76,13 +86,9 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('size', $data) && $data['size'] === null) { $object->setSize(null); } - if (\array_key_exists('user', $data)) { - $object->setUser($data['user']); - unset($data['user']); - } - foreach ($data as $key => $value) { + foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + $object[$key] = $value_1; } } return $object; @@ -95,8 +101,17 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['image'] = $object->getImage(); + if ($object->isInitialized('user') && $object->getUser() !== null) { + $data['user'] = $object->getUser(); + } if ($object->isInitialized('model') && $object->getModel() !== null) { - $data['model'] = $object->getModel(); + $value = $object->getModel(); + if (is_string($object->getModel())) { + $value = $object->getModel(); + } elseif (is_string($object->getModel())) { + $value = $object->getModel(); + } + $data['model'] = $value; } if ($object->isInitialized('n') && $object->getN() !== null) { $data['n'] = $object->getN(); @@ -107,12 +122,9 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('size') && $object->getSize() !== null) { $data['size'] = $object->getSize(); } - if ($object->isInitialized('user') && $object->getUser() !== null) { - $data['user'] = $object->getUser(); - } - foreach ($object as $key => $value) { + foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + $data[$key] = $value_1; } } return $data; diff --git a/generated/Normalizer/CreateMessageRequestNormalizer.php b/generated/Normalizer/CreateMessageRequestNormalizer.php index f129aa6..e9664e3 100644 --- a/generated/Normalizer/CreateMessageRequestNormalizer.php +++ b/generated/Normalizer/CreateMessageRequestNormalizer.php @@ -48,28 +48,28 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('role', $data)) { - $object->setRole($data['role']); - } if (\array_key_exists('content', $data)) { $object->setContent($data['content']); } - if (\array_key_exists('file_ids', $data)) { - $values = []; - foreach ($data['file_ids'] as $value) { - $values[] = $value; - } - $object->setFileIds($values); - } if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { - $values_1 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - foreach ($data['metadata'] as $key => $value_1) { - $values_1[$key] = $value_1; + $values = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['metadata'] as $key => $value) { + $values[$key] = $value; } - $object->setMetadata($values_1); + $object->setMetadata($values); } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { $object->setMetadata(null); } + if (\array_key_exists('role', $data)) { + $object->setRole($data['role']); + } + if (\array_key_exists('file_ids', $data)) { + $values_1 = []; + foreach ($data['file_ids'] as $value_1) { + $values_1[] = $value_1; + } + $object->setFileIds($values_1); + } return $object; } @@ -79,21 +79,21 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['role'] = $object->getRole(); $data['content'] = $object->getContent(); - if ($object->isInitialized('fileIds') && $object->getFileIds() !== null) { + if ($object->isInitialized('metadata') && $object->getMetadata() !== null) { $values = []; - foreach ($object->getFileIds() as $value) { - $values[] = $value; + foreach ($object->getMetadata() as $key => $value) { + $values[$key] = $value; } - $data['file_ids'] = $values; + $data['metadata'] = $values; } - if ($object->isInitialized('metadata') && $object->getMetadata() !== null) { + $data['role'] = $object->getRole(); + if ($object->isInitialized('fileIds') && $object->getFileIds() !== null) { $values_1 = []; - foreach ($object->getMetadata() as $key => $value_1) { - $values_1[$key] = $value_1; + foreach ($object->getFileIds() as $value_1) { + $values_1[] = $value_1; } - $data['metadata'] = $values_1; + $data['file_ids'] = $values_1; } return $data; } diff --git a/generated/Normalizer/CreateModerationRequestNormalizer.php b/generated/Normalizer/CreateModerationRequestNormalizer.php index b768f51..87e1ca9 100644 --- a/generated/Normalizer/CreateModerationRequestNormalizer.php +++ b/generated/Normalizer/CreateModerationRequestNormalizer.php @@ -49,16 +49,32 @@ public function denormalize($data, $class, $format = null, array $context = []) return $object; } if (\array_key_exists('input', $data)) { - $object->setInput($data['input']); + $value = $data['input']; + if (is_string($data['input'])) { + $value = $data['input']; + } elseif (is_array($data['input']) && $this->isOnlyNumericKeys($data['input'])) { + $values = []; + foreach ($data['input'] as $value_1) { + $values[] = $value_1; + } + $value = $values; + } + $object->setInput($value); unset($data['input']); } if (\array_key_exists('model', $data)) { - $object->setModel($data['model']); + $value_2 = $data['model']; + if (is_string($data['model'])) { + $value_2 = $data['model']; + } elseif (is_string($data['model'])) { + $value_2 = $data['model']; + } + $object->setModel($value_2); unset($data['model']); } - foreach ($data as $key => $value) { + foreach ($data as $key => $value_3) { if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + $object[$key] = $value_3; } } return $object; @@ -70,13 +86,29 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['input'] = $object->getInput(); + $value = $object->getInput(); + if (is_string($object->getInput())) { + $value = $object->getInput(); + } elseif (is_array($object->getInput())) { + $values = []; + foreach ($object->getInput() as $value_1) { + $values[] = $value_1; + } + $value = $values; + } + $data['input'] = $value; if ($object->isInitialized('model') && $object->getModel() !== null) { - $data['model'] = $object->getModel(); + $value_2 = $object->getModel(); + if (is_string($object->getModel())) { + $value_2 = $object->getModel(); + } elseif (is_string($object->getModel())) { + $value_2 = $object->getModel(); + } + $data['model'] = $value_2; } - foreach ($object as $key => $value) { + foreach ($object as $key => $value_3) { if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + $data[$key] = $value_3; } } return $data; diff --git a/generated/Normalizer/CreateRunRequestNormalizer.php b/generated/Normalizer/CreateRunRequestNormalizer.php index 8ff4083..bd55d3b 100644 --- a/generated/Normalizer/CreateRunRequestNormalizer.php +++ b/generated/Normalizer/CreateRunRequestNormalizer.php @@ -6,6 +6,9 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsCode; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsFunction; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsRetrieval; use Sourceability\OpenAIClient\Generated\Model\CreateRunRequest; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; @@ -69,7 +72,15 @@ public function denormalize($data, $class, $format = null, array $context = []) if (\array_key_exists('tools', $data) && $data['tools'] !== null) { $values = []; foreach ($data['tools'] as $value) { - $values[] = $value; + $value_1 = $value; + if (is_array($value) and (isset($value['type']) and $value['type'] === 'code_interpreter')) { + $value_1 = $this->denormalizer->denormalize($value, AssistantToolsCode::class, 'json', $context); + } elseif (is_array($value) and (isset($value['type']) and $value['type'] === 'retrieval')) { + $value_1 = $this->denormalizer->denormalize($value, AssistantToolsRetrieval::class, 'json', $context); + } elseif (is_array($value) and (isset($value['type']) and $value['type'] === 'function') and isset($value['function'])) { + $value_1 = $this->denormalizer->denormalize($value, AssistantToolsFunction::class, 'json', $context); + } + $values[] = $value_1; } $object->setTools($values); } elseif (\array_key_exists('tools', $data) && $data['tools'] === null) { @@ -77,8 +88,8 @@ public function denormalize($data, $class, $format = null, array $context = []) } if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { $values_1 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - foreach ($data['metadata'] as $key => $value_1) { - $values_1[$key] = $value_1; + foreach ($data['metadata'] as $key => $value_2) { + $values_1[$key] = $value_2; } $object->setMetadata($values_1); } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { @@ -106,14 +117,22 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('tools') && $object->getTools() !== null) { $values = []; foreach ($object->getTools() as $value) { - $values[] = $value; + $value_1 = $value; + if (is_object($value)) { + $value_1 = $this->normalizer->normalize($value, 'json', $context); + } elseif (is_object($value)) { + $value_1 = $this->normalizer->normalize($value, 'json', $context); + } elseif (is_object($value)) { + $value_1 = $this->normalizer->normalize($value, 'json', $context); + } + $values[] = $value_1; } $data['tools'] = $values; } if ($object->isInitialized('metadata') && $object->getMetadata() !== null) { $values_1 = []; - foreach ($object->getMetadata() as $key => $value_1) { - $values_1[$key] = $value_1; + foreach ($object->getMetadata() as $key => $value_2) { + $values_1[$key] = $value_2; } $data['metadata'] = $values_1; } diff --git a/generated/Normalizer/CreateSpeechRequestNormalizer.php b/generated/Normalizer/CreateSpeechRequestNormalizer.php index ed6b0b1..8070031 100644 --- a/generated/Normalizer/CreateSpeechRequestNormalizer.php +++ b/generated/Normalizer/CreateSpeechRequestNormalizer.php @@ -52,7 +52,13 @@ public function denormalize($data, $class, $format = null, array $context = []) return $object; } if (\array_key_exists('model', $data)) { - $object->setModel($data['model']); + $value = $data['model']; + if (is_string($data['model'])) { + $value = $data['model']; + } elseif (is_string($data['model'])) { + $value = $data['model']; + } + $object->setModel($value); } if (\array_key_exists('input', $data)) { $object->setInput($data['input']); @@ -75,7 +81,13 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['model'] = $object->getModel(); + $value = $object->getModel(); + if (is_string($object->getModel())) { + $value = $object->getModel(); + } elseif (is_string($object->getModel())) { + $value = $object->getModel(); + } + $data['model'] = $value; $data['input'] = $object->getInput(); $data['voice'] = $object->getVoice(); if ($object->isInitialized('responseFormat') && $object->getResponseFormat() !== null) { diff --git a/generated/Normalizer/CreateThreadAndRunRequestNormalizer.php b/generated/Normalizer/CreateThreadAndRunRequestNormalizer.php index ec0f7fa..874a742 100644 --- a/generated/Normalizer/CreateThreadAndRunRequestNormalizer.php +++ b/generated/Normalizer/CreateThreadAndRunRequestNormalizer.php @@ -6,6 +6,9 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsCode; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsFunction; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsRetrieval; use Sourceability\OpenAIClient\Generated\Model\CreateThreadAndRunRequest; use Sourceability\OpenAIClient\Generated\Model\CreateThreadRequest; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; @@ -68,7 +71,15 @@ public function denormalize($data, $class, $format = null, array $context = []) if (\array_key_exists('tools', $data) && $data['tools'] !== null) { $values = []; foreach ($data['tools'] as $value) { - $values[] = $value; + $value_1 = $value; + if (is_array($value) and (isset($value['type']) and $value['type'] === 'code_interpreter')) { + $value_1 = $this->denormalizer->denormalize($value, AssistantToolsCode::class, 'json', $context); + } elseif (is_array($value) and (isset($value['type']) and $value['type'] === 'retrieval')) { + $value_1 = $this->denormalizer->denormalize($value, AssistantToolsRetrieval::class, 'json', $context); + } elseif (is_array($value) and (isset($value['type']) and $value['type'] === 'function') and isset($value['function'])) { + $value_1 = $this->denormalizer->denormalize($value, AssistantToolsFunction::class, 'json', $context); + } + $values[] = $value_1; } $object->setTools($values); } elseif (\array_key_exists('tools', $data) && $data['tools'] === null) { @@ -76,8 +87,8 @@ public function denormalize($data, $class, $format = null, array $context = []) } if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { $values_1 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - foreach ($data['metadata'] as $key => $value_1) { - $values_1[$key] = $value_1; + foreach ($data['metadata'] as $key => $value_2) { + $values_1[$key] = $value_2; } $object->setMetadata($values_1); } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { @@ -105,14 +116,22 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('tools') && $object->getTools() !== null) { $values = []; foreach ($object->getTools() as $value) { - $values[] = $value; + $value_1 = $value; + if (is_object($value)) { + $value_1 = $this->normalizer->normalize($value, 'json', $context); + } elseif (is_object($value)) { + $value_1 = $this->normalizer->normalize($value, 'json', $context); + } elseif (is_object($value)) { + $value_1 = $this->normalizer->normalize($value, 'json', $context); + } + $values[] = $value_1; } $data['tools'] = $values; } if ($object->isInitialized('metadata') && $object->getMetadata() !== null) { $values_1 = []; - foreach ($object->getMetadata() as $key => $value_1) { - $values_1[$key] = $value_1; + foreach ($object->getMetadata() as $key => $value_2) { + $values_1[$key] = $value_2; } $data['metadata'] = $values_1; } diff --git a/generated/Normalizer/CreateTranscriptionRequestNormalizer.php b/generated/Normalizer/CreateTranscriptionRequestNormalizer.php index 2b452b8..0d19c7b 100644 --- a/generated/Normalizer/CreateTranscriptionRequestNormalizer.php +++ b/generated/Normalizer/CreateTranscriptionRequestNormalizer.php @@ -55,7 +55,13 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setFile($data['file']); } if (\array_key_exists('model', $data)) { - $object->setModel($data['model']); + $value = $data['model']; + if (is_string($data['model'])) { + $value = $data['model']; + } elseif (is_string($data['model'])) { + $value = $data['model']; + } + $object->setModel($value); } if (\array_key_exists('language', $data)) { $object->setLanguage($data['language']); @@ -79,7 +85,13 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['file'] = $object->getFile(); - $data['model'] = $object->getModel(); + $value = $object->getModel(); + if (is_string($object->getModel())) { + $value = $object->getModel(); + } elseif (is_string($object->getModel())) { + $value = $object->getModel(); + } + $data['model'] = $value; if ($object->isInitialized('language') && $object->getLanguage() !== null) { $data['language'] = $object->getLanguage(); } diff --git a/generated/Normalizer/CreateTranslationRequestNormalizer.php b/generated/Normalizer/CreateTranslationRequestNormalizer.php index 59bc264..f8a8650 100644 --- a/generated/Normalizer/CreateTranslationRequestNormalizer.php +++ b/generated/Normalizer/CreateTranslationRequestNormalizer.php @@ -55,7 +55,13 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setFile($data['file']); } if (\array_key_exists('model', $data)) { - $object->setModel($data['model']); + $value = $data['model']; + if (is_string($data['model'])) { + $value = $data['model']; + } elseif (is_string($data['model'])) { + $value = $data['model']; + } + $object->setModel($value); } if (\array_key_exists('prompt', $data)) { $object->setPrompt($data['prompt']); @@ -76,7 +82,13 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['file'] = $object->getFile(); - $data['model'] = $object->getModel(); + $value = $object->getModel(); + if (is_string($object->getModel())) { + $value = $object->getModel(); + } elseif (is_string($object->getModel())) { + $value = $object->getModel(); + } + $data['model'] = $value; if ($object->isInitialized('prompt') && $object->getPrompt() !== null) { $data['prompt'] = $object->getPrompt(); } diff --git a/generated/Normalizer/DeleteFileResponseNormalizer.php b/generated/Normalizer/DeleteFileResponseNormalizer.php index 54f35e5..8d0a0cf 100644 --- a/generated/Normalizer/DeleteFileResponseNormalizer.php +++ b/generated/Normalizer/DeleteFileResponseNormalizer.php @@ -52,14 +52,14 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('deleted', $data)) { $object->setDeleted($data['deleted']); unset($data['deleted']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -75,8 +75,8 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['object'] = $object->getObject(); $data['deleted'] = $object->getDeleted(); + $data['object'] = $object->getObject(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/FineTuneNormalizer.php b/generated/Normalizer/FineTuneNormalizer.php index 4ff1718..18b797b 100644 --- a/generated/Normalizer/FineTuneNormalizer.php +++ b/generated/Normalizer/FineTuneNormalizer.php @@ -81,10 +81,6 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setModel($data['model']); unset($data['model']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('organization_id', $data)) { $object->setOrganizationId($data['organization_id']); unset($data['organization_id']); @@ -121,6 +117,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setValidationFiles($values_3); unset($data['validation_files']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value_4) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value_4; @@ -147,7 +147,6 @@ public function normalize($object, $format = null, array $context = []) $data['fine_tuned_model'] = $object->getFineTunedModel(); $data['hyperparams'] = $this->normalizer->normalize($object->getHyperparams(), 'json', $context); $data['model'] = $object->getModel(); - $data['object'] = $object->getObject(); $data['organization_id'] = $object->getOrganizationId(); $values_1 = []; foreach ($object->getResultFiles() as $value_1) { @@ -166,6 +165,7 @@ public function normalize($object, $format = null, array $context = []) $values_3[] = $this->normalizer->normalize($value_3, 'json', $context); } $data['validation_files'] = $values_3; + $data['object'] = $object->getObject(); foreach ($object as $key => $value_4) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value_4; diff --git a/generated/Normalizer/FineTuningJobHyperparametersNormalizer.php b/generated/Normalizer/FineTuningJobHyperparametersNormalizer.php index b957752..0244eae 100644 --- a/generated/Normalizer/FineTuningJobHyperparametersNormalizer.php +++ b/generated/Normalizer/FineTuningJobHyperparametersNormalizer.php @@ -49,12 +49,18 @@ public function denormalize($data, $class, $format = null, array $context = []) return $object; } if (\array_key_exists('n_epochs', $data)) { - $object->setNEpochs($data['n_epochs']); + $value = $data['n_epochs']; + if (is_string($data['n_epochs'])) { + $value = $data['n_epochs']; + } elseif (is_int($data['n_epochs'])) { + $value = $data['n_epochs']; + } + $object->setNEpochs($value); unset($data['n_epochs']); } - foreach ($data as $key => $value) { + foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value; + $object[$key] = $value_1; } } return $object; @@ -66,10 +72,16 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['n_epochs'] = $object->getNEpochs(); - foreach ($object as $key => $value) { + $value = $object->getNEpochs(); + if (is_string($object->getNEpochs())) { + $value = $object->getNEpochs(); + } elseif (is_int($object->getNEpochs())) { + $value = $object->getNEpochs(); + } + $data['n_epochs'] = $value; + foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value; + $data[$key] = $value_1; } } return $data; diff --git a/generated/Normalizer/FineTuningJobNormalizer.php b/generated/Normalizer/FineTuningJobNormalizer.php index 8e90d3f..037e7cb 100644 --- a/generated/Normalizer/FineTuningJobNormalizer.php +++ b/generated/Normalizer/FineTuningJobNormalizer.php @@ -84,10 +84,6 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setModel($data['model']); unset($data['model']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('organization_id', $data)) { $object->setOrganizationId($data['organization_id']); unset($data['organization_id']); @@ -120,6 +116,10 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('validation_file', $data) && $data['validation_file'] === null) { $object->setValidationFile(null); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value_1; @@ -141,7 +141,6 @@ public function normalize($object, $format = null, array $context = []) $data['finished_at'] = $object->getFinishedAt(); $data['hyperparameters'] = $this->normalizer->normalize($object->getHyperparameters(), 'json', $context); $data['model'] = $object->getModel(); - $data['object'] = $object->getObject(); $data['organization_id'] = $object->getOrganizationId(); $values = []; foreach ($object->getResultFiles() as $value) { @@ -152,6 +151,7 @@ public function normalize($object, $format = null, array $context = []) $data['trained_tokens'] = $object->getTrainedTokens(); $data['training_file'] = $object->getTrainingFile(); $data['validation_file'] = $object->getValidationFile(); + $data['object'] = $object->getObject(); foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value_1; diff --git a/generated/Normalizer/ListModelsResponseNormalizer.php b/generated/Normalizer/ListModelsResponseNormalizer.php index 8fd722d..e2f0900 100644 --- a/generated/Normalizer/ListModelsResponseNormalizer.php +++ b/generated/Normalizer/ListModelsResponseNormalizer.php @@ -49,10 +49,6 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('data', $data)) { $values = []; foreach ($data['data'] as $value) { @@ -61,6 +57,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setData($values); unset($data['data']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value_1; @@ -75,12 +75,12 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['object'] = $object->getObject(); $values = []; foreach ($object->getData() as $value) { $values[] = $this->normalizer->normalize($value, 'json', $context); } $data['data'] = $values; + $data['object'] = $object->getObject(); foreach ($object as $key => $value_1) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value_1; diff --git a/generated/Normalizer/MessageContentImageFileObjectNormalizer.php b/generated/Normalizer/MessageContentImageFileObjectNormalizer.php index fb4db40..51f4e93 100644 --- a/generated/Normalizer/MessageContentImageFileObjectNormalizer.php +++ b/generated/Normalizer/MessageContentImageFileObjectNormalizer.php @@ -49,14 +49,14 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('image_file', $data)) { $object->setImageFile($this->denormalizer->denormalize($data['image_file'], MessageContentImageFileObjectImageFile::class, 'json', $context)); unset($data['image_file']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -71,8 +71,8 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['type'] = $object->getType(); $data['image_file'] = $this->normalizer->normalize($object->getImageFile(), 'json', $context); + $data['type'] = $object->getType(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/MessageContentTextAnnotationsFileCitationObjectNormalizer.php b/generated/Normalizer/MessageContentTextAnnotationsFileCitationObjectNormalizer.php index ad66369..f1df851 100644 --- a/generated/Normalizer/MessageContentTextAnnotationsFileCitationObjectNormalizer.php +++ b/generated/Normalizer/MessageContentTextAnnotationsFileCitationObjectNormalizer.php @@ -49,10 +49,6 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('text', $data)) { $object->setText($data['text']); unset($data['text']); @@ -69,6 +65,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setEndIndex($data['end_index']); unset($data['end_index']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -83,11 +83,11 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['type'] = $object->getType(); $data['text'] = $object->getText(); $data['file_citation'] = $this->normalizer->normalize($object->getFileCitation(), 'json', $context); $data['start_index'] = $object->getStartIndex(); $data['end_index'] = $object->getEndIndex(); + $data['type'] = $object->getType(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/MessageContentTextAnnotationsFilePathObjectNormalizer.php b/generated/Normalizer/MessageContentTextAnnotationsFilePathObjectNormalizer.php index 67bd1b6..d25af74 100644 --- a/generated/Normalizer/MessageContentTextAnnotationsFilePathObjectNormalizer.php +++ b/generated/Normalizer/MessageContentTextAnnotationsFilePathObjectNormalizer.php @@ -49,10 +49,6 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('text', $data)) { $object->setText($data['text']); unset($data['text']); @@ -69,6 +65,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setEndIndex($data['end_index']); unset($data['end_index']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -83,11 +83,11 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['type'] = $object->getType(); $data['text'] = $object->getText(); $data['file_path'] = $this->normalizer->normalize($object->getFilePath(), 'json', $context); $data['start_index'] = $object->getStartIndex(); $data['end_index'] = $object->getEndIndex(); + $data['type'] = $object->getType(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/MessageContentTextObjectNormalizer.php b/generated/Normalizer/MessageContentTextObjectNormalizer.php index e41d5a0..2888f3d 100644 --- a/generated/Normalizer/MessageContentTextObjectNormalizer.php +++ b/generated/Normalizer/MessageContentTextObjectNormalizer.php @@ -49,14 +49,14 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('text', $data)) { $object->setText($this->denormalizer->denormalize($data['text'], MessageContentTextObjectText::class, 'json', $context)); unset($data['text']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -71,8 +71,8 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['type'] = $object->getType(); $data['text'] = $this->normalizer->normalize($object->getText(), 'json', $context); + $data['type'] = $object->getType(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/MessageContentTextObjectTextNormalizer.php b/generated/Normalizer/MessageContentTextObjectTextNormalizer.php index 6d85893..2cf7c90 100644 --- a/generated/Normalizer/MessageContentTextObjectTextNormalizer.php +++ b/generated/Normalizer/MessageContentTextObjectTextNormalizer.php @@ -6,6 +6,8 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; +use Sourceability\OpenAIClient\Generated\Model\MessageContentTextAnnotationsFileCitationObject; +use Sourceability\OpenAIClient\Generated\Model\MessageContentTextAnnotationsFilePathObject; use Sourceability\OpenAIClient\Generated\Model\MessageContentTextObjectText; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; @@ -55,14 +57,20 @@ public function denormalize($data, $class, $format = null, array $context = []) if (\array_key_exists('annotations', $data)) { $values = []; foreach ($data['annotations'] as $value) { - $values[] = $value; + $value_1 = $value; + if (is_array($value) and (isset($value['type']) and $value['type'] === 'file_citation') and isset($value['text']) and isset($value['file_citation']) and isset($value['start_index']) and isset($value['end_index'])) { + $value_1 = $this->denormalizer->denormalize($value, MessageContentTextAnnotationsFileCitationObject::class, 'json', $context); + } elseif (is_array($value) and (isset($value['type']) and $value['type'] === 'file_path') and isset($value['text']) and isset($value['file_path']) and isset($value['start_index']) and isset($value['end_index'])) { + $value_1 = $this->denormalizer->denormalize($value, MessageContentTextAnnotationsFilePathObject::class, 'json', $context); + } + $values[] = $value_1; } $object->setAnnotations($values); unset($data['annotations']); } - foreach ($data as $key => $value_1) { + foreach ($data as $key => $value_2) { if (preg_match('/.*/', (string) $key)) { - $object[$key] = $value_1; + $object[$key] = $value_2; } } return $object; @@ -77,12 +85,18 @@ public function normalize($object, $format = null, array $context = []) $data['value'] = $object->getValue(); $values = []; foreach ($object->getAnnotations() as $value) { - $values[] = $value; + $value_1 = $value; + if (is_object($value)) { + $value_1 = $this->normalizer->normalize($value, 'json', $context); + } elseif (is_object($value)) { + $value_1 = $this->normalizer->normalize($value, 'json', $context); + } + $values[] = $value_1; } $data['annotations'] = $values; - foreach ($object as $key => $value_1) { + foreach ($object as $key => $value_2) { if (preg_match('/.*/', (string) $key)) { - $data[$key] = $value_1; + $data[$key] = $value_2; } } return $data; diff --git a/generated/Normalizer/MessageFileObjectNormalizer.php b/generated/Normalizer/MessageFileObjectNormalizer.php index 81be677..402b9ee 100644 --- a/generated/Normalizer/MessageFileObjectNormalizer.php +++ b/generated/Normalizer/MessageFileObjectNormalizer.php @@ -52,10 +52,6 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('created_at', $data)) { $object->setCreatedAt($data['created_at']); unset($data['created_at']); @@ -64,6 +60,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setMessageId($data['message_id']); unset($data['message_id']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -79,9 +79,9 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['object'] = $object->getObject(); $data['created_at'] = $object->getCreatedAt(); $data['message_id'] = $object->getMessageId(); + $data['object'] = $object->getObject(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/MessageObjectNormalizer.php b/generated/Normalizer/MessageObjectNormalizer.php index 0eb54d6..6b6feeb 100644 --- a/generated/Normalizer/MessageObjectNormalizer.php +++ b/generated/Normalizer/MessageObjectNormalizer.php @@ -6,6 +6,8 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; +use Sourceability\OpenAIClient\Generated\Model\MessageContentImageFileObject; +use Sourceability\OpenAIClient\Generated\Model\MessageContentTextObject; use Sourceability\OpenAIClient\Generated\Model\MessageObject; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; @@ -52,10 +54,6 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('created_at', $data)) { $object->setCreatedAt($data['created_at']); unset($data['created_at']); @@ -71,7 +69,13 @@ public function denormalize($data, $class, $format = null, array $context = []) if (\array_key_exists('content', $data)) { $values = []; foreach ($data['content'] as $value) { - $values[] = $value; + $value_1 = $value; + if (is_array($value) and (isset($value['type']) and $value['type'] === 'image_file') and isset($value['image_file'])) { + $value_1 = $this->denormalizer->denormalize($value, MessageContentImageFileObject::class, 'json', $context); + } elseif (is_array($value) and (isset($value['type']) and $value['type'] === 'text') and isset($value['text'])) { + $value_1 = $this->denormalizer->denormalize($value, MessageContentTextObject::class, 'json', $context); + } + $values[] = $value_1; } $object->setContent($values); unset($data['content']); @@ -88,27 +92,31 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('run_id', $data) && $data['run_id'] === null) { $object->setRunId(null); } - if (\array_key_exists('file_ids', $data)) { - $values_1 = []; - foreach ($data['file_ids'] as $value_1) { - $values_1[] = $value_1; - } - $object->setFileIds($values_1); - unset($data['file_ids']); - } if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { - $values_2 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + $values_1 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); foreach ($data['metadata'] as $key => $value_2) { - $values_2[$key] = $value_2; + $values_1[$key] = $value_2; } - $object->setMetadata($values_2); + $object->setMetadata($values_1); unset($data['metadata']); } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { $object->setMetadata(null); } - foreach ($data as $key_1 => $value_3) { + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } + if (\array_key_exists('file_ids', $data)) { + $values_2 = []; + foreach ($data['file_ids'] as $value_3) { + $values_2[] = $value_3; + } + $object->setFileIds($values_2); + unset($data['file_ids']); + } + foreach ($data as $key_1 => $value_4) { if (preg_match('/.*/', (string) $key_1)) { - $object[$key_1] = $value_3; + $object[$key_1] = $value_4; } } return $object; @@ -121,30 +129,36 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['object'] = $object->getObject(); $data['created_at'] = $object->getCreatedAt(); $data['thread_id'] = $object->getThreadId(); $data['role'] = $object->getRole(); $values = []; foreach ($object->getContent() as $value) { - $values[] = $value; + $value_1 = $value; + if (is_object($value)) { + $value_1 = $this->normalizer->normalize($value, 'json', $context); + } elseif (is_object($value)) { + $value_1 = $this->normalizer->normalize($value, 'json', $context); + } + $values[] = $value_1; } $data['content'] = $values; $data['assistant_id'] = $object->getAssistantId(); $data['run_id'] = $object->getRunId(); $values_1 = []; - foreach ($object->getFileIds() as $value_1) { - $values_1[] = $value_1; + foreach ($object->getMetadata() as $key => $value_2) { + $values_1[$key] = $value_2; } - $data['file_ids'] = $values_1; + $data['metadata'] = $values_1; + $data['object'] = $object->getObject(); $values_2 = []; - foreach ($object->getMetadata() as $key => $value_2) { - $values_2[$key] = $value_2; + foreach ($object->getFileIds() as $value_3) { + $values_2[] = $value_3; } - $data['metadata'] = $values_2; - foreach ($object as $key_1 => $value_3) { + $data['file_ids'] = $values_2; + foreach ($object as $key_1 => $value_4) { if (preg_match('/.*/', (string) $key_1)) { - $data[$key_1] = $value_3; + $data[$key_1] = $value_4; } } return $data; diff --git a/generated/Normalizer/ModelNormalizer.php b/generated/Normalizer/ModelNormalizer.php index 6c1bf16..648a26b 100644 --- a/generated/Normalizer/ModelNormalizer.php +++ b/generated/Normalizer/ModelNormalizer.php @@ -56,14 +56,14 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setCreated($data['created']); unset($data['created']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('owned_by', $data)) { $object->setOwnedBy($data['owned_by']); unset($data['owned_by']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -80,8 +80,8 @@ public function normalize($object, $format = null, array $context = []) $data = []; $data['id'] = $object->getId(); $data['created'] = $object->getCreated(); - $data['object'] = $object->getObject(); $data['owned_by'] = $object->getOwnedBy(); + $data['object'] = $object->getObject(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/ModifyAssistantRequestNormalizer.php b/generated/Normalizer/ModifyAssistantRequestNormalizer.php index 632cf82..bc3c5a8 100644 --- a/generated/Normalizer/ModifyAssistantRequestNormalizer.php +++ b/generated/Normalizer/ModifyAssistantRequestNormalizer.php @@ -6,6 +6,9 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsCode; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsFunction; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsRetrieval; use Sourceability\OpenAIClient\Generated\Model\ModifyAssistantRequest; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\CheckArray; use Sourceability\OpenAIClient\Generated\Runtime\Normalizer\ValidatorTrait; @@ -49,7 +52,11 @@ public function denormalize($data, $class, $format = null, array $context = []) return $object; } if (\array_key_exists('model', $data)) { - $object->setModel($data['model']); + $value = $data['model']; + if (is_string($data['model'])) { + $value = $data['model']; + } + $object->setModel($value); } if (\array_key_exists('name', $data) && $data['name'] !== null) { $object->setName($data['name']); @@ -66,28 +73,36 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('instructions', $data) && $data['instructions'] === null) { $object->setInstructions(null); } - if (\array_key_exists('tools', $data)) { - $values = []; - foreach ($data['tools'] as $value) { - $values[] = $value; + if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { + $values = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['metadata'] as $key => $value_1) { + $values[$key] = $value_1; } - $object->setTools($values); + $object->setMetadata($values); + } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { + $object->setMetadata(null); } - if (\array_key_exists('file_ids', $data)) { + if (\array_key_exists('tools', $data)) { $values_1 = []; - foreach ($data['file_ids'] as $value_1) { - $values_1[] = $value_1; + foreach ($data['tools'] as $value_2) { + $value_3 = $value_2; + if (is_array($value_2) and (isset($value_2['type']) and $value_2['type'] === 'code_interpreter')) { + $value_3 = $this->denormalizer->denormalize($value_2, AssistantToolsCode::class, 'json', $context); + } elseif (is_array($value_2) and (isset($value_2['type']) and $value_2['type'] === 'retrieval')) { + $value_3 = $this->denormalizer->denormalize($value_2, AssistantToolsRetrieval::class, 'json', $context); + } elseif (is_array($value_2) and (isset($value_2['type']) and $value_2['type'] === 'function') and isset($value_2['function'])) { + $value_3 = $this->denormalizer->denormalize($value_2, AssistantToolsFunction::class, 'json', $context); + } + $values_1[] = $value_3; } - $object->setFileIds($values_1); + $object->setTools($values_1); } - if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { - $values_2 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - foreach ($data['metadata'] as $key => $value_2) { - $values_2[$key] = $value_2; + if (\array_key_exists('file_ids', $data)) { + $values_2 = []; + foreach ($data['file_ids'] as $value_4) { + $values_2[] = $value_4; } - $object->setMetadata($values_2); - } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { - $object->setMetadata(null); + $object->setFileIds($values_2); } return $object; } @@ -99,7 +114,11 @@ public function normalize($object, $format = null, array $context = []) { $data = []; if ($object->isInitialized('model') && $object->getModel() !== null) { - $data['model'] = $object->getModel(); + $value = $object->getModel(); + if (is_string($object->getModel())) { + $value = $object->getModel(); + } + $data['model'] = $value; } if ($object->isInitialized('name') && $object->getName() !== null) { $data['name'] = $object->getName(); @@ -110,26 +129,34 @@ public function normalize($object, $format = null, array $context = []) if ($object->isInitialized('instructions') && $object->getInstructions() !== null) { $data['instructions'] = $object->getInstructions(); } - if ($object->isInitialized('tools') && $object->getTools() !== null) { + if ($object->isInitialized('metadata') && $object->getMetadata() !== null) { $values = []; - foreach ($object->getTools() as $value) { - $values[] = $value; + foreach ($object->getMetadata() as $key => $value_1) { + $values[$key] = $value_1; } - $data['tools'] = $values; + $data['metadata'] = $values; } - if ($object->isInitialized('fileIds') && $object->getFileIds() !== null) { + if ($object->isInitialized('tools') && $object->getTools() !== null) { $values_1 = []; - foreach ($object->getFileIds() as $value_1) { - $values_1[] = $value_1; + foreach ($object->getTools() as $value_2) { + $value_3 = $value_2; + if (is_object($value_2)) { + $value_3 = $this->normalizer->normalize($value_2, 'json', $context); + } elseif (is_object($value_2)) { + $value_3 = $this->normalizer->normalize($value_2, 'json', $context); + } elseif (is_object($value_2)) { + $value_3 = $this->normalizer->normalize($value_2, 'json', $context); + } + $values_1[] = $value_3; } - $data['file_ids'] = $values_1; + $data['tools'] = $values_1; } - if ($object->isInitialized('metadata') && $object->getMetadata() !== null) { + if ($object->isInitialized('fileIds') && $object->getFileIds() !== null) { $values_2 = []; - foreach ($object->getMetadata() as $key => $value_2) { - $values_2[$key] = $value_2; + foreach ($object->getFileIds() as $value_4) { + $values_2[] = $value_4; } - $data['metadata'] = $values_2; + $data['file_ids'] = $values_2; } return $data; } diff --git a/generated/Normalizer/OpenAIFileNormalizer.php b/generated/Normalizer/OpenAIFileNormalizer.php index 7eee2b8..df0fd99 100644 --- a/generated/Normalizer/OpenAIFileNormalizer.php +++ b/generated/Normalizer/OpenAIFileNormalizer.php @@ -64,10 +64,6 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setFilename($data['filename']); unset($data['filename']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('purpose', $data)) { $object->setPurpose($data['purpose']); unset($data['purpose']); @@ -80,6 +76,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setStatusDetails($data['status_details']); unset($data['status_details']); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -98,12 +98,12 @@ public function normalize($object, $format = null, array $context = []) $data['bytes'] = $object->getBytes(); $data['created_at'] = $object->getCreatedAt(); $data['filename'] = $object->getFilename(); - $data['object'] = $object->getObject(); $data['purpose'] = $object->getPurpose(); $data['status'] = $object->getStatus(); if ($object->isInitialized('statusDetails') && $object->getStatusDetails() !== null) { $data['status_details'] = $object->getStatusDetails(); } + $data['object'] = $object->getObject(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/RunObjectNormalizer.php b/generated/Normalizer/RunObjectNormalizer.php index 4e582b2..2351bc1 100644 --- a/generated/Normalizer/RunObjectNormalizer.php +++ b/generated/Normalizer/RunObjectNormalizer.php @@ -6,6 +6,9 @@ use ArrayObject; use Jane\Component\JsonSchemaRuntime\Reference; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsCode; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsFunction; +use Sourceability\OpenAIClient\Generated\Model\AssistantToolsRetrieval; use Sourceability\OpenAIClient\Generated\Model\RunObject; use Sourceability\OpenAIClient\Generated\Model\RunObjectLastError; use Sourceability\OpenAIClient\Generated\Model\RunObjectRequiredAction; @@ -54,10 +57,6 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('created_at', $data)) { $object->setCreatedAt($data['created_at']); unset($data['created_at']); @@ -122,35 +121,47 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setInstructions($data['instructions']); unset($data['instructions']); } + if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { + $values = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); + foreach ($data['metadata'] as $key => $value) { + $values[$key] = $value; + } + $object->setMetadata($values); + unset($data['metadata']); + } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { + $object->setMetadata(null); + } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } if (\array_key_exists('tools', $data)) { - $values = []; - foreach ($data['tools'] as $value) { - $values[] = $value; + $values_1 = []; + foreach ($data['tools'] as $value_1) { + $value_2 = $value_1; + if (is_array($value_1) and (isset($value_1['type']) and $value_1['type'] === 'code_interpreter')) { + $value_2 = $this->denormalizer->denormalize($value_1, AssistantToolsCode::class, 'json', $context); + } elseif (is_array($value_1) and (isset($value_1['type']) and $value_1['type'] === 'retrieval')) { + $value_2 = $this->denormalizer->denormalize($value_1, AssistantToolsRetrieval::class, 'json', $context); + } elseif (is_array($value_1) and (isset($value_1['type']) and $value_1['type'] === 'function') and isset($value_1['function'])) { + $value_2 = $this->denormalizer->denormalize($value_1, AssistantToolsFunction::class, 'json', $context); + } + $values_1[] = $value_2; } - $object->setTools($values); + $object->setTools($values_1); unset($data['tools']); } if (\array_key_exists('file_ids', $data)) { - $values_1 = []; - foreach ($data['file_ids'] as $value_1) { - $values_1[] = $value_1; + $values_2 = []; + foreach ($data['file_ids'] as $value_3) { + $values_2[] = $value_3; } - $object->setFileIds($values_1); + $object->setFileIds($values_2); unset($data['file_ids']); } - if (\array_key_exists('metadata', $data) && $data['metadata'] !== null) { - $values_2 = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); - foreach ($data['metadata'] as $key => $value_2) { - $values_2[$key] = $value_2; - } - $object->setMetadata($values_2); - unset($data['metadata']); - } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { - $object->setMetadata(null); - } - foreach ($data as $key_1 => $value_3) { + foreach ($data as $key_1 => $value_4) { if (preg_match('/.*/', (string) $key_1)) { - $object[$key_1] = $value_3; + $object[$key_1] = $value_4; } } return $object; @@ -163,7 +174,6 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['object'] = $object->getObject(); $data['created_at'] = $object->getCreatedAt(); $data['thread_id'] = $object->getThreadId(); $data['assistant_id'] = $object->getAssistantId(); @@ -178,23 +188,32 @@ public function normalize($object, $format = null, array $context = []) $data['model'] = $object->getModel(); $data['instructions'] = $object->getInstructions(); $values = []; - foreach ($object->getTools() as $value) { - $values[] = $value; + foreach ($object->getMetadata() as $key => $value) { + $values[$key] = $value; } - $data['tools'] = $values; + $data['metadata'] = $values; + $data['object'] = $object->getObject(); $values_1 = []; - foreach ($object->getFileIds() as $value_1) { - $values_1[] = $value_1; + foreach ($object->getTools() as $value_1) { + $value_2 = $value_1; + if (is_object($value_1)) { + $value_2 = $this->normalizer->normalize($value_1, 'json', $context); + } elseif (is_object($value_1)) { + $value_2 = $this->normalizer->normalize($value_1, 'json', $context); + } elseif (is_object($value_1)) { + $value_2 = $this->normalizer->normalize($value_1, 'json', $context); + } + $values_1[] = $value_2; } - $data['file_ids'] = $values_1; + $data['tools'] = $values_1; $values_2 = []; - foreach ($object->getMetadata() as $key => $value_2) { - $values_2[$key] = $value_2; + foreach ($object->getFileIds() as $value_3) { + $values_2[] = $value_3; } - $data['metadata'] = $values_2; - foreach ($object as $key_1 => $value_3) { + $data['file_ids'] = $values_2; + foreach ($object as $key_1 => $value_4) { if (preg_match('/.*/', (string) $key_1)) { - $data[$key_1] = $value_3; + $data[$key_1] = $value_4; } } return $data; diff --git a/generated/Normalizer/RunObjectRequiredActionNormalizer.php b/generated/Normalizer/RunObjectRequiredActionNormalizer.php index a554f6b..7739c4a 100644 --- a/generated/Normalizer/RunObjectRequiredActionNormalizer.php +++ b/generated/Normalizer/RunObjectRequiredActionNormalizer.php @@ -49,14 +49,14 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('submit_tool_outputs', $data)) { $object->setSubmitToolOutputs($this->denormalizer->denormalize($data['submit_tool_outputs'], RunObjectRequiredActionSubmitToolOutputs::class, 'json', $context)); unset($data['submit_tool_outputs']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -71,8 +71,8 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['type'] = $object->getType(); $data['submit_tool_outputs'] = $this->normalizer->normalize($object->getSubmitToolOutputs(), 'json', $context); + $data['type'] = $object->getType(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/RunStepDetailsMessageCreationObjectNormalizer.php b/generated/Normalizer/RunStepDetailsMessageCreationObjectNormalizer.php index 339dd4a..34e0465 100644 --- a/generated/Normalizer/RunStepDetailsMessageCreationObjectNormalizer.php +++ b/generated/Normalizer/RunStepDetailsMessageCreationObjectNormalizer.php @@ -49,14 +49,14 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('message_creation', $data)) { $object->setMessageCreation($this->denormalizer->denormalize($data['message_creation'], RunStepDetailsMessageCreationObjectMessageCreation::class, 'json', $context)); unset($data['message_creation']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -71,8 +71,8 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['type'] = $object->getType(); $data['message_creation'] = $this->normalizer->normalize($object->getMessageCreation(), 'json', $context); + $data['type'] = $object->getType(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/RunStepDetailsToolCallsCodeObjectNormalizer.php b/generated/Normalizer/RunStepDetailsToolCallsCodeObjectNormalizer.php index c70013e..729a2f5 100644 --- a/generated/Normalizer/RunStepDetailsToolCallsCodeObjectNormalizer.php +++ b/generated/Normalizer/RunStepDetailsToolCallsCodeObjectNormalizer.php @@ -53,14 +53,14 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('code_interpreter', $data)) { $object->setCodeInterpreter($this->denormalizer->denormalize($data['code_interpreter'], RunStepDetailsToolCallsCodeObjectCodeInterpreter::class, 'json', $context)); unset($data['code_interpreter']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -76,8 +76,8 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['type'] = $object->getType(); $data['code_interpreter'] = $this->normalizer->normalize($object->getCodeInterpreter(), 'json', $context); + $data['type'] = $object->getType(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/RunStepDetailsToolCallsCodeOutputImageObjectNormalizer.php b/generated/Normalizer/RunStepDetailsToolCallsCodeOutputImageObjectNormalizer.php index eee32fe..2f8478b 100644 --- a/generated/Normalizer/RunStepDetailsToolCallsCodeOutputImageObjectNormalizer.php +++ b/generated/Normalizer/RunStepDetailsToolCallsCodeOutputImageObjectNormalizer.php @@ -49,14 +49,14 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('image', $data)) { $object->setImage($this->denormalizer->denormalize($data['image'], RunStepDetailsToolCallsCodeOutputImageObjectImage::class, 'json', $context)); unset($data['image']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -71,8 +71,8 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['type'] = $object->getType(); $data['image'] = $this->normalizer->normalize($object->getImage(), 'json', $context); + $data['type'] = $object->getType(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/RunStepDetailsToolCallsCodeOutputLogsObjectNormalizer.php b/generated/Normalizer/RunStepDetailsToolCallsCodeOutputLogsObjectNormalizer.php index c320228..d76a381 100644 --- a/generated/Normalizer/RunStepDetailsToolCallsCodeOutputLogsObjectNormalizer.php +++ b/generated/Normalizer/RunStepDetailsToolCallsCodeOutputLogsObjectNormalizer.php @@ -48,14 +48,14 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('logs', $data)) { $object->setLogs($data['logs']); unset($data['logs']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -70,8 +70,8 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['type'] = $object->getType(); $data['logs'] = $object->getLogs(); + $data['type'] = $object->getType(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/RunStepDetailsToolCallsFunctionObjectNormalizer.php b/generated/Normalizer/RunStepDetailsToolCallsFunctionObjectNormalizer.php index f199861..ff9828c 100644 --- a/generated/Normalizer/RunStepDetailsToolCallsFunctionObjectNormalizer.php +++ b/generated/Normalizer/RunStepDetailsToolCallsFunctionObjectNormalizer.php @@ -53,14 +53,14 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('function', $data)) { $object->setFunction($this->denormalizer->denormalize($data['function'], RunStepDetailsToolCallsFunctionObjectFunction::class, 'json', $context)); unset($data['function']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -76,8 +76,8 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['type'] = $object->getType(); $data['function'] = $this->normalizer->normalize($object->getFunction(), 'json', $context); + $data['type'] = $object->getType(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/RunStepDetailsToolCallsObjectNormalizer.php b/generated/Normalizer/RunStepDetailsToolCallsObjectNormalizer.php index 6c8dc97..be20693 100644 --- a/generated/Normalizer/RunStepDetailsToolCallsObjectNormalizer.php +++ b/generated/Normalizer/RunStepDetailsToolCallsObjectNormalizer.php @@ -48,10 +48,6 @@ public function denormalize($data, $class, $format = null, array $context = []) if ($data === null || \is_array($data) === false) { return $object; } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('tool_calls', $data)) { $values = []; foreach ($data['tool_calls'] as $value) { @@ -64,6 +60,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setToolCalls($values); unset($data['tool_calls']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key_1 => $value_2) { if (preg_match('/.*/', (string) $key_1)) { $object[$key_1] = $value_2; @@ -78,7 +78,6 @@ public function denormalize($data, $class, $format = null, array $context = []) public function normalize($object, $format = null, array $context = []) { $data = []; - $data['type'] = $object->getType(); $values = []; foreach ($object->getToolCalls() as $value) { $values_1 = []; @@ -88,6 +87,7 @@ public function normalize($object, $format = null, array $context = []) $values[] = $values_1; } $data['tool_calls'] = $values; + $data['type'] = $object->getType(); foreach ($object as $key_1 => $value_2) { if (preg_match('/.*/', (string) $key_1)) { $data[$key_1] = $value_2; diff --git a/generated/Normalizer/RunStepDetailsToolCallsRetrievalObjectNormalizer.php b/generated/Normalizer/RunStepDetailsToolCallsRetrievalObjectNormalizer.php index 5186034..5a58b15 100644 --- a/generated/Normalizer/RunStepDetailsToolCallsRetrievalObjectNormalizer.php +++ b/generated/Normalizer/RunStepDetailsToolCallsRetrievalObjectNormalizer.php @@ -52,10 +52,6 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('retrieval', $data)) { $values = new ArrayObject([], ArrayObject::ARRAY_AS_PROPS); foreach ($data['retrieval'] as $key => $value) { @@ -64,6 +60,10 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setRetrieval($values); unset($data['retrieval']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key_1 => $value_1) { if (preg_match('/.*/', (string) $key_1)) { $object[$key_1] = $value_1; @@ -79,12 +79,12 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['type'] = $object->getType(); $values = []; foreach ($object->getRetrieval() as $key => $value) { $values[$key] = $value; } $data['retrieval'] = $values; + $data['type'] = $object->getType(); foreach ($object as $key_1 => $value_1) { if (preg_match('/.*/', (string) $key_1)) { $data[$key_1] = $value_1; diff --git a/generated/Normalizer/RunStepObjectNormalizer.php b/generated/Normalizer/RunStepObjectNormalizer.php index 4a72c3c..e9d8d37 100644 --- a/generated/Normalizer/RunStepObjectNormalizer.php +++ b/generated/Normalizer/RunStepObjectNormalizer.php @@ -53,10 +53,6 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('created_at', $data)) { $object->setCreatedAt($data['created_at']); unset($data['created_at']); @@ -129,6 +125,10 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { $object->setMetadata(null); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key_2 => $value_2) { if (preg_match('/.*/', (string) $key_2)) { $object[$key_2] = $value_2; @@ -144,7 +144,6 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['object'] = $object->getObject(); $data['created_at'] = $object->getCreatedAt(); $data['assistant_id'] = $object->getAssistantId(); $data['thread_id'] = $object->getThreadId(); @@ -166,6 +165,7 @@ public function normalize($object, $format = null, array $context = []) $values_1[$key_1] = $value_1; } $data['metadata'] = $values_1; + $data['object'] = $object->getObject(); foreach ($object as $key_2 => $value_2) { if (preg_match('/.*/', (string) $key_2)) { $data[$key_2] = $value_2; diff --git a/generated/Normalizer/RunToolCallObjectNormalizer.php b/generated/Normalizer/RunToolCallObjectNormalizer.php index f3d6d0a..6f75ee3 100644 --- a/generated/Normalizer/RunToolCallObjectNormalizer.php +++ b/generated/Normalizer/RunToolCallObjectNormalizer.php @@ -53,14 +53,14 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('type', $data)) { - $object->setType($data['type']); - unset($data['type']); - } if (\array_key_exists('function', $data)) { $object->setFunction($this->denormalizer->denormalize($data['function'], RunToolCallObjectFunction::class, 'json', $context)); unset($data['function']); } + if (\array_key_exists('type', $data)) { + $object->setType($data['type']); + unset($data['type']); + } foreach ($data as $key => $value) { if (preg_match('/.*/', (string) $key)) { $object[$key] = $value; @@ -76,8 +76,8 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['type'] = $object->getType(); $data['function'] = $this->normalizer->normalize($object->getFunction(), 'json', $context); + $data['type'] = $object->getType(); foreach ($object as $key => $value) { if (preg_match('/.*/', (string) $key)) { $data[$key] = $value; diff --git a/generated/Normalizer/ThreadObjectNormalizer.php b/generated/Normalizer/ThreadObjectNormalizer.php index c9eb6d0..28fc363 100644 --- a/generated/Normalizer/ThreadObjectNormalizer.php +++ b/generated/Normalizer/ThreadObjectNormalizer.php @@ -52,10 +52,6 @@ public function denormalize($data, $class, $format = null, array $context = []) $object->setId($data['id']); unset($data['id']); } - if (\array_key_exists('object', $data)) { - $object->setObject($data['object']); - unset($data['object']); - } if (\array_key_exists('created_at', $data)) { $object->setCreatedAt($data['created_at']); unset($data['created_at']); @@ -70,6 +66,10 @@ public function denormalize($data, $class, $format = null, array $context = []) } elseif (\array_key_exists('metadata', $data) && $data['metadata'] === null) { $object->setMetadata(null); } + if (\array_key_exists('object', $data)) { + $object->setObject($data['object']); + unset($data['object']); + } foreach ($data as $key_1 => $value_1) { if (preg_match('/.*/', (string) $key_1)) { $object[$key_1] = $value_1; @@ -85,13 +85,13 @@ public function normalize($object, $format = null, array $context = []) { $data = []; $data['id'] = $object->getId(); - $data['object'] = $object->getObject(); $data['created_at'] = $object->getCreatedAt(); $values = []; foreach ($object->getMetadata() as $key => $value) { $values[$key] = $value; } $data['metadata'] = $values; + $data['object'] = $object->getObject(); foreach ($object as $key_1 => $value_1) { if (preg_match('/.*/', (string) $key_1)) { $data[$key_1] = $value_1; From 5ba097e72b2000d0399410ff3b53f99fb1f911b7 Mon Sep 17 00:00:00 2001 From: Adrien Brault Date: Tue, 9 Jan 2024 16:05:55 +0100 Subject: [PATCH 5/8] docs: add vision example --- example-vision.php | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 example-vision.php diff --git a/example-vision.php b/example-vision.php new file mode 100644 index 0000000..f4e8e5d --- /dev/null +++ b/example-vision.php @@ -0,0 +1,53 @@ +createChatCompletion(new CreateChatCompletionRequest( + model: 'gpt-4-vision-preview', + temperature: 0, + messages: [ + new ChatCompletionRequestUserMessage( + [ + new ChatCompletionRequestMessageContentPartImage( + new ChatCompletionRequestMessageContentPartImageImageUrl( + 'https://symfony.com/screenshots/symfony-profiler.png' + ) + ), + new ChatCompletionRequestMessageContentPartText( + 'Reply with a JSON object describing the timeline shown.' + ) + ] + ) + ], + maxTokens: 2000, +)); + +$content = $completionResponse->getChoices()[0]->getMessage()->getContent(); +$content = preg_replace('#^\S*```json#', '', $content); +$content = trim($content, "`\n "); + +var_dump( + json_decode($content, true) +); From 13cbc97dcef71a891625d9ef8aa533f554cbca43 Mon Sep 17 00:00:00 2001 From: Adrien Brault Date: Tue, 9 Jan 2024 16:11:29 +0100 Subject: [PATCH 6/8] docs: move examples to examples/ --- example-vision.php => examples/chat-vision.php | 0 example-chat.php => examples/chat.php | 0 example.php => examples/completion.php | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename example-vision.php => examples/chat-vision.php (100%) rename example-chat.php => examples/chat.php (100%) rename example.php => examples/completion.php (100%) diff --git a/example-vision.php b/examples/chat-vision.php similarity index 100% rename from example-vision.php rename to examples/chat-vision.php diff --git a/example-chat.php b/examples/chat.php similarity index 100% rename from example-chat.php rename to examples/chat.php diff --git a/example.php b/examples/completion.php similarity index 100% rename from example.php rename to examples/completion.php From c03caf2d189b76a41f59c8dcb289b6420ac18d4e Mon Sep 17 00:00:00 2001 From: Adrien Brault Date: Tue, 9 Jan 2024 16:11:46 +0100 Subject: [PATCH 7/8] feat: support overriding base uri --- src/Client.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Client.php b/src/Client.php index 24759e1..8a56f5e 100644 --- a/src/Client.php +++ b/src/Client.php @@ -110,7 +110,7 @@ public function executeRawEndpoint(Endpoint $endpoint): ResponseInterface return $this->processEndpoint($endpoint)->wait(); } - public static function create($httpClient = null, array $additionalPlugins = [], array $additionalNormalizers = [], ?string $apiKey = null): static + public static function create($httpClient = null, array $additionalPlugins = [], array $additionalNormalizers = [], ?string $apiKey = null, ?string $baseUri = null): static { if ($apiKey !== null) { $additionalPlugins[] = new AuthenticationPlugin(new Bearer($apiKey)); @@ -119,7 +119,7 @@ public static function create($httpClient = null, array $additionalPlugins = [], if ($httpClient === null) { $httpClient = HttpAsyncClientDiscovery::find(); $plugins = []; - $uri = Psr17FactoryDiscovery::findUriFactory()->createUri('https://api.openai.com/v1'); + $uri = Psr17FactoryDiscovery::findUriFactory()->createUri($baseUri ?? 'https://api.openai.com/v1'); $plugins[] = new AddHostPlugin($uri); $plugins[] = new AddPathPlugin($uri); if (count($additionalPlugins) > 0) { From e1c8db28f990b9d55aeaab0945f9d55cb8e7b309 Mon Sep 17 00:00:00 2001 From: Adrien Brault Date: Tue, 9 Jan 2024 16:12:01 +0100 Subject: [PATCH 8/8] docs: add together.ai example --- example-together-ai.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 example-together-ai.php diff --git a/example-together-ai.php b/example-together-ai.php new file mode 100644 index 0000000..d6898dd --- /dev/null +++ b/example-together-ai.php @@ -0,0 +1,38 @@ +createChatCompletion(new CreateChatCompletionRequest( + model: 'mistralai/Mixtral-8x7B-Instruct-v0.1', + temperature: 0, + messages: [ + new ChatCompletionRequestUserMessage('The jane php library is very useful because') + ] +)); + +var_dump( + $completionResponse->getChoices()[0]->getMessage()->getContent() +);