diff --git a/README.md b/README.md index c2ec5629..776c079b 100644 --- a/README.md +++ b/README.md @@ -88,13 +88,12 @@ import com.openai.models.ChatCompletionCreateParams; import com.openai.models.ChatCompletionMessageParam; import com.openai.models.ChatCompletionUserMessageParam; import com.openai.models.ChatModel; -import java.util.List; ChatCompletionCreateParams params = ChatCompletionCreateParams.builder() - .messages(List.of(ChatCompletionMessageParam.ofChatCompletionUserMessageParam(ChatCompletionUserMessageParam.builder() + .addMessage(ChatCompletionMessageParam.ofChatCompletionUserMessageParam(ChatCompletionUserMessageParam.builder() .role(ChatCompletionUserMessageParam.Role.USER) .content(ChatCompletionUserMessageParam.Content.ofTextContent("Say this is a test")) - .build()))) + .build())) .model(ChatModel.O1) .build(); ChatCompletion chatCompletion = client.chat().completions().create(params); diff --git a/openai-java-core/src/test/kotlin/com/openai/models/AssistantTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/AssistantTest.kt index 598bc5bd..fbbf47a0 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/AssistantTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/AssistantTest.kt @@ -20,13 +20,11 @@ class AssistantTest { .model("model") .name("name") .object_(Assistant.Object.ASSISTANT) - .tools( - listOf( - AssistantTool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + AssistantTool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .responseFormat( @@ -39,12 +37,12 @@ class AssistantTest { Assistant.ToolResources.builder() .codeInterpreter( Assistant.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( Assistant.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) + .addVectorStoreId("string") .build() ) .build() @@ -80,12 +78,12 @@ class AssistantTest { Assistant.ToolResources.builder() .codeInterpreter( Assistant.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( Assistant.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) + .addVectorStoreId("string") .build() ) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/BatchTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/BatchTest.kt index 7d9226ba..eaed1679 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/BatchTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/BatchTest.kt @@ -25,15 +25,13 @@ class BatchTest { .errorFileId("error_file_id") .errors( Batch.Errors.builder() - .data( - listOf( - BatchError.builder() - .code("code") - .line(0L) - .message("message") - .param("param") - .build() - ) + .addData( + BatchError.builder() + .code("code") + .line(0L) + .message("message") + .param("param") + .build() ) .object_("object") .build() @@ -64,15 +62,13 @@ class BatchTest { assertThat(batch.errors()) .contains( Batch.Errors.builder() - .data( - listOf( - BatchError.builder() - .code("code") - .line(0L) - .message("message") - .param("param") - .build() - ) + .addData( + BatchError.builder() + .code("code") + .line(0L) + .message("message") + .param("param") + .build() ) .object_("object") .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/BetaAssistantCreateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/BetaAssistantCreateParamsTest.kt index 2049e1d1..6ef5f871 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/BetaAssistantCreateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/BetaAssistantCreateParamsTest.kt @@ -26,42 +26,35 @@ class BetaAssistantCreateParamsTest { BetaAssistantCreateParams.ToolResources.builder() .codeInterpreter( BetaAssistantCreateParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaAssistantCreateParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) - .vectorStores( - listOf( - BetaAssistantCreateParams.ToolResources.FileSearch.VectorStore - .builder() - .chunkingStrategy( - FileChunkingStrategyParam - .ofAutoFileChunkingStrategyParam( - AutoFileChunkingStrategyParam.builder() - .type( - AutoFileChunkingStrategyParam.Type.AUTO - ) - .build() - ) + .addVectorStoreId("string") + .addVectorStore( + BetaAssistantCreateParams.ToolResources.FileSearch.VectorStore + .builder() + .chunkingStrategy( + FileChunkingStrategyParam.ofAutoFileChunkingStrategyParam( + AutoFileChunkingStrategyParam.builder() + .type(AutoFileChunkingStrategyParam.Type.AUTO) + .build() ) - .fileIds(listOf("string")) - .metadata(JsonValue.from(mapOf())) - .build() - ) + ) + .addFileId("string") + .metadata(JsonValue.from(mapOf())) + .build() ) .build() ) .build() ) - .tools( - listOf( - AssistantTool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + AssistantTool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .topP(1.0) @@ -87,44 +80,38 @@ class BetaAssistantCreateParamsTest { BetaAssistantCreateParams.ToolResources.builder() .codeInterpreter( BetaAssistantCreateParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaAssistantCreateParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) - .vectorStores( - listOf( - BetaAssistantCreateParams.ToolResources.FileSearch - .VectorStore - .builder() - .chunkingStrategy( - FileChunkingStrategyParam - .ofAutoFileChunkingStrategyParam( - AutoFileChunkingStrategyParam.builder() - .type( - AutoFileChunkingStrategyParam.Type - .AUTO - ) - .build() - ) - ) - .fileIds(listOf("string")) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .addVectorStoreId("string") + .addVectorStore( + BetaAssistantCreateParams.ToolResources.FileSearch.VectorStore + .builder() + .chunkingStrategy( + FileChunkingStrategyParam + .ofAutoFileChunkingStrategyParam( + AutoFileChunkingStrategyParam.builder() + .type( + AutoFileChunkingStrategyParam.Type.AUTO + ) + .build() + ) + ) + .addFileId("string") + .metadata(JsonValue.from(mapOf())) + .build() ) .build() ) .build() ) - .tools( - listOf( - AssistantTool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + AssistantTool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .topP(1.0) @@ -148,30 +135,25 @@ class BetaAssistantCreateParamsTest { BetaAssistantCreateParams.ToolResources.builder() .codeInterpreter( BetaAssistantCreateParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaAssistantCreateParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) - .vectorStores( - listOf( - BetaAssistantCreateParams.ToolResources.FileSearch.VectorStore - .builder() - .chunkingStrategy( - FileChunkingStrategyParam - .ofAutoFileChunkingStrategyParam( - AutoFileChunkingStrategyParam.builder() - .type( - AutoFileChunkingStrategyParam.Type.AUTO - ) - .build() - ) + .addVectorStoreId("string") + .addVectorStore( + BetaAssistantCreateParams.ToolResources.FileSearch.VectorStore + .builder() + .chunkingStrategy( + FileChunkingStrategyParam.ofAutoFileChunkingStrategyParam( + AutoFileChunkingStrategyParam.builder() + .type(AutoFileChunkingStrategyParam.Type.AUTO) + .build() ) - .fileIds(listOf("string")) - .metadata(JsonValue.from(mapOf())) - .build() - ) + ) + .addFileId("string") + .metadata(JsonValue.from(mapOf())) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/BetaAssistantUpdateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/BetaAssistantUpdateParamsTest.kt index 2594a261..801ba81e 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/BetaAssistantUpdateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/BetaAssistantUpdateParamsTest.kt @@ -27,23 +27,21 @@ class BetaAssistantUpdateParamsTest { BetaAssistantUpdateParams.ToolResources.builder() .codeInterpreter( BetaAssistantUpdateParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaAssistantUpdateParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) + .addVectorStoreId("string") .build() ) .build() ) - .tools( - listOf( - AssistantTool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + AssistantTool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .topP(1.0) @@ -70,23 +68,21 @@ class BetaAssistantUpdateParamsTest { BetaAssistantUpdateParams.ToolResources.builder() .codeInterpreter( BetaAssistantUpdateParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaAssistantUpdateParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) + .addVectorStoreId("string") .build() ) .build() ) - .tools( - listOf( - AssistantTool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + AssistantTool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .topP(1.0) @@ -110,12 +106,12 @@ class BetaAssistantUpdateParamsTest { BetaAssistantUpdateParams.ToolResources.builder() .codeInterpreter( BetaAssistantUpdateParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaAssistantUpdateParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) + .addVectorStoreId("string") .build() ) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadCreateAndRunParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadCreateAndRunParamsTest.kt index 1bf5b201..144fa16a 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadCreateAndRunParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadCreateAndRunParamsTest.kt @@ -26,40 +26,29 @@ class BetaThreadCreateAndRunParamsTest { .temperature(1.0) .thread( BetaThreadCreateAndRunParams.Thread.builder() - .messages( - listOf( - BetaThreadCreateAndRunParams.Thread.Message.builder() - .content( - BetaThreadCreateAndRunParams.Thread.Message.Content - .ofTextContent("string") + .addMessage( + BetaThreadCreateAndRunParams.Thread.Message.builder() + .content( + BetaThreadCreateAndRunParams.Thread.Message.Content.ofTextContent( + "string" ) - .role(BetaThreadCreateAndRunParams.Thread.Message.Role.USER) - .attachments( - listOf( - BetaThreadCreateAndRunParams.Thread.Message.Attachment - .builder() - .fileId("file_id") - .tools( - listOf( - BetaThreadCreateAndRunParams.Thread.Message - .Attachment - .Tool - .ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type( - CodeInterpreterTool.Type - .CODE_INTERPRETER - ) - .build() - ) - ) + ) + .role(BetaThreadCreateAndRunParams.Thread.Message.Role.USER) + .addAttachment( + BetaThreadCreateAndRunParams.Thread.Message.Attachment.builder() + .fileId("file_id") + .addTool( + BetaThreadCreateAndRunParams.Thread.Message.Attachment.Tool + .ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) - .build() ) - ) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .build() + ) + .metadata(JsonValue.from(mapOf())) + .build() ) .metadata(JsonValue.from(mapOf())) .toolResources( @@ -67,35 +56,31 @@ class BetaThreadCreateAndRunParamsTest { .codeInterpreter( BetaThreadCreateAndRunParams.Thread.ToolResources.CodeInterpreter .builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaThreadCreateAndRunParams.Thread.ToolResources.FileSearch .builder() - .vectorStoreIds(listOf("string")) - .vectorStores( - listOf( - BetaThreadCreateAndRunParams.Thread.ToolResources - .FileSearch - .VectorStore - .builder() - .chunkingStrategy( - FileChunkingStrategyParam - .ofAutoFileChunkingStrategyParam( - AutoFileChunkingStrategyParam.builder() - .type( - AutoFileChunkingStrategyParam - .Type - .AUTO - ) - .build() - ) - ) - .fileIds(listOf("string")) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .addVectorStoreId("string") + .addVectorStore( + BetaThreadCreateAndRunParams.Thread.ToolResources.FileSearch + .VectorStore + .builder() + .chunkingStrategy( + FileChunkingStrategyParam + .ofAutoFileChunkingStrategyParam( + AutoFileChunkingStrategyParam.builder() + .type( + AutoFileChunkingStrategyParam.Type + .AUTO + ) + .build() + ) + ) + .addFileId("string") + .metadata(JsonValue.from(mapOf())) + .build() ) .build() ) @@ -110,23 +95,21 @@ class BetaThreadCreateAndRunParamsTest { BetaThreadCreateAndRunParams.ToolResources.builder() .codeInterpreter( BetaThreadCreateAndRunParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaThreadCreateAndRunParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) + .addVectorStoreId("string") .build() ) .build() ) - .tools( - listOf( - BetaThreadCreateAndRunParams.Tool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + BetaThreadCreateAndRunParams.Tool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .topP(1.0) @@ -158,40 +141,32 @@ class BetaThreadCreateAndRunParamsTest { .temperature(1.0) .thread( BetaThreadCreateAndRunParams.Thread.builder() - .messages( - listOf( - BetaThreadCreateAndRunParams.Thread.Message.builder() - .content( - BetaThreadCreateAndRunParams.Thread.Message.Content - .ofTextContent("string") - ) - .role(BetaThreadCreateAndRunParams.Thread.Message.Role.USER) - .attachments( - listOf( + .addMessage( + BetaThreadCreateAndRunParams.Thread.Message.builder() + .content( + BetaThreadCreateAndRunParams.Thread.Message.Content + .ofTextContent("string") + ) + .role(BetaThreadCreateAndRunParams.Thread.Message.Role.USER) + .addAttachment( + BetaThreadCreateAndRunParams.Thread.Message.Attachment.builder() + .fileId("file_id") + .addTool( BetaThreadCreateAndRunParams.Thread.Message.Attachment - .builder() - .fileId("file_id") - .tools( - listOf( - BetaThreadCreateAndRunParams.Thread.Message - .Attachment - .Tool - .ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type( - CodeInterpreterTool.Type - .CODE_INTERPRETER - ) - .build() - ) - ) + .Tool + .ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type( + CodeInterpreterTool.Type + .CODE_INTERPRETER + ) + .build() ) - .build() ) - ) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .build() + ) + .metadata(JsonValue.from(mapOf())) + .build() ) .metadata(JsonValue.from(mapOf())) .toolResources( @@ -200,36 +175,33 @@ class BetaThreadCreateAndRunParamsTest { BetaThreadCreateAndRunParams.Thread.ToolResources .CodeInterpreter .builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaThreadCreateAndRunParams.Thread.ToolResources.FileSearch .builder() - .vectorStoreIds(listOf("string")) - .vectorStores( - listOf( - BetaThreadCreateAndRunParams.Thread.ToolResources - .FileSearch - .VectorStore - .builder() - .chunkingStrategy( - FileChunkingStrategyParam - .ofAutoFileChunkingStrategyParam( - AutoFileChunkingStrategyParam - .builder() - .type( - AutoFileChunkingStrategyParam - .Type - .AUTO - ) - .build() - ) - ) - .fileIds(listOf("string")) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .addVectorStoreId("string") + .addVectorStore( + BetaThreadCreateAndRunParams.Thread.ToolResources + .FileSearch + .VectorStore + .builder() + .chunkingStrategy( + FileChunkingStrategyParam + .ofAutoFileChunkingStrategyParam( + AutoFileChunkingStrategyParam.builder() + .type( + AutoFileChunkingStrategyParam + .Type + .AUTO + ) + .build() + ) + ) + .addFileId("string") + .metadata(JsonValue.from(mapOf())) + .build() ) .build() ) @@ -244,23 +216,21 @@ class BetaThreadCreateAndRunParamsTest { BetaThreadCreateAndRunParams.ToolResources.builder() .codeInterpreter( BetaThreadCreateAndRunParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaThreadCreateAndRunParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) + .addVectorStoreId("string") .build() ) .build() ) - .tools( - listOf( - BetaThreadCreateAndRunParams.Tool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + BetaThreadCreateAndRunParams.Tool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .topP(1.0) @@ -290,40 +260,29 @@ class BetaThreadCreateAndRunParamsTest { assertThat(body.thread()) .contains( BetaThreadCreateAndRunParams.Thread.builder() - .messages( - listOf( - BetaThreadCreateAndRunParams.Thread.Message.builder() - .content( - BetaThreadCreateAndRunParams.Thread.Message.Content - .ofTextContent("string") + .addMessage( + BetaThreadCreateAndRunParams.Thread.Message.builder() + .content( + BetaThreadCreateAndRunParams.Thread.Message.Content.ofTextContent( + "string" ) - .role(BetaThreadCreateAndRunParams.Thread.Message.Role.USER) - .attachments( - listOf( - BetaThreadCreateAndRunParams.Thread.Message.Attachment - .builder() - .fileId("file_id") - .tools( - listOf( - BetaThreadCreateAndRunParams.Thread.Message - .Attachment - .Tool - .ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type( - CodeInterpreterTool.Type - .CODE_INTERPRETER - ) - .build() - ) - ) + ) + .role(BetaThreadCreateAndRunParams.Thread.Message.Role.USER) + .addAttachment( + BetaThreadCreateAndRunParams.Thread.Message.Attachment.builder() + .fileId("file_id") + .addTool( + BetaThreadCreateAndRunParams.Thread.Message.Attachment.Tool + .ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) - .build() ) - ) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .build() + ) + .metadata(JsonValue.from(mapOf())) + .build() ) .metadata(JsonValue.from(mapOf())) .toolResources( @@ -331,35 +290,31 @@ class BetaThreadCreateAndRunParamsTest { .codeInterpreter( BetaThreadCreateAndRunParams.Thread.ToolResources.CodeInterpreter .builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaThreadCreateAndRunParams.Thread.ToolResources.FileSearch .builder() - .vectorStoreIds(listOf("string")) - .vectorStores( - listOf( - BetaThreadCreateAndRunParams.Thread.ToolResources - .FileSearch - .VectorStore - .builder() - .chunkingStrategy( - FileChunkingStrategyParam - .ofAutoFileChunkingStrategyParam( - AutoFileChunkingStrategyParam.builder() - .type( - AutoFileChunkingStrategyParam - .Type - .AUTO - ) - .build() - ) - ) - .fileIds(listOf("string")) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .addVectorStoreId("string") + .addVectorStore( + BetaThreadCreateAndRunParams.Thread.ToolResources.FileSearch + .VectorStore + .builder() + .chunkingStrategy( + FileChunkingStrategyParam + .ofAutoFileChunkingStrategyParam( + AutoFileChunkingStrategyParam.builder() + .type( + AutoFileChunkingStrategyParam.Type + .AUTO + ) + .build() + ) + ) + .addFileId("string") + .metadata(JsonValue.from(mapOf())) + .build() ) .build() ) @@ -374,12 +329,12 @@ class BetaThreadCreateAndRunParamsTest { BetaThreadCreateAndRunParams.ToolResources.builder() .codeInterpreter( BetaThreadCreateAndRunParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaThreadCreateAndRunParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) + .addVectorStoreId("string") .build() ) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadCreateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadCreateParamsTest.kt index 8ab2728a..c80bc65b 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadCreateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadCreateParamsTest.kt @@ -11,64 +11,50 @@ class BetaThreadCreateParamsTest { @Test fun createBetaThreadCreateParams() { BetaThreadCreateParams.builder() - .messages( - listOf( - BetaThreadCreateParams.Message.builder() - .content(BetaThreadCreateParams.Message.Content.ofTextContent("string")) - .role(BetaThreadCreateParams.Message.Role.USER) - .attachments( - listOf( - BetaThreadCreateParams.Message.Attachment.builder() - .fileId("file_id") - .tools( - listOf( - BetaThreadCreateParams.Message.Attachment.Tool - .ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type( - CodeInterpreterTool.Type - .CODE_INTERPRETER - ) - .build() - ) - ) + .addMessage( + BetaThreadCreateParams.Message.builder() + .content(BetaThreadCreateParams.Message.Content.ofTextContent("string")) + .role(BetaThreadCreateParams.Message.Role.USER) + .addAttachment( + BetaThreadCreateParams.Message.Attachment.builder() + .fileId("file_id") + .addTool( + BetaThreadCreateParams.Message.Attachment.Tool + .ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) - .build() ) - ) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .build() + ) + .metadata(JsonValue.from(mapOf())) + .build() ) .metadata(JsonValue.from(mapOf())) .toolResources( BetaThreadCreateParams.ToolResources.builder() .codeInterpreter( BetaThreadCreateParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaThreadCreateParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) - .vectorStores( - listOf( - BetaThreadCreateParams.ToolResources.FileSearch.VectorStore - .builder() - .chunkingStrategy( - FileChunkingStrategyParam - .ofAutoFileChunkingStrategyParam( - AutoFileChunkingStrategyParam.builder() - .type( - AutoFileChunkingStrategyParam.Type.AUTO - ) - .build() - ) + .addVectorStoreId("string") + .addVectorStore( + BetaThreadCreateParams.ToolResources.FileSearch.VectorStore + .builder() + .chunkingStrategy( + FileChunkingStrategyParam.ofAutoFileChunkingStrategyParam( + AutoFileChunkingStrategyParam.builder() + .type(AutoFileChunkingStrategyParam.Type.AUTO) + .build() ) - .fileIds(listOf("string")) - .metadata(JsonValue.from(mapOf())) - .build() - ) + ) + .addFileId("string") + .metadata(JsonValue.from(mapOf())) + .build() ) .build() ) @@ -81,65 +67,53 @@ class BetaThreadCreateParamsTest { fun getBody() { val params = BetaThreadCreateParams.builder() - .messages( - listOf( - BetaThreadCreateParams.Message.builder() - .content(BetaThreadCreateParams.Message.Content.ofTextContent("string")) - .role(BetaThreadCreateParams.Message.Role.USER) - .attachments( - listOf( - BetaThreadCreateParams.Message.Attachment.builder() - .fileId("file_id") - .tools( - listOf( - BetaThreadCreateParams.Message.Attachment.Tool - .ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type( - CodeInterpreterTool.Type - .CODE_INTERPRETER - ) - .build() - ) - ) + .addMessage( + BetaThreadCreateParams.Message.builder() + .content(BetaThreadCreateParams.Message.Content.ofTextContent("string")) + .role(BetaThreadCreateParams.Message.Role.USER) + .addAttachment( + BetaThreadCreateParams.Message.Attachment.builder() + .fileId("file_id") + .addTool( + BetaThreadCreateParams.Message.Attachment.Tool + .ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) - .build() ) - ) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .build() + ) + .metadata(JsonValue.from(mapOf())) + .build() ) .metadata(JsonValue.from(mapOf())) .toolResources( BetaThreadCreateParams.ToolResources.builder() .codeInterpreter( BetaThreadCreateParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaThreadCreateParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) - .vectorStores( - listOf( - BetaThreadCreateParams.ToolResources.FileSearch.VectorStore - .builder() - .chunkingStrategy( - FileChunkingStrategyParam - .ofAutoFileChunkingStrategyParam( - AutoFileChunkingStrategyParam.builder() - .type( - AutoFileChunkingStrategyParam.Type - .AUTO - ) - .build() - ) - ) - .fileIds(listOf("string")) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .addVectorStoreId("string") + .addVectorStore( + BetaThreadCreateParams.ToolResources.FileSearch.VectorStore + .builder() + .chunkingStrategy( + FileChunkingStrategyParam + .ofAutoFileChunkingStrategyParam( + AutoFileChunkingStrategyParam.builder() + .type( + AutoFileChunkingStrategyParam.Type.AUTO + ) + .build() + ) + ) + .addFileId("string") + .metadata(JsonValue.from(mapOf())) + .build() ) .build() ) @@ -154,25 +128,18 @@ class BetaThreadCreateParamsTest { BetaThreadCreateParams.Message.builder() .content(BetaThreadCreateParams.Message.Content.ofTextContent("string")) .role(BetaThreadCreateParams.Message.Role.USER) - .attachments( - listOf( - BetaThreadCreateParams.Message.Attachment.builder() - .fileId("file_id") - .tools( - listOf( - BetaThreadCreateParams.Message.Attachment.Tool - .ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type( - CodeInterpreterTool.Type - .CODE_INTERPRETER - ) - .build() - ) + .addAttachment( + BetaThreadCreateParams.Message.Attachment.builder() + .fileId("file_id") + .addTool( + BetaThreadCreateParams.Message.Attachment.Tool + .ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) - ) - .build() - ) + ) + .build() ) .metadata(JsonValue.from(mapOf())) .build() @@ -184,30 +151,25 @@ class BetaThreadCreateParamsTest { BetaThreadCreateParams.ToolResources.builder() .codeInterpreter( BetaThreadCreateParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaThreadCreateParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) - .vectorStores( - listOf( - BetaThreadCreateParams.ToolResources.FileSearch.VectorStore - .builder() - .chunkingStrategy( - FileChunkingStrategyParam - .ofAutoFileChunkingStrategyParam( - AutoFileChunkingStrategyParam.builder() - .type( - AutoFileChunkingStrategyParam.Type.AUTO - ) - .build() - ) + .addVectorStoreId("string") + .addVectorStore( + BetaThreadCreateParams.ToolResources.FileSearch.VectorStore + .builder() + .chunkingStrategy( + FileChunkingStrategyParam.ofAutoFileChunkingStrategyParam( + AutoFileChunkingStrategyParam.builder() + .type(AutoFileChunkingStrategyParam.Type.AUTO) + .build() ) - .fileIds(listOf("string")) - .metadata(JsonValue.from(mapOf())) - .build() - ) + ) + .addFileId("string") + .metadata(JsonValue.from(mapOf())) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadMessageCreateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadMessageCreateParamsTest.kt index 9f4a1beb..35d9e80b 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadMessageCreateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadMessageCreateParamsTest.kt @@ -14,21 +14,17 @@ class BetaThreadMessageCreateParamsTest { .threadId("thread_id") .content(BetaThreadMessageCreateParams.Content.ofTextContent("string")) .role(BetaThreadMessageCreateParams.Role.USER) - .attachments( - listOf( - BetaThreadMessageCreateParams.Attachment.builder() - .fileId("file_id") - .tools( - listOf( - BetaThreadMessageCreateParams.Attachment.Tool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) - ) + .addAttachment( + BetaThreadMessageCreateParams.Attachment.builder() + .fileId("file_id") + .addTool( + BetaThreadMessageCreateParams.Attachment.Tool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) - .build() - ) + ) + .build() ) .metadata(JsonValue.from(mapOf())) .build() @@ -41,22 +37,17 @@ class BetaThreadMessageCreateParamsTest { .threadId("thread_id") .content(BetaThreadMessageCreateParams.Content.ofTextContent("string")) .role(BetaThreadMessageCreateParams.Role.USER) - .attachments( - listOf( - BetaThreadMessageCreateParams.Attachment.builder() - .fileId("file_id") - .tools( - listOf( - BetaThreadMessageCreateParams.Attachment.Tool - .ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) - ) + .addAttachment( + BetaThreadMessageCreateParams.Attachment.builder() + .fileId("file_id") + .addTool( + BetaThreadMessageCreateParams.Attachment.Tool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) - .build() - ) + ) + .build() ) .metadata(JsonValue.from(mapOf())) .build() @@ -70,13 +61,11 @@ class BetaThreadMessageCreateParamsTest { listOf( BetaThreadMessageCreateParams.Attachment.builder() .fileId("file_id") - .tools( - listOf( - BetaThreadMessageCreateParams.Attachment.Tool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + BetaThreadMessageCreateParams.Attachment.Tool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadRunCreateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadRunCreateParamsTest.kt index f92781e0..02874c6c 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadRunCreateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadRunCreateParamsTest.kt @@ -14,41 +14,29 @@ class BetaThreadRunCreateParamsTest { BetaThreadRunCreateParams.builder() .threadId("thread_id") .assistantId("assistant_id") - .include(listOf(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT)) + .addInclude(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT) .additionalInstructions("additional_instructions") - .additionalMessages( - listOf( - BetaThreadRunCreateParams.AdditionalMessage.builder() - .content( - BetaThreadRunCreateParams.AdditionalMessage.Content.ofTextContent( - "string" - ) - ) - .role(BetaThreadRunCreateParams.AdditionalMessage.Role.USER) - .attachments( - listOf( - BetaThreadRunCreateParams.AdditionalMessage.Attachment.builder() - .fileId("file_id") - .tools( - listOf( - BetaThreadRunCreateParams.AdditionalMessage.Attachment - .Tool - .ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type( - CodeInterpreterTool.Type - .CODE_INTERPRETER - ) - .build() - ) - ) + .addAdditionalMessage( + BetaThreadRunCreateParams.AdditionalMessage.builder() + .content( + BetaThreadRunCreateParams.AdditionalMessage.Content.ofTextContent("string") + ) + .role(BetaThreadRunCreateParams.AdditionalMessage.Role.USER) + .addAttachment( + BetaThreadRunCreateParams.AdditionalMessage.Attachment.builder() + .fileId("file_id") + .addTool( + BetaThreadRunCreateParams.AdditionalMessage.Attachment.Tool + .ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) - .build() ) - ) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .build() + ) + .metadata(JsonValue.from(mapOf())) + .build() ) .instructions("instructions") .maxCompletionTokens(256L) @@ -65,13 +53,11 @@ class BetaThreadRunCreateParamsTest { .toolChoice( AssistantToolChoiceOption.ofBehavior(AssistantToolChoiceOption.Behavior.NONE) ) - .tools( - listOf( - AssistantTool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + AssistantTool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .topP(1.0) @@ -90,42 +76,31 @@ class BetaThreadRunCreateParamsTest { BetaThreadRunCreateParams.builder() .threadId("thread_id") .assistantId("assistant_id") - .include(listOf(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT)) + .addInclude(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT) .additionalInstructions("additional_instructions") - .additionalMessages( - listOf( - BetaThreadRunCreateParams.AdditionalMessage.builder() - .content( - BetaThreadRunCreateParams.AdditionalMessage.Content.ofTextContent( - "string" - ) + .addAdditionalMessage( + BetaThreadRunCreateParams.AdditionalMessage.builder() + .content( + BetaThreadRunCreateParams.AdditionalMessage.Content.ofTextContent( + "string" ) - .role(BetaThreadRunCreateParams.AdditionalMessage.Role.USER) - .attachments( - listOf( - BetaThreadRunCreateParams.AdditionalMessage.Attachment.builder() - .fileId("file_id") - .tools( - listOf( - BetaThreadRunCreateParams.AdditionalMessage - .Attachment - .Tool - .ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type( - CodeInterpreterTool.Type - .CODE_INTERPRETER - ) - .build() - ) - ) + ) + .role(BetaThreadRunCreateParams.AdditionalMessage.Role.USER) + .addAttachment( + BetaThreadRunCreateParams.AdditionalMessage.Attachment.builder() + .fileId("file_id") + .addTool( + BetaThreadRunCreateParams.AdditionalMessage.Attachment.Tool + .ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) - .build() ) - ) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .build() + ) + .metadata(JsonValue.from(mapOf())) + .build() ) .instructions("instructions") .maxCompletionTokens(256L) @@ -142,13 +117,11 @@ class BetaThreadRunCreateParamsTest { .toolChoice( AssistantToolChoiceOption.ofBehavior(AssistantToolChoiceOption.Behavior.NONE) ) - .tools( - listOf( - AssistantTool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + AssistantTool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .topP(1.0) @@ -184,42 +157,31 @@ class BetaThreadRunCreateParamsTest { BetaThreadRunCreateParams.builder() .threadId("thread_id") .assistantId("assistant_id") - .include(listOf(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT)) + .addInclude(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT) .additionalInstructions("additional_instructions") - .additionalMessages( - listOf( - BetaThreadRunCreateParams.AdditionalMessage.builder() - .content( - BetaThreadRunCreateParams.AdditionalMessage.Content.ofTextContent( - "string" - ) + .addAdditionalMessage( + BetaThreadRunCreateParams.AdditionalMessage.builder() + .content( + BetaThreadRunCreateParams.AdditionalMessage.Content.ofTextContent( + "string" ) - .role(BetaThreadRunCreateParams.AdditionalMessage.Role.USER) - .attachments( - listOf( - BetaThreadRunCreateParams.AdditionalMessage.Attachment.builder() - .fileId("file_id") - .tools( - listOf( - BetaThreadRunCreateParams.AdditionalMessage - .Attachment - .Tool - .ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type( - CodeInterpreterTool.Type - .CODE_INTERPRETER - ) - .build() - ) - ) + ) + .role(BetaThreadRunCreateParams.AdditionalMessage.Role.USER) + .addAttachment( + BetaThreadRunCreateParams.AdditionalMessage.Attachment.builder() + .fileId("file_id") + .addTool( + BetaThreadRunCreateParams.AdditionalMessage.Attachment.Tool + .ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) - .build() ) - ) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .build() + ) + .metadata(JsonValue.from(mapOf())) + .build() ) .instructions("instructions") .maxCompletionTokens(256L) @@ -236,13 +198,11 @@ class BetaThreadRunCreateParamsTest { .toolChoice( AssistantToolChoiceOption.ofBehavior(AssistantToolChoiceOption.Behavior.NONE) ) - .tools( - listOf( - AssistantTool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + AssistantTool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .topP(1.0) @@ -267,26 +227,18 @@ class BetaThreadRunCreateParamsTest { ) ) .role(BetaThreadRunCreateParams.AdditionalMessage.Role.USER) - .attachments( - listOf( - BetaThreadRunCreateParams.AdditionalMessage.Attachment.builder() - .fileId("file_id") - .tools( - listOf( - BetaThreadRunCreateParams.AdditionalMessage.Attachment - .Tool - .ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type( - CodeInterpreterTool.Type - .CODE_INTERPRETER - ) - .build() - ) + .addAttachment( + BetaThreadRunCreateParams.AdditionalMessage.Attachment.builder() + .fileId("file_id") + .addTool( + BetaThreadRunCreateParams.AdditionalMessage.Attachment.Tool + .ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) - ) - .build() - ) + ) + .build() ) .metadata(JsonValue.from(mapOf())) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadRunStepListParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadRunStepListParamsTest.kt index 4b8a3354..73ff43b8 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadRunStepListParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadRunStepListParamsTest.kt @@ -15,7 +15,7 @@ class BetaThreadRunStepListParamsTest { .runId("run_id") .after("after") .before("before") - .include(listOf(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT)) + .addInclude(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT) .limit(0L) .order(BetaThreadRunStepListParams.Order.ASC) .build() @@ -29,7 +29,7 @@ class BetaThreadRunStepListParamsTest { .runId("run_id") .after("after") .before("before") - .include(listOf(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT)) + .addInclude(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT) .limit(0L) .order(BetaThreadRunStepListParams.Order.ASC) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadRunStepRetrieveParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadRunStepRetrieveParamsTest.kt index 491c186b..805a68db 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadRunStepRetrieveParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadRunStepRetrieveParamsTest.kt @@ -14,7 +14,7 @@ class BetaThreadRunStepRetrieveParamsTest { .threadId("thread_id") .runId("run_id") .stepId("step_id") - .include(listOf(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT)) + .addInclude(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT) .build() } @@ -25,7 +25,7 @@ class BetaThreadRunStepRetrieveParamsTest { .threadId("thread_id") .runId("run_id") .stepId("step_id") - .include(listOf(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT)) + .addInclude(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT) .build() val expected = QueryParams.builder() expected.put( diff --git a/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadRunSubmitToolOutputsParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadRunSubmitToolOutputsParamsTest.kt index d9559171..0685d02b 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadRunSubmitToolOutputsParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadRunSubmitToolOutputsParamsTest.kt @@ -12,13 +12,11 @@ class BetaThreadRunSubmitToolOutputsParamsTest { BetaThreadRunSubmitToolOutputsParams.builder() .threadId("thread_id") .runId("run_id") - .toolOutputs( - listOf( - BetaThreadRunSubmitToolOutputsParams.ToolOutput.builder() - .output("output") - .toolCallId("tool_call_id") - .build() - ) + .addToolOutput( + BetaThreadRunSubmitToolOutputsParams.ToolOutput.builder() + .output("output") + .toolCallId("tool_call_id") + .build() ) .build() } @@ -29,13 +27,11 @@ class BetaThreadRunSubmitToolOutputsParamsTest { BetaThreadRunSubmitToolOutputsParams.builder() .threadId("thread_id") .runId("run_id") - .toolOutputs( - listOf( - BetaThreadRunSubmitToolOutputsParams.ToolOutput.builder() - .output("output") - .toolCallId("tool_call_id") - .build() - ) + .addToolOutput( + BetaThreadRunSubmitToolOutputsParams.ToolOutput.builder() + .output("output") + .toolCallId("tool_call_id") + .build() ) .build() val body = params.getBody() @@ -57,9 +53,7 @@ class BetaThreadRunSubmitToolOutputsParamsTest { BetaThreadRunSubmitToolOutputsParams.builder() .threadId("thread_id") .runId("run_id") - .toolOutputs( - listOf(BetaThreadRunSubmitToolOutputsParams.ToolOutput.builder().build()) - ) + .addToolOutput(BetaThreadRunSubmitToolOutputsParams.ToolOutput.builder().build()) .build() val body = params.getBody() assertThat(body).isNotNull @@ -73,9 +67,7 @@ class BetaThreadRunSubmitToolOutputsParamsTest { BetaThreadRunSubmitToolOutputsParams.builder() .threadId("thread_id") .runId("run_id") - .toolOutputs( - listOf(BetaThreadRunSubmitToolOutputsParams.ToolOutput.builder().build()) - ) + .addToolOutput(BetaThreadRunSubmitToolOutputsParams.ToolOutput.builder().build()) .build() assertThat(params).isNotNull // path param "threadId" diff --git a/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadUpdateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadUpdateParamsTest.kt index cfa090e8..376d7223 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadUpdateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/BetaThreadUpdateParamsTest.kt @@ -17,12 +17,12 @@ class BetaThreadUpdateParamsTest { BetaThreadUpdateParams.ToolResources.builder() .codeInterpreter( BetaThreadUpdateParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaThreadUpdateParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) + .addVectorStoreId("string") .build() ) .build() @@ -40,12 +40,12 @@ class BetaThreadUpdateParamsTest { BetaThreadUpdateParams.ToolResources.builder() .codeInterpreter( BetaThreadUpdateParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaThreadUpdateParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) + .addVectorStoreId("string") .build() ) .build() @@ -59,12 +59,12 @@ class BetaThreadUpdateParamsTest { BetaThreadUpdateParams.ToolResources.builder() .codeInterpreter( BetaThreadUpdateParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaThreadUpdateParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) + .addVectorStoreId("string") .build() ) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/BetaVectorStoreCreateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/BetaVectorStoreCreateParamsTest.kt index 37831475..4bbc2346 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/BetaVectorStoreCreateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/BetaVectorStoreCreateParamsTest.kt @@ -24,7 +24,7 @@ class BetaVectorStoreCreateParamsTest { .days(1L) .build() ) - .fileIds(listOf("string")) + .addFileId("string") .metadata(JsonValue.from(mapOf())) .name("name") .build() @@ -47,7 +47,7 @@ class BetaVectorStoreCreateParamsTest { .days(1L) .build() ) - .fileIds(listOf("string")) + .addFileId("string") .metadata(JsonValue.from(mapOf())) .name("name") .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/BetaVectorStoreFileBatchCreateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/BetaVectorStoreFileBatchCreateParamsTest.kt index f7d6ea16..fdffd065 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/BetaVectorStoreFileBatchCreateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/BetaVectorStoreFileBatchCreateParamsTest.kt @@ -11,7 +11,7 @@ class BetaVectorStoreFileBatchCreateParamsTest { fun createBetaVectorStoreFileBatchCreateParams() { BetaVectorStoreFileBatchCreateParams.builder() .vectorStoreId("vs_abc123") - .fileIds(listOf("string")) + .addFileId("string") .chunkingStrategy( FileChunkingStrategyParam.ofAutoFileChunkingStrategyParam( AutoFileChunkingStrategyParam.builder() @@ -27,7 +27,7 @@ class BetaVectorStoreFileBatchCreateParamsTest { val params = BetaVectorStoreFileBatchCreateParams.builder() .vectorStoreId("vs_abc123") - .fileIds(listOf("string")) + .addFileId("string") .chunkingStrategy( FileChunkingStrategyParam.ofAutoFileChunkingStrategyParam( AutoFileChunkingStrategyParam.builder() @@ -54,7 +54,7 @@ class BetaVectorStoreFileBatchCreateParamsTest { val params = BetaVectorStoreFileBatchCreateParams.builder() .vectorStoreId("vs_abc123") - .fileIds(listOf("string")) + .addFileId("string") .build() val body = params.getBody() assertThat(body).isNotNull @@ -66,7 +66,7 @@ class BetaVectorStoreFileBatchCreateParamsTest { val params = BetaVectorStoreFileBatchCreateParams.builder() .vectorStoreId("vs_abc123") - .fileIds(listOf("string")) + .addFileId("string") .build() assertThat(params).isNotNull // path param "vectorStoreId" diff --git a/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionAssistantMessageParamTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionAssistantMessageParamTest.kt index b2ee15ba..4550409a 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionAssistantMessageParamTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionAssistantMessageParamTest.kt @@ -22,19 +22,17 @@ class ChatCompletionAssistantMessageParamTest { ) .name("name") .refusal("refusal") - .toolCalls( - listOf( - ChatCompletionMessageToolCall.builder() - .id("id") - .function( - ChatCompletionMessageToolCall.Function.builder() - .arguments("arguments") - .name("name") - .build() - ) - .type(ChatCompletionMessageToolCall.Type.FUNCTION) - .build() - ) + .addToolCall( + ChatCompletionMessageToolCall.builder() + .id("id") + .function( + ChatCompletionMessageToolCall.Function.builder() + .arguments("arguments") + .name("name") + .build() + ) + .type(ChatCompletionMessageToolCall.Type.FUNCTION) + .build() ) .build() assertThat(chatCompletionAssistantMessageParam).isNotNull diff --git a/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionChunkTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionChunkTest.kt index ee136a0c..b9a496e6 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionChunkTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionChunkTest.kt @@ -12,88 +12,72 @@ class ChatCompletionChunkTest { val chatCompletionChunk = ChatCompletionChunk.builder() .id("id") - .choices( - listOf( - ChatCompletionChunk.Choice.builder() - .delta( - ChatCompletionChunk.Choice.Delta.builder() - .content("content") - .functionCall( - ChatCompletionChunk.Choice.Delta.FunctionCall.builder() - .arguments("arguments") - .name("name") - .build() - ) - .refusal("refusal") - .role(ChatCompletionChunk.Choice.Delta.Role.SYSTEM) - .toolCalls( - listOf( - ChatCompletionChunk.Choice.Delta.ToolCall.builder() - .index(0L) - .id("id") - .function( - ChatCompletionChunk.Choice.Delta.ToolCall - .Function - .builder() - .arguments("arguments") - .name("name") - .build() - ) - .type( - ChatCompletionChunk.Choice.Delta.ToolCall.Type - .FUNCTION - ) + .addChoice( + ChatCompletionChunk.Choice.builder() + .delta( + ChatCompletionChunk.Choice.Delta.builder() + .content("content") + .functionCall( + ChatCompletionChunk.Choice.Delta.FunctionCall.builder() + .arguments("arguments") + .name("name") + .build() + ) + .refusal("refusal") + .role(ChatCompletionChunk.Choice.Delta.Role.SYSTEM) + .addToolCall( + ChatCompletionChunk.Choice.Delta.ToolCall.builder() + .index(0L) + .id("id") + .function( + ChatCompletionChunk.Choice.Delta.ToolCall.Function + .builder() + .arguments("arguments") + .name("name") .build() ) - ) - .build() - ) - .finishReason(ChatCompletionChunk.Choice.FinishReason.STOP) - .index(0L) - .logprobs( - ChatCompletionChunk.Choice.Logprobs.builder() - .content( - listOf( - ChatCompletionTokenLogprob.builder() + .type( + ChatCompletionChunk.Choice.Delta.ToolCall.Type.FUNCTION + ) + .build() + ) + .build() + ) + .finishReason(ChatCompletionChunk.Choice.FinishReason.STOP) + .index(0L) + .logprobs( + ChatCompletionChunk.Choice.Logprobs.builder() + .addContent( + ChatCompletionTokenLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ChatCompletionTokenLogprob.TopLogprob.builder() .token("token") - .bytes(listOf(0L)) + .addByte(0L) .logprob(0.0) - .topLogprobs( - listOf( - ChatCompletionTokenLogprob.TopLogprob - .builder() - .token("token") - .bytes(listOf(0L)) - .logprob(0.0) - .build() - ) - ) .build() ) - ) - .refusal( - listOf( - ChatCompletionTokenLogprob.builder() + .build() + ) + .addRefusal( + ChatCompletionTokenLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ChatCompletionTokenLogprob.TopLogprob.builder() .token("token") - .bytes(listOf(0L)) + .addByte(0L) .logprob(0.0) - .topLogprobs( - listOf( - ChatCompletionTokenLogprob.TopLogprob - .builder() - .token("token") - .bytes(listOf(0L)) - .logprob(0.0) - .build() - ) - ) .build() ) - ) - .build() - ) - .build() - ) + .build() + ) + .build() + ) + .build() ) .created(0L) .model("model") @@ -138,23 +122,18 @@ class ChatCompletionChunkTest { ) .refusal("refusal") .role(ChatCompletionChunk.Choice.Delta.Role.SYSTEM) - .toolCalls( - listOf( - ChatCompletionChunk.Choice.Delta.ToolCall.builder() - .index(0L) - .id("id") - .function( - ChatCompletionChunk.Choice.Delta.ToolCall.Function - .builder() - .arguments("arguments") - .name("name") - .build() - ) - .type( - ChatCompletionChunk.Choice.Delta.ToolCall.Type.FUNCTION - ) - .build() - ) + .addToolCall( + ChatCompletionChunk.Choice.Delta.ToolCall.builder() + .index(0L) + .id("id") + .function( + ChatCompletionChunk.Choice.Delta.ToolCall.Function.builder() + .arguments("arguments") + .name("name") + .build() + ) + .type(ChatCompletionChunk.Choice.Delta.ToolCall.Type.FUNCTION) + .build() ) .build() ) @@ -162,41 +141,33 @@ class ChatCompletionChunkTest { .index(0L) .logprobs( ChatCompletionChunk.Choice.Logprobs.builder() - .content( - listOf( - ChatCompletionTokenLogprob.builder() - .token("token") - .bytes(listOf(0L)) - .logprob(0.0) - .topLogprobs( - listOf( - ChatCompletionTokenLogprob.TopLogprob.builder() - .token("token") - .bytes(listOf(0L)) - .logprob(0.0) - .build() - ) - ) - .build() - ) + .addContent( + ChatCompletionTokenLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ChatCompletionTokenLogprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() ) - .refusal( - listOf( - ChatCompletionTokenLogprob.builder() - .token("token") - .bytes(listOf(0L)) - .logprob(0.0) - .topLogprobs( - listOf( - ChatCompletionTokenLogprob.TopLogprob.builder() - .token("token") - .bytes(listOf(0L)) - .logprob(0.0) - .build() - ) - ) - .build() - ) + .addRefusal( + ChatCompletionTokenLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ChatCompletionTokenLogprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionCreateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionCreateParamsTest.kt index 6efdb9b5..947fea96 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionCreateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionCreateParamsTest.kt @@ -11,17 +11,15 @@ class ChatCompletionCreateParamsTest { @Test fun createChatCompletionCreateParams() { ChatCompletionCreateParams.builder() - .messages( - listOf( - ChatCompletionMessageParam.ofChatCompletionDeveloperMessageParam( - ChatCompletionDeveloperMessageParam.builder() - .content( - ChatCompletionDeveloperMessageParam.Content.ofTextContent("string") - ) - .role(ChatCompletionDeveloperMessageParam.Role.DEVELOPER) - .name("name") - .build() - ) + .addMessage( + ChatCompletionMessageParam.ofChatCompletionDeveloperMessageParam( + ChatCompletionDeveloperMessageParam.builder() + .content( + ChatCompletionDeveloperMessageParam.Content.ofTextContent("string") + ) + .role(ChatCompletionDeveloperMessageParam.Role.DEVELOPER) + .name("name") + .build() ) ) .model(ChatModel.O1) @@ -37,18 +35,16 @@ class ChatCompletionCreateParamsTest { ChatCompletionCreateParams.FunctionCall.Behavior.NONE ) ) - .functions( - listOf( - ChatCompletionCreateParams.Function.builder() - .name("name") - .description("description") - .parameters( - FunctionParameters.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .build() - ) + .addFunction( + ChatCompletionCreateParams.Function.builder() + .name("name") + .description("description") + .parameters( + FunctionParameters.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() ) .logitBias( ChatCompletionCreateParams.LogitBias.builder() @@ -63,7 +59,7 @@ class ChatCompletionCreateParamsTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) - .modalities(listOf(ChatCompletionModality.TEXT)) + .addModality(ChatCompletionModality.TEXT) .n(1L) .parallelToolCalls(true) .prediction( @@ -90,24 +86,22 @@ class ChatCompletionCreateParamsTest { ChatCompletionToolChoiceOption.Behavior.NONE ) ) - .tools( - listOf( - ChatCompletionTool.builder() - .function( - FunctionDefinition.builder() - .name("name") - .description("description") - .parameters( - FunctionParameters.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .strict(true) - .build() - ) - .type(ChatCompletionTool.Type.FUNCTION) - .build() - ) + .addTool( + ChatCompletionTool.builder() + .function( + FunctionDefinition.builder() + .name("name") + .description("description") + .parameters( + FunctionParameters.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .strict(true) + .build() + ) + .type(ChatCompletionTool.Type.FUNCTION) + .build() ) .topLogprobs(0L) .topP(1.0) @@ -119,19 +113,15 @@ class ChatCompletionCreateParamsTest { fun getBody() { val params = ChatCompletionCreateParams.builder() - .messages( - listOf( - ChatCompletionMessageParam.ofChatCompletionDeveloperMessageParam( - ChatCompletionDeveloperMessageParam.builder() - .content( - ChatCompletionDeveloperMessageParam.Content.ofTextContent( - "string" - ) - ) - .role(ChatCompletionDeveloperMessageParam.Role.DEVELOPER) - .name("name") - .build() - ) + .addMessage( + ChatCompletionMessageParam.ofChatCompletionDeveloperMessageParam( + ChatCompletionDeveloperMessageParam.builder() + .content( + ChatCompletionDeveloperMessageParam.Content.ofTextContent("string") + ) + .role(ChatCompletionDeveloperMessageParam.Role.DEVELOPER) + .name("name") + .build() ) ) .model(ChatModel.O1) @@ -147,18 +137,16 @@ class ChatCompletionCreateParamsTest { ChatCompletionCreateParams.FunctionCall.Behavior.NONE ) ) - .functions( - listOf( - ChatCompletionCreateParams.Function.builder() - .name("name") - .description("description") - .parameters( - FunctionParameters.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .build() - ) + .addFunction( + ChatCompletionCreateParams.Function.builder() + .name("name") + .description("description") + .parameters( + FunctionParameters.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() ) .logitBias( ChatCompletionCreateParams.LogitBias.builder() @@ -173,7 +161,7 @@ class ChatCompletionCreateParamsTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) - .modalities(listOf(ChatCompletionModality.TEXT)) + .addModality(ChatCompletionModality.TEXT) .n(1L) .parallelToolCalls(true) .prediction( @@ -200,24 +188,22 @@ class ChatCompletionCreateParamsTest { ChatCompletionToolChoiceOption.Behavior.NONE ) ) - .tools( - listOf( - ChatCompletionTool.builder() - .function( - FunctionDefinition.builder() - .name("name") - .description("description") - .parameters( - FunctionParameters.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .strict(true) - .build() - ) - .type(ChatCompletionTool.Type.FUNCTION) - .build() - ) + .addTool( + ChatCompletionTool.builder() + .function( + FunctionDefinition.builder() + .name("name") + .description("description") + .parameters( + FunctionParameters.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .strict(true) + .build() + ) + .type(ChatCompletionTool.Type.FUNCTION) + .build() ) .topLogprobs(0L) .topP(1.0) @@ -343,18 +329,14 @@ class ChatCompletionCreateParamsTest { fun getBodyWithoutOptionalFields() { val params = ChatCompletionCreateParams.builder() - .messages( - listOf( - ChatCompletionMessageParam.ofChatCompletionDeveloperMessageParam( - ChatCompletionDeveloperMessageParam.builder() - .content( - ChatCompletionDeveloperMessageParam.Content.ofTextContent( - "string" - ) - ) - .role(ChatCompletionDeveloperMessageParam.Role.DEVELOPER) - .build() - ) + .addMessage( + ChatCompletionMessageParam.ofChatCompletionDeveloperMessageParam( + ChatCompletionDeveloperMessageParam.builder() + .content( + ChatCompletionDeveloperMessageParam.Content.ofTextContent("string") + ) + .role(ChatCompletionDeveloperMessageParam.Role.DEVELOPER) + .build() ) ) .model(ChatModel.O1) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionMessageTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionMessageTest.kt index c833e1ce..c4ce99f7 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionMessageTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionMessageTest.kt @@ -28,19 +28,17 @@ class ChatCompletionMessageTest { .name("name") .build() ) - .toolCalls( - listOf( - ChatCompletionMessageToolCall.builder() - .id("id") - .function( - ChatCompletionMessageToolCall.Function.builder() - .arguments("arguments") - .name("name") - .build() - ) - .type(ChatCompletionMessageToolCall.Type.FUNCTION) - .build() - ) + .addToolCall( + ChatCompletionMessageToolCall.builder() + .id("id") + .function( + ChatCompletionMessageToolCall.Function.builder() + .arguments("arguments") + .name("name") + .build() + ) + .type(ChatCompletionMessageToolCall.Type.FUNCTION) + .build() ) .build() assertThat(chatCompletionMessage).isNotNull diff --git a/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionTest.kt index 09defddf..ee3da0bb 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionTest.kt @@ -12,90 +12,76 @@ class ChatCompletionTest { val chatCompletion = ChatCompletion.builder() .id("id") - .choices( - listOf( - ChatCompletion.Choice.builder() - .finishReason(ChatCompletion.Choice.FinishReason.STOP) - .index(0L) - .logprobs( - ChatCompletion.Choice.Logprobs.builder() - .content( - listOf( - ChatCompletionTokenLogprob.builder() + .addChoice( + ChatCompletion.Choice.builder() + .finishReason(ChatCompletion.Choice.FinishReason.STOP) + .index(0L) + .logprobs( + ChatCompletion.Choice.Logprobs.builder() + .addContent( + ChatCompletionTokenLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ChatCompletionTokenLogprob.TopLogprob.builder() .token("token") - .bytes(listOf(0L)) + .addByte(0L) .logprob(0.0) - .topLogprobs( - listOf( - ChatCompletionTokenLogprob.TopLogprob - .builder() - .token("token") - .bytes(listOf(0L)) - .logprob(0.0) - .build() - ) - ) .build() ) - ) - .refusal( - listOf( - ChatCompletionTokenLogprob.builder() + .build() + ) + .addRefusal( + ChatCompletionTokenLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ChatCompletionTokenLogprob.TopLogprob.builder() .token("token") - .bytes(listOf(0L)) + .addByte(0L) .logprob(0.0) - .topLogprobs( - listOf( - ChatCompletionTokenLogprob.TopLogprob - .builder() - .token("token") - .bytes(listOf(0L)) - .logprob(0.0) - .build() - ) - ) .build() ) - ) - .build() - ) - .message( - ChatCompletionMessage.builder() - .content("content") - .refusal("refusal") - .role(ChatCompletionMessage.Role.ASSISTANT) - .audio( - ChatCompletionAudio.builder() - .id("id") - .data("data") - .expiresAt(0L) - .transcript("transcript") - .build() - ) - .functionCall( - ChatCompletionMessage.FunctionCall.builder() - .arguments("arguments") - .name("name") - .build() - ) - .toolCalls( - listOf( - ChatCompletionMessageToolCall.builder() - .id("id") - .function( - ChatCompletionMessageToolCall.Function.builder() - .arguments("arguments") - .name("name") - .build() - ) - .type(ChatCompletionMessageToolCall.Type.FUNCTION) + .build() + ) + .build() + ) + .message( + ChatCompletionMessage.builder() + .content("content") + .refusal("refusal") + .role(ChatCompletionMessage.Role.ASSISTANT) + .audio( + ChatCompletionAudio.builder() + .id("id") + .data("data") + .expiresAt(0L) + .transcript("transcript") + .build() + ) + .functionCall( + ChatCompletionMessage.FunctionCall.builder() + .arguments("arguments") + .name("name") + .build() + ) + .addToolCall( + ChatCompletionMessageToolCall.builder() + .id("id") + .function( + ChatCompletionMessageToolCall.Function.builder() + .arguments("arguments") + .name("name") .build() ) - ) - .build() - ) - .build() - ) + .type(ChatCompletionMessageToolCall.Type.FUNCTION) + .build() + ) + .build() + ) + .build() ) .created(0L) .model("model") @@ -133,41 +119,33 @@ class ChatCompletionTest { .index(0L) .logprobs( ChatCompletion.Choice.Logprobs.builder() - .content( - listOf( - ChatCompletionTokenLogprob.builder() - .token("token") - .bytes(listOf(0L)) - .logprob(0.0) - .topLogprobs( - listOf( - ChatCompletionTokenLogprob.TopLogprob.builder() - .token("token") - .bytes(listOf(0L)) - .logprob(0.0) - .build() - ) - ) - .build() - ) + .addContent( + ChatCompletionTokenLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ChatCompletionTokenLogprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() ) - .refusal( - listOf( - ChatCompletionTokenLogprob.builder() - .token("token") - .bytes(listOf(0L)) - .logprob(0.0) - .topLogprobs( - listOf( - ChatCompletionTokenLogprob.TopLogprob.builder() - .token("token") - .bytes(listOf(0L)) - .logprob(0.0) - .build() - ) - ) - .build() - ) + .addRefusal( + ChatCompletionTokenLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ChatCompletionTokenLogprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() + ) + .build() ) .build() ) @@ -190,19 +168,17 @@ class ChatCompletionTest { .name("name") .build() ) - .toolCalls( - listOf( - ChatCompletionMessageToolCall.builder() - .id("id") - .function( - ChatCompletionMessageToolCall.Function.builder() - .arguments("arguments") - .name("name") - .build() - ) - .type(ChatCompletionMessageToolCall.Type.FUNCTION) - .build() - ) + .addToolCall( + ChatCompletionMessageToolCall.builder() + .id("id") + .function( + ChatCompletionMessageToolCall.Function.builder() + .arguments("arguments") + .name("name") + .build() + ) + .type(ChatCompletionMessageToolCall.Type.FUNCTION) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionTokenLogprobTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionTokenLogprobTest.kt index ec00068a..b18f9d06 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionTokenLogprobTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/ChatCompletionTokenLogprobTest.kt @@ -12,16 +12,14 @@ class ChatCompletionTokenLogprobTest { val chatCompletionTokenLogprob = ChatCompletionTokenLogprob.builder() .token("token") - .bytes(listOf(0L)) + .addByte(0L) .logprob(0.0) - .topLogprobs( - listOf( - ChatCompletionTokenLogprob.TopLogprob.builder() - .token("token") - .bytes(listOf(0L)) - .logprob(0.0) - .build() - ) + .addTopLogprob( + ChatCompletionTokenLogprob.TopLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .build() ) .build() assertThat(chatCompletionTokenLogprob).isNotNull @@ -32,7 +30,7 @@ class ChatCompletionTokenLogprobTest { .containsExactly( ChatCompletionTokenLogprob.TopLogprob.builder() .token("token") - .bytes(listOf(0L)) + .addByte(0L) .logprob(0.0) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/CodeInterpreterToolCallDeltaTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/CodeInterpreterToolCallDeltaTest.kt index 294d21c7..7be2cc50 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/CodeInterpreterToolCallDeltaTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/CodeInterpreterToolCallDeltaTest.kt @@ -17,17 +17,15 @@ class CodeInterpreterToolCallDeltaTest { .codeInterpreter( CodeInterpreterToolCallDelta.CodeInterpreter.builder() .input("input") - .outputs( - listOf( - CodeInterpreterToolCallDelta.CodeInterpreter.Output - .ofCodeInterpreterLogs( - CodeInterpreterLogs.builder() - .index(0L) - .type(CodeInterpreterLogs.Type.LOGS) - .logs("logs") - .build() - ) - ) + .addOutput( + CodeInterpreterToolCallDelta.CodeInterpreter.Output + .ofCodeInterpreterLogs( + CodeInterpreterLogs.builder() + .index(0L) + .type(CodeInterpreterLogs.Type.LOGS) + .logs("logs") + .build() + ) ) .build() ) @@ -41,16 +39,13 @@ class CodeInterpreterToolCallDeltaTest { .contains( CodeInterpreterToolCallDelta.CodeInterpreter.builder() .input("input") - .outputs( - listOf( - CodeInterpreterToolCallDelta.CodeInterpreter.Output - .ofCodeInterpreterLogs( - CodeInterpreterLogs.builder() - .index(0L) - .type(CodeInterpreterLogs.Type.LOGS) - .logs("logs") - .build() - ) + .addOutput( + CodeInterpreterToolCallDelta.CodeInterpreter.Output.ofCodeInterpreterLogs( + CodeInterpreterLogs.builder() + .index(0L) + .type(CodeInterpreterLogs.Type.LOGS) + .logs("logs") + .build() ) ) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/CodeInterpreterToolCallTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/CodeInterpreterToolCallTest.kt index de3b4453..d2224103 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/CodeInterpreterToolCallTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/CodeInterpreterToolCallTest.kt @@ -15,20 +15,16 @@ class CodeInterpreterToolCallTest { .codeInterpreter( CodeInterpreterToolCall.CodeInterpreter.builder() .input("input") - .outputs( - listOf( - CodeInterpreterToolCall.CodeInterpreter.Output.ofLogs( - CodeInterpreterToolCall.CodeInterpreter.Output.LogsOutput - .builder() - .logs("logs") - .type( - CodeInterpreterToolCall.CodeInterpreter.Output - .LogsOutput - .Type - .LOGS - ) - .build() - ) + .addOutput( + CodeInterpreterToolCall.CodeInterpreter.Output.ofLogs( + CodeInterpreterToolCall.CodeInterpreter.Output.LogsOutput.builder() + .logs("logs") + .type( + CodeInterpreterToolCall.CodeInterpreter.Output.LogsOutput + .Type + .LOGS + ) + .build() ) ) .build() @@ -41,18 +37,15 @@ class CodeInterpreterToolCallTest { .isEqualTo( CodeInterpreterToolCall.CodeInterpreter.builder() .input("input") - .outputs( - listOf( - CodeInterpreterToolCall.CodeInterpreter.Output.ofLogs( - CodeInterpreterToolCall.CodeInterpreter.Output.LogsOutput.builder() - .logs("logs") - .type( - CodeInterpreterToolCall.CodeInterpreter.Output.LogsOutput - .Type - .LOGS - ) - .build() - ) + .addOutput( + CodeInterpreterToolCall.CodeInterpreter.Output.ofLogs( + CodeInterpreterToolCall.CodeInterpreter.Output.LogsOutput.builder() + .logs("logs") + .type( + CodeInterpreterToolCall.CodeInterpreter.Output.LogsOutput.Type + .LOGS + ) + .build() ) ) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/CompletionChoiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/CompletionChoiceTest.kt index 4f6f5d28..aa3703f5 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/CompletionChoiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/CompletionChoiceTest.kt @@ -16,15 +16,13 @@ class CompletionChoiceTest { .index(0L) .logprobs( CompletionChoice.Logprobs.builder() - .textOffset(listOf(0L)) - .tokenLogprobs(listOf(0.0)) - .tokens(listOf("string")) - .topLogprobs( - listOf( - CompletionChoice.Logprobs.TopLogprob.builder() - .putAdditionalProperty("foo", JsonValue.from(0)) - .build() - ) + .addTextOffset(0L) + .addTokenLogprob(0.0) + .addToken("string") + .addTopLogprob( + CompletionChoice.Logprobs.TopLogprob.builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() ) .build() ) @@ -36,15 +34,13 @@ class CompletionChoiceTest { assertThat(completionChoice.logprobs()) .contains( CompletionChoice.Logprobs.builder() - .textOffset(listOf(0L)) - .tokenLogprobs(listOf(0.0)) - .tokens(listOf("string")) - .topLogprobs( - listOf( - CompletionChoice.Logprobs.TopLogprob.builder() - .putAdditionalProperty("foo", JsonValue.from(0)) - .build() - ) + .addTextOffset(0L) + .addTokenLogprob(0.0) + .addToken("string") + .addTopLogprob( + CompletionChoice.Logprobs.TopLogprob.builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/CompletionTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/CompletionTest.kt index 8c9d34cf..0a9d2361 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/CompletionTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/CompletionTest.kt @@ -13,28 +13,24 @@ class CompletionTest { val completion = Completion.builder() .id("id") - .choices( - listOf( - CompletionChoice.builder() - .finishReason(CompletionChoice.FinishReason.STOP) - .index(0L) - .logprobs( - CompletionChoice.Logprobs.builder() - .textOffset(listOf(0L)) - .tokenLogprobs(listOf(0.0)) - .tokens(listOf("string")) - .topLogprobs( - listOf( - CompletionChoice.Logprobs.TopLogprob.builder() - .putAdditionalProperty("foo", JsonValue.from(0)) - .build() - ) - ) - .build() - ) - .text("text") - .build() - ) + .addChoice( + CompletionChoice.builder() + .finishReason(CompletionChoice.FinishReason.STOP) + .index(0L) + .logprobs( + CompletionChoice.Logprobs.builder() + .addTextOffset(0L) + .addTokenLogprob(0.0) + .addToken("string") + .addTopLogprob( + CompletionChoice.Logprobs.TopLogprob.builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() + ) + .build() + ) + .text("text") + .build() ) .created(0L) .model("model") @@ -71,15 +67,13 @@ class CompletionTest { .index(0L) .logprobs( CompletionChoice.Logprobs.builder() - .textOffset(listOf(0L)) - .tokenLogprobs(listOf(0.0)) - .tokens(listOf("string")) - .topLogprobs( - listOf( - CompletionChoice.Logprobs.TopLogprob.builder() - .putAdditionalProperty("foo", JsonValue.from(0)) - .build() - ) + .addTextOffset(0L) + .addTokenLogprob(0.0) + .addToken("string") + .addTopLogprob( + CompletionChoice.Logprobs.TopLogprob.builder() + .putAdditionalProperty("foo", JsonValue.from(0)) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/CreateEmbeddingResponseTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/CreateEmbeddingResponseTest.kt index 13dcf31b..7750222d 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/CreateEmbeddingResponseTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/CreateEmbeddingResponseTest.kt @@ -11,14 +11,12 @@ class CreateEmbeddingResponseTest { fun createCreateEmbeddingResponse() { val createEmbeddingResponse = CreateEmbeddingResponse.builder() - .data( - listOf( - Embedding.builder() - .embedding(listOf(0.0)) - .index(0L) - .object_(Embedding.Object.EMBEDDING) - .build() - ) + .addData( + Embedding.builder() + .addEmbedding(0.0) + .index(0L) + .object_(Embedding.Object.EMBEDDING) + .build() ) .model("model") .object_(CreateEmbeddingResponse.Object.LIST) @@ -30,7 +28,7 @@ class CreateEmbeddingResponseTest { assertThat(createEmbeddingResponse.data()) .containsExactly( Embedding.builder() - .embedding(listOf(0.0)) + .addEmbedding(0.0) .index(0L) .object_(Embedding.Object.EMBEDDING) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/EmbeddingTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/EmbeddingTest.kt index 44a8bd82..6e4db204 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/EmbeddingTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/EmbeddingTest.kt @@ -11,7 +11,7 @@ class EmbeddingTest { fun createEmbedding() { val embedding = Embedding.builder() - .embedding(listOf(0.0)) + .addEmbedding(0.0) .index(0L) .object_(Embedding.Object.EMBEDDING) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/FileSearchToolCallTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/FileSearchToolCallTest.kt index 2a6370bf..1bd16155 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/FileSearchToolCallTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/FileSearchToolCallTest.kt @@ -23,26 +23,20 @@ class FileSearchToolCallTest { .scoreThreshold(0.0) .build() ) - .results( - listOf( - FileSearchToolCall.FileSearch.Result.builder() - .fileId("file_id") - .fileName("file_name") - .score(0.0) - .content( - listOf( - FileSearchToolCall.FileSearch.Result.Content.builder() - .text("text") - .type( - FileSearchToolCall.FileSearch.Result.Content - .Type - .TEXT - ) - .build() + .addResult( + FileSearchToolCall.FileSearch.Result.builder() + .fileId("file_id") + .fileName("file_name") + .score(0.0) + .addContent( + FileSearchToolCall.FileSearch.Result.Content.builder() + .text("text") + .type( + FileSearchToolCall.FileSearch.Result.Content.Type.TEXT ) - ) - .build() - ) + .build() + ) + .build() ) .build() ) @@ -62,25 +56,18 @@ class FileSearchToolCallTest { .scoreThreshold(0.0) .build() ) - .results( - listOf( - FileSearchToolCall.FileSearch.Result.builder() - .fileId("file_id") - .fileName("file_name") - .score(0.0) - .content( - listOf( - FileSearchToolCall.FileSearch.Result.Content.builder() - .text("text") - .type( - FileSearchToolCall.FileSearch.Result.Content.Type - .TEXT - ) - .build() - ) - ) - .build() - ) + .addResult( + FileSearchToolCall.FileSearch.Result.builder() + .fileId("file_id") + .fileName("file_name") + .score(0.0) + .addContent( + FileSearchToolCall.FileSearch.Result.Content.builder() + .text("text") + .type(FileSearchToolCall.FileSearch.Result.Content.Type.TEXT) + .build() + ) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/FineTuningJobCreateParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/FineTuningJobCreateParamsTest.kt index 82c7544e..e4ba09bb 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/FineTuningJobCreateParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/FineTuningJobCreateParamsTest.kt @@ -33,20 +33,18 @@ class FineTuningJobCreateParamsTest { ) .build() ) - .integrations( - listOf( - FineTuningJobCreateParams.Integration.builder() - .type(FineTuningJobCreateParams.Integration.Type.WANDB) - .wandb( - FineTuningJobCreateParams.Integration.Wandb.builder() - .project("my-wandb-project") - .entity("entity") - .name("name") - .tags(listOf("custom-tag")) - .build() - ) - .build() - ) + .addIntegration( + FineTuningJobCreateParams.Integration.builder() + .type(FineTuningJobCreateParams.Integration.Type.WANDB) + .wandb( + FineTuningJobCreateParams.Integration.Wandb.builder() + .project("my-wandb-project") + .entity("entity") + .name("name") + .addTag("custom-tag") + .build() + ) + .build() ) .method( FineTuningJobCreateParams.Method.builder() @@ -175,20 +173,18 @@ class FineTuningJobCreateParamsTest { ) .build() ) - .integrations( - listOf( - FineTuningJobCreateParams.Integration.builder() - .type(FineTuningJobCreateParams.Integration.Type.WANDB) - .wandb( - FineTuningJobCreateParams.Integration.Wandb.builder() - .project("my-wandb-project") - .entity("entity") - .name("name") - .tags(listOf("custom-tag")) - .build() - ) - .build() - ) + .addIntegration( + FineTuningJobCreateParams.Integration.builder() + .type(FineTuningJobCreateParams.Integration.Type.WANDB) + .wandb( + FineTuningJobCreateParams.Integration.Wandb.builder() + .project("my-wandb-project") + .entity("entity") + .name("name") + .addTag("custom-tag") + .build() + ) + .build() ) .method( FineTuningJobCreateParams.Method.builder() @@ -332,7 +328,7 @@ class FineTuningJobCreateParamsTest { .project("my-wandb-project") .entity("entity") .name("name") - .tags(listOf("custom-tag")) + .addTag("custom-tag") .build() ) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/FineTuningJobTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/FineTuningJobTest.kt index d1b1a619..9cb4e7c7 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/FineTuningJobTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/FineTuningJobTest.kt @@ -44,27 +44,25 @@ class FineTuningJobTest { .model("model") .object_(FineTuningJob.Object.FINE_TUNING_JOB) .organizationId("organization_id") - .resultFiles(listOf("file-abc123")) + .addResultFile("file-abc123") .seed(0L) .status(FineTuningJob.Status.VALIDATING_FILES) .trainedTokens(0L) .trainingFile("training_file") .validationFile("validation_file") .estimatedFinish(0L) - .integrations( - listOf( - FineTuningJobWandbIntegrationObject.builder() - .type(FineTuningJobWandbIntegrationObject.Type.WANDB) - .wandb( - FineTuningJobWandbIntegration.builder() - .project("my-wandb-project") - .entity("entity") - .name("name") - .tags(listOf("custom-tag")) - .build() - ) - .build() - ) + .addIntegration( + FineTuningJobWandbIntegrationObject.builder() + .type(FineTuningJobWandbIntegrationObject.Type.WANDB) + .wandb( + FineTuningJobWandbIntegration.builder() + .project("my-wandb-project") + .entity("entity") + .name("name") + .addTag("custom-tag") + .build() + ) + .build() ) .method( FineTuningJob.Method.builder() @@ -197,7 +195,7 @@ class FineTuningJobTest { .project("my-wandb-project") .entity("entity") .name("name") - .tags(listOf("custom-tag")) + .addTag("custom-tag") .build() ) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/FineTuningJobWandbIntegrationObjectTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/FineTuningJobWandbIntegrationObjectTest.kt index fe22f078..838cd7b9 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/FineTuningJobWandbIntegrationObjectTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/FineTuningJobWandbIntegrationObjectTest.kt @@ -17,7 +17,7 @@ class FineTuningJobWandbIntegrationObjectTest { .project("my-wandb-project") .entity("entity") .name("name") - .tags(listOf("custom-tag")) + .addTag("custom-tag") .build() ) .build() @@ -30,7 +30,7 @@ class FineTuningJobWandbIntegrationObjectTest { .project("my-wandb-project") .entity("entity") .name("name") - .tags(listOf("custom-tag")) + .addTag("custom-tag") .build() ) } diff --git a/openai-java-core/src/test/kotlin/com/openai/models/FineTuningJobWandbIntegrationTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/FineTuningJobWandbIntegrationTest.kt index 6c66f464..2990c9be 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/FineTuningJobWandbIntegrationTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/FineTuningJobWandbIntegrationTest.kt @@ -14,7 +14,7 @@ class FineTuningJobWandbIntegrationTest { .project("my-wandb-project") .entity("entity") .name("name") - .tags(listOf("custom-tag")) + .addTag("custom-tag") .build() assertThat(fineTuningJobWandbIntegration).isNotNull assertThat(fineTuningJobWandbIntegration.project()).isEqualTo("my-wandb-project") diff --git a/openai-java-core/src/test/kotlin/com/openai/models/ImagesResponseTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/ImagesResponseTest.kt index 4297e646..a4d15f27 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/ImagesResponseTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/ImagesResponseTest.kt @@ -12,14 +12,12 @@ class ImagesResponseTest { val imagesResponse = ImagesResponse.builder() .created(0L) - .data( - listOf( - Image.builder() - .b64Json("b64_json") - .revisedPrompt("revised_prompt") - .url("url") - .build() - ) + .addData( + Image.builder() + .b64Json("b64_json") + .revisedPrompt("revised_prompt") + .url("url") + .build() ) .build() assertThat(imagesResponse).isNotNull diff --git a/openai-java-core/src/test/kotlin/com/openai/models/MessageDeltaEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/MessageDeltaEventTest.kt index b18e7cd2..aa836c3c 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/MessageDeltaEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/MessageDeltaEventTest.kt @@ -14,34 +14,7 @@ class MessageDeltaEventTest { .id("id") .delta( MessageDelta.builder() - .content( - listOf( - MessageContentDelta.ofImageFileDeltaBlock( - ImageFileDeltaBlock.builder() - .index(0L) - .type(ImageFileDeltaBlock.Type.IMAGE_FILE) - .imageFile( - ImageFileDelta.builder() - .detail(ImageFileDelta.Detail.AUTO) - .fileId("file_id") - .build() - ) - .build() - ) - ) - ) - .role(MessageDelta.Role.USER) - .build() - ) - .object_(MessageDeltaEvent.Object.THREAD_MESSAGE_DELTA) - .build() - assertThat(messageDeltaEvent).isNotNull - assertThat(messageDeltaEvent.id()).isEqualTo("id") - assertThat(messageDeltaEvent.delta()) - .isEqualTo( - MessageDelta.builder() - .content( - listOf( + .addContent( MessageContentDelta.ofImageFileDeltaBlock( ImageFileDeltaBlock.builder() .index(0L) @@ -55,6 +28,29 @@ class MessageDeltaEventTest { .build() ) ) + .role(MessageDelta.Role.USER) + .build() + ) + .object_(MessageDeltaEvent.Object.THREAD_MESSAGE_DELTA) + .build() + assertThat(messageDeltaEvent).isNotNull + assertThat(messageDeltaEvent.id()).isEqualTo("id") + assertThat(messageDeltaEvent.delta()) + .isEqualTo( + MessageDelta.builder() + .addContent( + MessageContentDelta.ofImageFileDeltaBlock( + ImageFileDeltaBlock.builder() + .index(0L) + .type(ImageFileDeltaBlock.Type.IMAGE_FILE) + .imageFile( + ImageFileDelta.builder() + .detail(ImageFileDelta.Detail.AUTO) + .fileId("file_id") + .build() + ) + .build() + ) ) .role(MessageDelta.Role.USER) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/MessageDeltaTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/MessageDeltaTest.kt index 98f87c2b..b490cca0 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/MessageDeltaTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/MessageDeltaTest.kt @@ -11,20 +11,18 @@ class MessageDeltaTest { fun createMessageDelta() { val messageDelta = MessageDelta.builder() - .content( - listOf( - MessageContentDelta.ofImageFileDeltaBlock( - ImageFileDeltaBlock.builder() - .index(0L) - .type(ImageFileDeltaBlock.Type.IMAGE_FILE) - .imageFile( - ImageFileDelta.builder() - .detail(ImageFileDelta.Detail.AUTO) - .fileId("file_id") - .build() - ) - .build() - ) + .addContent( + MessageContentDelta.ofImageFileDeltaBlock( + ImageFileDeltaBlock.builder() + .index(0L) + .type(ImageFileDeltaBlock.Type.IMAGE_FILE) + .imageFile( + ImageFileDelta.builder() + .detail(ImageFileDelta.Detail.AUTO) + .fileId("file_id") + .build() + ) + .build() ) ) .role(MessageDelta.Role.USER) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/MessageTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/MessageTest.kt index 99450a29..6edfcb3b 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/MessageTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/MessageTest.kt @@ -14,36 +14,30 @@ class MessageTest { Message.builder() .id("id") .assistantId("assistant_id") - .attachments( - listOf( - Message.Attachment.builder() - .fileId("file_id") - .tools( - listOf( - Message.Attachment.Tool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) - ) + .addAttachment( + Message.Attachment.builder() + .fileId("file_id") + .addTool( + Message.Attachment.Tool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) - .build() - ) + ) + .build() ) .completedAt(0L) - .content( - listOf( - MessageContent.ofImageFileContentBlock( - ImageFileContentBlock.builder() - .imageFile( - ImageFile.builder() - .fileId("file_id") - .detail(ImageFile.Detail.AUTO) - .build() - ) - .type(ImageFileContentBlock.Type.IMAGE_FILE) - .build() - ) + .addContent( + MessageContent.ofImageFileContentBlock( + ImageFileContentBlock.builder() + .imageFile( + ImageFile.builder() + .fileId("file_id") + .detail(ImageFile.Detail.AUTO) + .build() + ) + .type(ImageFileContentBlock.Type.IMAGE_FILE) + .build() ) ) .createdAt(0L) @@ -67,13 +61,11 @@ class MessageTest { .containsExactly( Message.Attachment.builder() .fileId("file_id") - .tools( - listOf( - Message.Attachment.Tool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + Message.Attachment.Tool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/ModerationCreateResponseTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/ModerationCreateResponseTest.kt index f4f5a389..35937fad 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/ModerationCreateResponseTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/ModerationCreateResponseTest.kt @@ -13,106 +13,75 @@ class ModerationCreateResponseTest { ModerationCreateResponse.builder() .id("id") .model("model") - .results( - listOf( - Moderation.builder() - .categories( - Moderation.Categories.builder() - .harassment(true) - .harassmentThreatening(true) - .hate(true) - .hateThreatening(true) - .illicit(true) - .illicitViolent(true) - .selfHarm(true) - .selfHarmInstructions(true) - .selfHarmIntent(true) - .sexual(true) - .sexualMinors(true) - .violence(true) - .violenceGraphic(true) - .build() - ) - .categoryAppliedInputTypes( - Moderation.CategoryAppliedInputTypes.builder() - .harassment( - listOf(Moderation.CategoryAppliedInputTypes.Harassment.TEXT) - ) - .harassmentThreatening( - listOf( - Moderation.CategoryAppliedInputTypes - .HarassmentThreatening - .TEXT - ) - ) - .hate(listOf(Moderation.CategoryAppliedInputTypes.Hate.TEXT)) - .hateThreatening( - listOf( - Moderation.CategoryAppliedInputTypes.HateThreatening - .TEXT - ) - ) - .illicit( - listOf(Moderation.CategoryAppliedInputTypes.Illicit.TEXT) - ) - .illicitViolent( - listOf( - Moderation.CategoryAppliedInputTypes.IllicitViolent.TEXT - ) - ) - .selfHarm( - listOf(Moderation.CategoryAppliedInputTypes.SelfHarm.TEXT) - ) - .selfHarmInstructions( - listOf( - Moderation.CategoryAppliedInputTypes.SelfHarmInstruction - .TEXT - ) - ) - .selfHarmIntent( - listOf( - Moderation.CategoryAppliedInputTypes.SelfHarmIntent.TEXT - ) - ) - .sexual( - listOf(Moderation.CategoryAppliedInputTypes.Sexual.TEXT) - ) - .sexualMinors( - listOf( - Moderation.CategoryAppliedInputTypes.SexualMinor.TEXT - ) - ) - .violence( - listOf(Moderation.CategoryAppliedInputTypes.Violence.TEXT) - ) - .violenceGraphic( - listOf( - Moderation.CategoryAppliedInputTypes.ViolenceGraphic - .TEXT - ) - ) - .build() - ) - .categoryScores( - Moderation.CategoryScores.builder() - .harassment(0.0) - .harassmentThreatening(0.0) - .hate(0.0) - .hateThreatening(0.0) - .illicit(0.0) - .illicitViolent(0.0) - .selfHarm(0.0) - .selfHarmInstructions(0.0) - .selfHarmIntent(0.0) - .sexual(0.0) - .sexualMinors(0.0) - .violence(0.0) - .violenceGraphic(0.0) - .build() - ) - .flagged(true) - .build() - ) + .addResult( + Moderation.builder() + .categories( + Moderation.Categories.builder() + .harassment(true) + .harassmentThreatening(true) + .hate(true) + .hateThreatening(true) + .illicit(true) + .illicitViolent(true) + .selfHarm(true) + .selfHarmInstructions(true) + .selfHarmIntent(true) + .sexual(true) + .sexualMinors(true) + .violence(true) + .violenceGraphic(true) + .build() + ) + .categoryAppliedInputTypes( + Moderation.CategoryAppliedInputTypes.builder() + .addHarassment(Moderation.CategoryAppliedInputTypes.Harassment.TEXT) + .addHarassmentThreatening( + Moderation.CategoryAppliedInputTypes.HarassmentThreatening.TEXT + ) + .addHate(Moderation.CategoryAppliedInputTypes.Hate.TEXT) + .addHateThreatening( + Moderation.CategoryAppliedInputTypes.HateThreatening.TEXT + ) + .addIllicit(Moderation.CategoryAppliedInputTypes.Illicit.TEXT) + .addIllicitViolent( + Moderation.CategoryAppliedInputTypes.IllicitViolent.TEXT + ) + .addSelfHarm(Moderation.CategoryAppliedInputTypes.SelfHarm.TEXT) + .addSelfHarmInstruction( + Moderation.CategoryAppliedInputTypes.SelfHarmInstruction.TEXT + ) + .addSelfHarmIntent( + Moderation.CategoryAppliedInputTypes.SelfHarmIntent.TEXT + ) + .addSexual(Moderation.CategoryAppliedInputTypes.Sexual.TEXT) + .addSexualMinor( + Moderation.CategoryAppliedInputTypes.SexualMinor.TEXT + ) + .addViolence(Moderation.CategoryAppliedInputTypes.Violence.TEXT) + .addViolenceGraphic( + Moderation.CategoryAppliedInputTypes.ViolenceGraphic.TEXT + ) + .build() + ) + .categoryScores( + Moderation.CategoryScores.builder() + .harassment(0.0) + .harassmentThreatening(0.0) + .hate(0.0) + .hateThreatening(0.0) + .illicit(0.0) + .illicitViolent(0.0) + .selfHarm(0.0) + .selfHarmInstructions(0.0) + .selfHarmIntent(0.0) + .sexual(0.0) + .sexualMinors(0.0) + .violence(0.0) + .violenceGraphic(0.0) + .build() + ) + .flagged(true) + .build() ) .build() assertThat(moderationCreateResponse).isNotNull @@ -140,38 +109,30 @@ class ModerationCreateResponseTest { ) .categoryAppliedInputTypes( Moderation.CategoryAppliedInputTypes.builder() - .harassment( - listOf(Moderation.CategoryAppliedInputTypes.Harassment.TEXT) - ) - .harassmentThreatening( - listOf( - Moderation.CategoryAppliedInputTypes.HarassmentThreatening.TEXT - ) - ) - .hate(listOf(Moderation.CategoryAppliedInputTypes.Hate.TEXT)) - .hateThreatening( - listOf(Moderation.CategoryAppliedInputTypes.HateThreatening.TEXT) + .addHarassment(Moderation.CategoryAppliedInputTypes.Harassment.TEXT) + .addHarassmentThreatening( + Moderation.CategoryAppliedInputTypes.HarassmentThreatening.TEXT ) - .illicit(listOf(Moderation.CategoryAppliedInputTypes.Illicit.TEXT)) - .illicitViolent( - listOf(Moderation.CategoryAppliedInputTypes.IllicitViolent.TEXT) + .addHate(Moderation.CategoryAppliedInputTypes.Hate.TEXT) + .addHateThreatening( + Moderation.CategoryAppliedInputTypes.HateThreatening.TEXT ) - .selfHarm(listOf(Moderation.CategoryAppliedInputTypes.SelfHarm.TEXT)) - .selfHarmInstructions( - listOf( - Moderation.CategoryAppliedInputTypes.SelfHarmInstruction.TEXT - ) + .addIllicit(Moderation.CategoryAppliedInputTypes.Illicit.TEXT) + .addIllicitViolent( + Moderation.CategoryAppliedInputTypes.IllicitViolent.TEXT ) - .selfHarmIntent( - listOf(Moderation.CategoryAppliedInputTypes.SelfHarmIntent.TEXT) + .addSelfHarm(Moderation.CategoryAppliedInputTypes.SelfHarm.TEXT) + .addSelfHarmInstruction( + Moderation.CategoryAppliedInputTypes.SelfHarmInstruction.TEXT ) - .sexual(listOf(Moderation.CategoryAppliedInputTypes.Sexual.TEXT)) - .sexualMinors( - listOf(Moderation.CategoryAppliedInputTypes.SexualMinor.TEXT) + .addSelfHarmIntent( + Moderation.CategoryAppliedInputTypes.SelfHarmIntent.TEXT ) - .violence(listOf(Moderation.CategoryAppliedInputTypes.Violence.TEXT)) - .violenceGraphic( - listOf(Moderation.CategoryAppliedInputTypes.ViolenceGraphic.TEXT) + .addSexual(Moderation.CategoryAppliedInputTypes.Sexual.TEXT) + .addSexualMinor(Moderation.CategoryAppliedInputTypes.SexualMinor.TEXT) + .addViolence(Moderation.CategoryAppliedInputTypes.Violence.TEXT) + .addViolenceGraphic( + Moderation.CategoryAppliedInputTypes.ViolenceGraphic.TEXT ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/ModerationTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/ModerationTest.kt index 00f9591d..f79ca5f7 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/ModerationTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/ModerationTest.kt @@ -30,30 +30,26 @@ class ModerationTest { ) .categoryAppliedInputTypes( Moderation.CategoryAppliedInputTypes.builder() - .harassment(listOf(Moderation.CategoryAppliedInputTypes.Harassment.TEXT)) - .harassmentThreatening( - listOf(Moderation.CategoryAppliedInputTypes.HarassmentThreatening.TEXT) + .addHarassment(Moderation.CategoryAppliedInputTypes.Harassment.TEXT) + .addHarassmentThreatening( + Moderation.CategoryAppliedInputTypes.HarassmentThreatening.TEXT ) - .hate(listOf(Moderation.CategoryAppliedInputTypes.Hate.TEXT)) - .hateThreatening( - listOf(Moderation.CategoryAppliedInputTypes.HateThreatening.TEXT) + .addHate(Moderation.CategoryAppliedInputTypes.Hate.TEXT) + .addHateThreatening( + Moderation.CategoryAppliedInputTypes.HateThreatening.TEXT ) - .illicit(listOf(Moderation.CategoryAppliedInputTypes.Illicit.TEXT)) - .illicitViolent( - listOf(Moderation.CategoryAppliedInputTypes.IllicitViolent.TEXT) + .addIllicit(Moderation.CategoryAppliedInputTypes.Illicit.TEXT) + .addIllicitViolent(Moderation.CategoryAppliedInputTypes.IllicitViolent.TEXT) + .addSelfHarm(Moderation.CategoryAppliedInputTypes.SelfHarm.TEXT) + .addSelfHarmInstruction( + Moderation.CategoryAppliedInputTypes.SelfHarmInstruction.TEXT ) - .selfHarm(listOf(Moderation.CategoryAppliedInputTypes.SelfHarm.TEXT)) - .selfHarmInstructions( - listOf(Moderation.CategoryAppliedInputTypes.SelfHarmInstruction.TEXT) - ) - .selfHarmIntent( - listOf(Moderation.CategoryAppliedInputTypes.SelfHarmIntent.TEXT) - ) - .sexual(listOf(Moderation.CategoryAppliedInputTypes.Sexual.TEXT)) - .sexualMinors(listOf(Moderation.CategoryAppliedInputTypes.SexualMinor.TEXT)) - .violence(listOf(Moderation.CategoryAppliedInputTypes.Violence.TEXT)) - .violenceGraphic( - listOf(Moderation.CategoryAppliedInputTypes.ViolenceGraphic.TEXT) + .addSelfHarmIntent(Moderation.CategoryAppliedInputTypes.SelfHarmIntent.TEXT) + .addSexual(Moderation.CategoryAppliedInputTypes.Sexual.TEXT) + .addSexualMinor(Moderation.CategoryAppliedInputTypes.SexualMinor.TEXT) + .addViolence(Moderation.CategoryAppliedInputTypes.Violence.TEXT) + .addViolenceGraphic( + Moderation.CategoryAppliedInputTypes.ViolenceGraphic.TEXT ) .build() ) @@ -98,31 +94,23 @@ class ModerationTest { assertThat(moderation.categoryAppliedInputTypes()) .isEqualTo( Moderation.CategoryAppliedInputTypes.builder() - .harassment(listOf(Moderation.CategoryAppliedInputTypes.Harassment.TEXT)) - .harassmentThreatening( - listOf(Moderation.CategoryAppliedInputTypes.HarassmentThreatening.TEXT) - ) - .hate(listOf(Moderation.CategoryAppliedInputTypes.Hate.TEXT)) - .hateThreatening( - listOf(Moderation.CategoryAppliedInputTypes.HateThreatening.TEXT) - ) - .illicit(listOf(Moderation.CategoryAppliedInputTypes.Illicit.TEXT)) - .illicitViolent( - listOf(Moderation.CategoryAppliedInputTypes.IllicitViolent.TEXT) - ) - .selfHarm(listOf(Moderation.CategoryAppliedInputTypes.SelfHarm.TEXT)) - .selfHarmInstructions( - listOf(Moderation.CategoryAppliedInputTypes.SelfHarmInstruction.TEXT) - ) - .selfHarmIntent( - listOf(Moderation.CategoryAppliedInputTypes.SelfHarmIntent.TEXT) + .addHarassment(Moderation.CategoryAppliedInputTypes.Harassment.TEXT) + .addHarassmentThreatening( + Moderation.CategoryAppliedInputTypes.HarassmentThreatening.TEXT ) - .sexual(listOf(Moderation.CategoryAppliedInputTypes.Sexual.TEXT)) - .sexualMinors(listOf(Moderation.CategoryAppliedInputTypes.SexualMinor.TEXT)) - .violence(listOf(Moderation.CategoryAppliedInputTypes.Violence.TEXT)) - .violenceGraphic( - listOf(Moderation.CategoryAppliedInputTypes.ViolenceGraphic.TEXT) + .addHate(Moderation.CategoryAppliedInputTypes.Hate.TEXT) + .addHateThreatening(Moderation.CategoryAppliedInputTypes.HateThreatening.TEXT) + .addIllicit(Moderation.CategoryAppliedInputTypes.Illicit.TEXT) + .addIllicitViolent(Moderation.CategoryAppliedInputTypes.IllicitViolent.TEXT) + .addSelfHarm(Moderation.CategoryAppliedInputTypes.SelfHarm.TEXT) + .addSelfHarmInstruction( + Moderation.CategoryAppliedInputTypes.SelfHarmInstruction.TEXT ) + .addSelfHarmIntent(Moderation.CategoryAppliedInputTypes.SelfHarmIntent.TEXT) + .addSexual(Moderation.CategoryAppliedInputTypes.Sexual.TEXT) + .addSexualMinor(Moderation.CategoryAppliedInputTypes.SexualMinor.TEXT) + .addViolence(Moderation.CategoryAppliedInputTypes.Violence.TEXT) + .addViolenceGraphic(Moderation.CategoryAppliedInputTypes.ViolenceGraphic.TEXT) .build() ) assertThat(moderation.categoryScores()) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/RunTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/RunTest.kt index c20f3c77..3fb04f7f 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/RunTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/RunTest.kt @@ -41,19 +41,17 @@ class RunTest { Run.RequiredAction.builder() .submitToolOutputs( Run.RequiredAction.SubmitToolOutputs.builder() - .toolCalls( - listOf( - RequiredActionFunctionToolCall.builder() - .id("id") - .function( - RequiredActionFunctionToolCall.Function.builder() - .arguments("arguments") - .name("name") - .build() - ) - .type(RequiredActionFunctionToolCall.Type.FUNCTION) - .build() - ) + .addToolCall( + RequiredActionFunctionToolCall.builder() + .id("id") + .function( + RequiredActionFunctionToolCall.Function.builder() + .arguments("arguments") + .name("name") + .build() + ) + .type(RequiredActionFunctionToolCall.Type.FUNCTION) + .build() ) .build() ) @@ -71,13 +69,11 @@ class RunTest { .toolChoice( AssistantToolChoiceOption.ofBehavior(AssistantToolChoiceOption.Behavior.NONE) ) - .tools( - listOf( - AssistantTool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + AssistantTool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .truncationStrategy( @@ -129,19 +125,17 @@ class RunTest { Run.RequiredAction.builder() .submitToolOutputs( Run.RequiredAction.SubmitToolOutputs.builder() - .toolCalls( - listOf( - RequiredActionFunctionToolCall.builder() - .id("id") - .function( - RequiredActionFunctionToolCall.Function.builder() - .arguments("arguments") - .name("name") - .build() - ) - .type(RequiredActionFunctionToolCall.Type.FUNCTION) - .build() - ) + .addToolCall( + RequiredActionFunctionToolCall.builder() + .id("id") + .function( + RequiredActionFunctionToolCall.Function.builder() + .arguments("arguments") + .name("name") + .build() + ) + .type(RequiredActionFunctionToolCall.Type.FUNCTION) + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/TextContentBlockTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/TextContentBlockTest.kt index d1267a5a..4484ff54 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/TextContentBlockTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/TextContentBlockTest.kt @@ -13,34 +13,7 @@ class TextContentBlockTest { TextContentBlock.builder() .text( Text.builder() - .annotations( - listOf( - Annotation.ofFileCitationAnnotation( - FileCitationAnnotation.builder() - .endIndex(0L) - .fileCitation( - FileCitationAnnotation.FileCitation.builder() - .fileId("file_id") - .build() - ) - .startIndex(0L) - .text("text") - .type(FileCitationAnnotation.Type.FILE_CITATION) - .build() - ) - ) - ) - .value("value") - .build() - ) - .type(TextContentBlock.Type.TEXT) - .build() - assertThat(textContentBlock).isNotNull - assertThat(textContentBlock.text()) - .isEqualTo( - Text.builder() - .annotations( - listOf( + .addAnnotation( Annotation.ofFileCitationAnnotation( FileCitationAnnotation.builder() .endIndex(0L) @@ -55,6 +28,29 @@ class TextContentBlockTest { .build() ) ) + .value("value") + .build() + ) + .type(TextContentBlock.Type.TEXT) + .build() + assertThat(textContentBlock).isNotNull + assertThat(textContentBlock.text()) + .isEqualTo( + Text.builder() + .addAnnotation( + Annotation.ofFileCitationAnnotation( + FileCitationAnnotation.builder() + .endIndex(0L) + .fileCitation( + FileCitationAnnotation.FileCitation.builder() + .fileId("file_id") + .build() + ) + .startIndex(0L) + .text("text") + .type(FileCitationAnnotation.Type.FILE_CITATION) + .build() + ) ) .value("value") .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/TextDeltaBlockTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/TextDeltaBlockTest.kt index 0b46e0de..386a782d 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/TextDeltaBlockTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/TextDeltaBlockTest.kt @@ -15,37 +15,7 @@ class TextDeltaBlockTest { .type(TextDeltaBlock.Type.TEXT) .text( TextDelta.builder() - .annotations( - listOf( - AnnotationDelta.ofFileCitationDeltaAnnotation( - FileCitationDeltaAnnotation.builder() - .index(0L) - .type(FileCitationDeltaAnnotation.Type.FILE_CITATION) - .endIndex(0L) - .fileCitation( - FileCitationDeltaAnnotation.FileCitation.builder() - .fileId("file_id") - .quote("quote") - .build() - ) - .startIndex(0L) - .text("text") - .build() - ) - ) - ) - .value("value") - .build() - ) - .build() - assertThat(textDeltaBlock).isNotNull - assertThat(textDeltaBlock.index()).isEqualTo(0L) - assertThat(textDeltaBlock.type()).isEqualTo(TextDeltaBlock.Type.TEXT) - assertThat(textDeltaBlock.text()) - .contains( - TextDelta.builder() - .annotations( - listOf( + .addAnnotation( AnnotationDelta.ofFileCitationDeltaAnnotation( FileCitationDeltaAnnotation.builder() .index(0L) @@ -62,6 +32,32 @@ class TextDeltaBlockTest { .build() ) ) + .value("value") + .build() + ) + .build() + assertThat(textDeltaBlock).isNotNull + assertThat(textDeltaBlock.index()).isEqualTo(0L) + assertThat(textDeltaBlock.type()).isEqualTo(TextDeltaBlock.Type.TEXT) + assertThat(textDeltaBlock.text()) + .contains( + TextDelta.builder() + .addAnnotation( + AnnotationDelta.ofFileCitationDeltaAnnotation( + FileCitationDeltaAnnotation.builder() + .index(0L) + .type(FileCitationDeltaAnnotation.Type.FILE_CITATION) + .endIndex(0L) + .fileCitation( + FileCitationDeltaAnnotation.FileCitation.builder() + .fileId("file_id") + .quote("quote") + .build() + ) + .startIndex(0L) + .text("text") + .build() + ) ) .value("value") .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/TextDeltaTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/TextDeltaTest.kt index e15d3f82..50ff0ede 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/TextDeltaTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/TextDeltaTest.kt @@ -11,23 +11,21 @@ class TextDeltaTest { fun createTextDelta() { val textDelta = TextDelta.builder() - .annotations( - listOf( - AnnotationDelta.ofFileCitationDeltaAnnotation( - FileCitationDeltaAnnotation.builder() - .index(0L) - .type(FileCitationDeltaAnnotation.Type.FILE_CITATION) - .endIndex(0L) - .fileCitation( - FileCitationDeltaAnnotation.FileCitation.builder() - .fileId("file_id") - .quote("quote") - .build() - ) - .startIndex(0L) - .text("text") - .build() - ) + .addAnnotation( + AnnotationDelta.ofFileCitationDeltaAnnotation( + FileCitationDeltaAnnotation.builder() + .index(0L) + .type(FileCitationDeltaAnnotation.Type.FILE_CITATION) + .endIndex(0L) + .fileCitation( + FileCitationDeltaAnnotation.FileCitation.builder() + .fileId("file_id") + .quote("quote") + .build() + ) + .startIndex(0L) + .text("text") + .build() ) ) .value("value") diff --git a/openai-java-core/src/test/kotlin/com/openai/models/TextTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/TextTest.kt index 02e4bf2c..c817e68e 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/TextTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/TextTest.kt @@ -11,21 +11,19 @@ class TextTest { fun createText() { val text = Text.builder() - .annotations( - listOf( - Annotation.ofFileCitationAnnotation( - FileCitationAnnotation.builder() - .endIndex(0L) - .fileCitation( - FileCitationAnnotation.FileCitation.builder() - .fileId("file_id") - .build() - ) - .startIndex(0L) - .text("text") - .type(FileCitationAnnotation.Type.FILE_CITATION) - .build() - ) + .addAnnotation( + Annotation.ofFileCitationAnnotation( + FileCitationAnnotation.builder() + .endIndex(0L) + .fileCitation( + FileCitationAnnotation.FileCitation.builder() + .fileId("file_id") + .build() + ) + .startIndex(0L) + .text("text") + .type(FileCitationAnnotation.Type.FILE_CITATION) + .build() ) ) .value("value") diff --git a/openai-java-core/src/test/kotlin/com/openai/models/ThreadStreamEventTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/ThreadStreamEventTest.kt index cd5f589e..aea21a03 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/ThreadStreamEventTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/ThreadStreamEventTest.kt @@ -22,12 +22,12 @@ class ThreadStreamEventTest { Thread.ToolResources.builder() .codeInterpreter( Thread.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( Thread.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) + .addVectorStoreId("string") .build() ) .build() @@ -49,12 +49,12 @@ class ThreadStreamEventTest { Thread.ToolResources.builder() .codeInterpreter( Thread.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( Thread.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) + .addVectorStoreId("string") .build() ) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/ThreadTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/ThreadTest.kt index 6645e6ac..a48ced29 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/ThreadTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/ThreadTest.kt @@ -20,12 +20,12 @@ class ThreadTest { Thread.ToolResources.builder() .codeInterpreter( Thread.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( Thread.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) + .addVectorStoreId("string") .build() ) .build() @@ -40,14 +40,10 @@ class ThreadTest { .contains( Thread.ToolResources.builder() .codeInterpreter( - Thread.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) - .build() + Thread.ToolResources.CodeInterpreter.builder().addFileId("string").build() ) .fileSearch( - Thread.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) - .build() + Thread.ToolResources.FileSearch.builder().addVectorStoreId("string").build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/ToolCallDeltaObjectTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/ToolCallDeltaObjectTest.kt index 5121b747..aac1a327 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/ToolCallDeltaObjectTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/ToolCallDeltaObjectTest.kt @@ -12,32 +12,28 @@ class ToolCallDeltaObjectTest { val toolCallDeltaObject = ToolCallDeltaObject.builder() .type(ToolCallDeltaObject.Type.TOOL_CALLS) - .toolCalls( - listOf( - ToolCallDelta.ofCodeInterpreterToolCallDelta( - CodeInterpreterToolCallDelta.builder() - .index(0L) - .type(CodeInterpreterToolCallDelta.Type.CODE_INTERPRETER) - .id("id") - .codeInterpreter( - CodeInterpreterToolCallDelta.CodeInterpreter.builder() - .input("input") - .outputs( - listOf( - CodeInterpreterToolCallDelta.CodeInterpreter.Output - .ofCodeInterpreterLogs( - CodeInterpreterLogs.builder() - .index(0L) - .type(CodeInterpreterLogs.Type.LOGS) - .logs("logs") - .build() - ) + .addToolCall( + ToolCallDelta.ofCodeInterpreterToolCallDelta( + CodeInterpreterToolCallDelta.builder() + .index(0L) + .type(CodeInterpreterToolCallDelta.Type.CODE_INTERPRETER) + .id("id") + .codeInterpreter( + CodeInterpreterToolCallDelta.CodeInterpreter.builder() + .input("input") + .addOutput( + CodeInterpreterToolCallDelta.CodeInterpreter.Output + .ofCodeInterpreterLogs( + CodeInterpreterLogs.builder() + .index(0L) + .type(CodeInterpreterLogs.Type.LOGS) + .logs("logs") + .build() ) - ) - .build() - ) - .build() - ) + ) + .build() + ) + .build() ) ) .build() @@ -53,17 +49,15 @@ class ToolCallDeltaObjectTest { .codeInterpreter( CodeInterpreterToolCallDelta.CodeInterpreter.builder() .input("input") - .outputs( - listOf( - CodeInterpreterToolCallDelta.CodeInterpreter.Output - .ofCodeInterpreterLogs( - CodeInterpreterLogs.builder() - .index(0L) - .type(CodeInterpreterLogs.Type.LOGS) - .logs("logs") - .build() - ) - ) + .addOutput( + CodeInterpreterToolCallDelta.CodeInterpreter.Output + .ofCodeInterpreterLogs( + CodeInterpreterLogs.builder() + .index(0L) + .type(CodeInterpreterLogs.Type.LOGS) + .logs("logs") + .build() + ) ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/models/ToolCallsStepDetailsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/ToolCallsStepDetailsTest.kt index c41b581a..b1f30c53 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/ToolCallsStepDetailsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/ToolCallsStepDetailsTest.kt @@ -11,40 +11,32 @@ class ToolCallsStepDetailsTest { fun createToolCallsStepDetails() { val toolCallsStepDetails = ToolCallsStepDetails.builder() - .toolCalls( - listOf( - ToolCall.ofCodeInterpreterToolCall( - CodeInterpreterToolCall.builder() - .id("id") - .codeInterpreter( - CodeInterpreterToolCall.CodeInterpreter.builder() - .input("input") - .outputs( - listOf( - CodeInterpreterToolCall.CodeInterpreter.Output - .ofLogs( - CodeInterpreterToolCall.CodeInterpreter - .Output - .LogsOutput - .builder() - .logs("logs") - .type( - CodeInterpreterToolCall - .CodeInterpreter - .Output - .LogsOutput - .Type - .LOGS - ) - .build() - ) - ) + .addToolCall( + ToolCall.ofCodeInterpreterToolCall( + CodeInterpreterToolCall.builder() + .id("id") + .codeInterpreter( + CodeInterpreterToolCall.CodeInterpreter.builder() + .input("input") + .addOutput( + CodeInterpreterToolCall.CodeInterpreter.Output.ofLogs( + CodeInterpreterToolCall.CodeInterpreter.Output + .LogsOutput + .builder() + .logs("logs") + .type( + CodeInterpreterToolCall.CodeInterpreter.Output + .LogsOutput + .Type + .LOGS + ) + .build() ) - .build() - ) - .type(CodeInterpreterToolCall.Type.CODE_INTERPRETER) - .build() - ) + ) + .build() + ) + .type(CodeInterpreterToolCall.Type.CODE_INTERPRETER) + .build() ) ) .type(ToolCallsStepDetails.Type.TOOL_CALLS) @@ -58,21 +50,18 @@ class ToolCallsStepDetailsTest { .codeInterpreter( CodeInterpreterToolCall.CodeInterpreter.builder() .input("input") - .outputs( - listOf( - CodeInterpreterToolCall.CodeInterpreter.Output.ofLogs( - CodeInterpreterToolCall.CodeInterpreter.Output - .LogsOutput - .builder() - .logs("logs") - .type( - CodeInterpreterToolCall.CodeInterpreter.Output - .LogsOutput - .Type - .LOGS - ) - .build() - ) + .addOutput( + CodeInterpreterToolCall.CodeInterpreter.Output.ofLogs( + CodeInterpreterToolCall.CodeInterpreter.Output.LogsOutput + .builder() + .logs("logs") + .type( + CodeInterpreterToolCall.CodeInterpreter.Output + .LogsOutput + .Type + .LOGS + ) + .build() ) ) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/models/UploadCompleteParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/models/UploadCompleteParamsTest.kt index 70b38223..5c32dfd1 100644 --- a/openai-java-core/src/test/kotlin/com/openai/models/UploadCompleteParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/models/UploadCompleteParamsTest.kt @@ -11,7 +11,7 @@ class UploadCompleteParamsTest { fun createUploadCompleteParams() { UploadCompleteParams.builder() .uploadId("upload_abc123") - .partIds(listOf("string")) + .addPartId("string") .md5("md5") .build() } @@ -21,7 +21,7 @@ class UploadCompleteParamsTest { val params = UploadCompleteParams.builder() .uploadId("upload_abc123") - .partIds(listOf("string")) + .addPartId("string") .md5("md5") .build() val body = params.getBody() @@ -33,10 +33,7 @@ class UploadCompleteParamsTest { @Test fun getBodyWithoutOptionalFields() { val params = - UploadCompleteParams.builder() - .uploadId("upload_abc123") - .partIds(listOf("string")) - .build() + UploadCompleteParams.builder().uploadId("upload_abc123").addPartId("string").build() val body = params.getBody() assertThat(body).isNotNull assertThat(body.partIds()).isEqualTo(listOf("string")) @@ -45,10 +42,7 @@ class UploadCompleteParamsTest { @Test fun getPathParam() { val params = - UploadCompleteParams.builder() - .uploadId("upload_abc123") - .partIds(listOf("string")) - .build() + UploadCompleteParams.builder().uploadId("upload_abc123").addPartId("string").build() assertThat(params).isNotNull // path param "uploadId" assertThat(params.getPathParam(0)).isEqualTo("upload_abc123") diff --git a/openai-java-core/src/test/kotlin/com/openai/services/ErrorHandlingTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/ErrorHandlingTest.kt index 153d6676..721ff989 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/ErrorHandlingTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/ErrorHandlingTest.kt @@ -84,20 +84,18 @@ class ErrorHandlingTest { ) .build() ) - .integrations( - listOf( - FineTuningJobCreateParams.Integration.builder() - .type(FineTuningJobCreateParams.Integration.Type.WANDB) - .wandb( - FineTuningJobCreateParams.Integration.Wandb.builder() - .project("my-wandb-project") - .entity("entity") - .name("name") - .tags(listOf("custom-tag")) - .build() - ) - .build() - ) + .addIntegration( + FineTuningJobCreateParams.Integration.builder() + .type(FineTuningJobCreateParams.Integration.Type.WANDB) + .wandb( + FineTuningJobCreateParams.Integration.Wandb.builder() + .project("my-wandb-project") + .entity("entity") + .name("name") + .addTag("custom-tag") + .build() + ) + .build() ) .method( FineTuningJobCreateParams.Method.builder() @@ -241,27 +239,25 @@ class ErrorHandlingTest { .model("model") .object_(FineTuningJob.Object.FINE_TUNING_JOB) .organizationId("organization_id") - .resultFiles(listOf("file-abc123")) + .addResultFile("file-abc123") .seed(0L) .status(FineTuningJob.Status.VALIDATING_FILES) .trainedTokens(0L) .trainingFile("training_file") .validationFile("validation_file") .estimatedFinish(0L) - .integrations( - listOf( - FineTuningJobWandbIntegrationObject.builder() - .type(FineTuningJobWandbIntegrationObject.Type.WANDB) - .wandb( - FineTuningJobWandbIntegration.builder() - .project("my-wandb-project") - .entity("entity") - .name("name") - .tags(listOf("custom-tag")) - .build() - ) - .build() - ) + .addIntegration( + FineTuningJobWandbIntegrationObject.builder() + .type(FineTuningJobWandbIntegrationObject.Type.WANDB) + .wandb( + FineTuningJobWandbIntegration.builder() + .project("my-wandb-project") + .entity("entity") + .name("name") + .addTag("custom-tag") + .build() + ) + .build() ) .method( FineTuningJob.Method.builder() @@ -380,20 +376,18 @@ class ErrorHandlingTest { ) .build() ) - .integrations( - listOf( - FineTuningJobCreateParams.Integration.builder() - .type(FineTuningJobCreateParams.Integration.Type.WANDB) - .wandb( - FineTuningJobCreateParams.Integration.Wandb.builder() - .project("my-wandb-project") - .entity("entity") - .name("name") - .tags(listOf("custom-tag")) - .build() - ) - .build() - ) + .addIntegration( + FineTuningJobCreateParams.Integration.builder() + .type(FineTuningJobCreateParams.Integration.Type.WANDB) + .wandb( + FineTuningJobCreateParams.Integration.Wandb.builder() + .project("my-wandb-project") + .entity("entity") + .name("name") + .addTag("custom-tag") + .build() + ) + .build() ) .method( FineTuningJobCreateParams.Method.builder() @@ -541,20 +535,18 @@ class ErrorHandlingTest { ) .build() ) - .integrations( - listOf( - FineTuningJobCreateParams.Integration.builder() - .type(FineTuningJobCreateParams.Integration.Type.WANDB) - .wandb( - FineTuningJobCreateParams.Integration.Wandb.builder() - .project("my-wandb-project") - .entity("entity") - .name("name") - .tags(listOf("custom-tag")) - .build() - ) - .build() - ) + .addIntegration( + FineTuningJobCreateParams.Integration.builder() + .type(FineTuningJobCreateParams.Integration.Type.WANDB) + .wandb( + FineTuningJobCreateParams.Integration.Wandb.builder() + .project("my-wandb-project") + .entity("entity") + .name("name") + .addTag("custom-tag") + .build() + ) + .build() ) .method( FineTuningJobCreateParams.Method.builder() @@ -702,20 +694,18 @@ class ErrorHandlingTest { ) .build() ) - .integrations( - listOf( - FineTuningJobCreateParams.Integration.builder() - .type(FineTuningJobCreateParams.Integration.Type.WANDB) - .wandb( - FineTuningJobCreateParams.Integration.Wandb.builder() - .project("my-wandb-project") - .entity("entity") - .name("name") - .tags(listOf("custom-tag")) - .build() - ) - .build() - ) + .addIntegration( + FineTuningJobCreateParams.Integration.builder() + .type(FineTuningJobCreateParams.Integration.Type.WANDB) + .wandb( + FineTuningJobCreateParams.Integration.Wandb.builder() + .project("my-wandb-project") + .entity("entity") + .name("name") + .addTag("custom-tag") + .build() + ) + .build() ) .method( FineTuningJobCreateParams.Method.builder() @@ -863,20 +853,18 @@ class ErrorHandlingTest { ) .build() ) - .integrations( - listOf( - FineTuningJobCreateParams.Integration.builder() - .type(FineTuningJobCreateParams.Integration.Type.WANDB) - .wandb( - FineTuningJobCreateParams.Integration.Wandb.builder() - .project("my-wandb-project") - .entity("entity") - .name("name") - .tags(listOf("custom-tag")) - .build() - ) - .build() - ) + .addIntegration( + FineTuningJobCreateParams.Integration.builder() + .type(FineTuningJobCreateParams.Integration.Type.WANDB) + .wandb( + FineTuningJobCreateParams.Integration.Wandb.builder() + .project("my-wandb-project") + .entity("entity") + .name("name") + .addTag("custom-tag") + .build() + ) + .build() ) .method( FineTuningJobCreateParams.Method.builder() @@ -1024,20 +1012,18 @@ class ErrorHandlingTest { ) .build() ) - .integrations( - listOf( - FineTuningJobCreateParams.Integration.builder() - .type(FineTuningJobCreateParams.Integration.Type.WANDB) - .wandb( - FineTuningJobCreateParams.Integration.Wandb.builder() - .project("my-wandb-project") - .entity("entity") - .name("name") - .tags(listOf("custom-tag")) - .build() - ) - .build() - ) + .addIntegration( + FineTuningJobCreateParams.Integration.builder() + .type(FineTuningJobCreateParams.Integration.Type.WANDB) + .wandb( + FineTuningJobCreateParams.Integration.Wandb.builder() + .project("my-wandb-project") + .entity("entity") + .name("name") + .addTag("custom-tag") + .build() + ) + .build() ) .method( FineTuningJobCreateParams.Method.builder() @@ -1189,20 +1175,18 @@ class ErrorHandlingTest { ) .build() ) - .integrations( - listOf( - FineTuningJobCreateParams.Integration.builder() - .type(FineTuningJobCreateParams.Integration.Type.WANDB) - .wandb( - FineTuningJobCreateParams.Integration.Wandb.builder() - .project("my-wandb-project") - .entity("entity") - .name("name") - .tags(listOf("custom-tag")) - .build() - ) - .build() - ) + .addIntegration( + FineTuningJobCreateParams.Integration.builder() + .type(FineTuningJobCreateParams.Integration.Type.WANDB) + .wandb( + FineTuningJobCreateParams.Integration.Wandb.builder() + .project("my-wandb-project") + .entity("entity") + .name("name") + .addTag("custom-tag") + .build() + ) + .build() ) .method( FineTuningJobCreateParams.Method.builder() @@ -1350,20 +1334,18 @@ class ErrorHandlingTest { ) .build() ) - .integrations( - listOf( - FineTuningJobCreateParams.Integration.builder() - .type(FineTuningJobCreateParams.Integration.Type.WANDB) - .wandb( - FineTuningJobCreateParams.Integration.Wandb.builder() - .project("my-wandb-project") - .entity("entity") - .name("name") - .tags(listOf("custom-tag")) - .build() - ) - .build() - ) + .addIntegration( + FineTuningJobCreateParams.Integration.builder() + .type(FineTuningJobCreateParams.Integration.Type.WANDB) + .wandb( + FineTuningJobCreateParams.Integration.Wandb.builder() + .project("my-wandb-project") + .entity("entity") + .name("name") + .addTag("custom-tag") + .build() + ) + .build() ) .method( FineTuningJobCreateParams.Method.builder() @@ -1511,20 +1493,18 @@ class ErrorHandlingTest { ) .build() ) - .integrations( - listOf( - FineTuningJobCreateParams.Integration.builder() - .type(FineTuningJobCreateParams.Integration.Type.WANDB) - .wandb( - FineTuningJobCreateParams.Integration.Wandb.builder() - .project("my-wandb-project") - .entity("entity") - .name("name") - .tags(listOf("custom-tag")) - .build() - ) - .build() - ) + .addIntegration( + FineTuningJobCreateParams.Integration.builder() + .type(FineTuningJobCreateParams.Integration.Type.WANDB) + .wandb( + FineTuningJobCreateParams.Integration.Wandb.builder() + .project("my-wandb-project") + .entity("entity") + .name("name") + .addTag("custom-tag") + .build() + ) + .build() ) .method( FineTuningJobCreateParams.Method.builder() @@ -1677,20 +1657,18 @@ class ErrorHandlingTest { ) .build() ) - .integrations( - listOf( - FineTuningJobCreateParams.Integration.builder() - .type(FineTuningJobCreateParams.Integration.Type.WANDB) - .wandb( - FineTuningJobCreateParams.Integration.Wandb.builder() - .project("my-wandb-project") - .entity("entity") - .name("name") - .tags(listOf("custom-tag")) - .build() - ) - .build() - ) + .addIntegration( + FineTuningJobCreateParams.Integration.builder() + .type(FineTuningJobCreateParams.Integration.Type.WANDB) + .wandb( + FineTuningJobCreateParams.Integration.Wandb.builder() + .project("my-wandb-project") + .entity("entity") + .name("name") + .addTag("custom-tag") + .build() + ) + .build() ) .method( FineTuningJobCreateParams.Method.builder() @@ -1837,20 +1815,18 @@ class ErrorHandlingTest { ) .build() ) - .integrations( - listOf( - FineTuningJobCreateParams.Integration.builder() - .type(FineTuningJobCreateParams.Integration.Type.WANDB) - .wandb( - FineTuningJobCreateParams.Integration.Wandb.builder() - .project("my-wandb-project") - .entity("entity") - .name("name") - .tags(listOf("custom-tag")) - .build() - ) - .build() - ) + .addIntegration( + FineTuningJobCreateParams.Integration.builder() + .type(FineTuningJobCreateParams.Integration.Type.WANDB) + .wandb( + FineTuningJobCreateParams.Integration.Wandb.builder() + .project("my-wandb-project") + .entity("entity") + .name("name") + .addTag("custom-tag") + .build() + ) + .build() ) .method( FineTuningJobCreateParams.Method.builder() diff --git a/openai-java-core/src/test/kotlin/com/openai/services/ServiceParamsTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/ServiceParamsTest.kt index d9f95d1b..c059df97 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/ServiceParamsTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/ServiceParamsTest.kt @@ -74,19 +74,15 @@ class ServiceParamsTest { val params = ChatCompletionCreateParams.builder() - .messages( - listOf( - ChatCompletionMessageParam.ofChatCompletionDeveloperMessageParam( - ChatCompletionDeveloperMessageParam.builder() - .content( - ChatCompletionDeveloperMessageParam.Content.ofTextContent( - "string" - ) - ) - .role(ChatCompletionDeveloperMessageParam.Role.DEVELOPER) - .name("name") - .build() - ) + .addMessage( + ChatCompletionMessageParam.ofChatCompletionDeveloperMessageParam( + ChatCompletionDeveloperMessageParam.builder() + .content( + ChatCompletionDeveloperMessageParam.Content.ofTextContent("string") + ) + .role(ChatCompletionDeveloperMessageParam.Role.DEVELOPER) + .name("name") + .build() ) ) .model(ChatModel.O1) @@ -102,18 +98,16 @@ class ServiceParamsTest { ChatCompletionCreateParams.FunctionCall.Behavior.NONE ) ) - .functions( - listOf( - ChatCompletionCreateParams.Function.builder() - .name("name") - .description("description") - .parameters( - FunctionParameters.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .build() - ) + .addFunction( + ChatCompletionCreateParams.Function.builder() + .name("name") + .description("description") + .parameters( + FunctionParameters.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() ) .logitBias( ChatCompletionCreateParams.LogitBias.builder() @@ -128,7 +122,7 @@ class ServiceParamsTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) - .modalities(listOf(ChatCompletionModality.TEXT)) + .addModality(ChatCompletionModality.TEXT) .n(1L) .parallelToolCalls(true) .prediction( @@ -155,24 +149,22 @@ class ServiceParamsTest { ChatCompletionToolChoiceOption.Behavior.NONE ) ) - .tools( - listOf( - ChatCompletionTool.builder() - .function( - FunctionDefinition.builder() - .name("name") - .description("description") - .parameters( - FunctionParameters.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .strict(true) - .build() - ) - .type(ChatCompletionTool.Type.FUNCTION) - .build() - ) + .addTool( + ChatCompletionTool.builder() + .function( + FunctionDefinition.builder() + .name("name") + .description("description") + .parameters( + FunctionParameters.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .strict(true) + .build() + ) + .type(ChatCompletionTool.Type.FUNCTION) + .build() ) .topLogprobs(0L) .topP(1.0) @@ -185,90 +177,76 @@ class ServiceParamsTest { val apiResponse = ChatCompletion.builder() .id("id") - .choices( - listOf( - ChatCompletion.Choice.builder() - .finishReason(ChatCompletion.Choice.FinishReason.STOP) - .index(0L) - .logprobs( - ChatCompletion.Choice.Logprobs.builder() - .content( - listOf( - ChatCompletionTokenLogprob.builder() + .addChoice( + ChatCompletion.Choice.builder() + .finishReason(ChatCompletion.Choice.FinishReason.STOP) + .index(0L) + .logprobs( + ChatCompletion.Choice.Logprobs.builder() + .addContent( + ChatCompletionTokenLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ChatCompletionTokenLogprob.TopLogprob.builder() .token("token") - .bytes(listOf(0L)) + .addByte(0L) .logprob(0.0) - .topLogprobs( - listOf( - ChatCompletionTokenLogprob.TopLogprob - .builder() - .token("token") - .bytes(listOf(0L)) - .logprob(0.0) - .build() - ) - ) .build() ) - ) - .refusal( - listOf( - ChatCompletionTokenLogprob.builder() + .build() + ) + .addRefusal( + ChatCompletionTokenLogprob.builder() + .token("token") + .addByte(0L) + .logprob(0.0) + .addTopLogprob( + ChatCompletionTokenLogprob.TopLogprob.builder() .token("token") - .bytes(listOf(0L)) + .addByte(0L) .logprob(0.0) - .topLogprobs( - listOf( - ChatCompletionTokenLogprob.TopLogprob - .builder() - .token("token") - .bytes(listOf(0L)) - .logprob(0.0) - .build() - ) - ) .build() ) - ) - .build() - ) - .message( - ChatCompletionMessage.builder() - .content("content") - .refusal("refusal") - .role(ChatCompletionMessage.Role.ASSISTANT) - .audio( - ChatCompletionAudio.builder() - .id("id") - .data("data") - .expiresAt(0L) - .transcript("transcript") - .build() - ) - .functionCall( - ChatCompletionMessage.FunctionCall.builder() - .arguments("arguments") - .name("name") - .build() - ) - .toolCalls( - listOf( - ChatCompletionMessageToolCall.builder() - .id("id") - .function( - ChatCompletionMessageToolCall.Function.builder() - .arguments("arguments") - .name("name") - .build() - ) - .type(ChatCompletionMessageToolCall.Type.FUNCTION) + .build() + ) + .build() + ) + .message( + ChatCompletionMessage.builder() + .content("content") + .refusal("refusal") + .role(ChatCompletionMessage.Role.ASSISTANT) + .audio( + ChatCompletionAudio.builder() + .id("id") + .data("data") + .expiresAt(0L) + .transcript("transcript") + .build() + ) + .functionCall( + ChatCompletionMessage.FunctionCall.builder() + .arguments("arguments") + .name("name") + .build() + ) + .addToolCall( + ChatCompletionMessageToolCall.builder() + .id("id") + .function( + ChatCompletionMessageToolCall.Function.builder() + .arguments("arguments") + .name("name") .build() ) - ) - .build() - ) - .build() - ) + .type(ChatCompletionMessageToolCall.Type.FUNCTION) + .build() + ) + .build() + ) + .build() ) .created(0L) .model("model") diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/UploadServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/UploadServiceTest.kt index 0980ec8d..4c6833bb 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/UploadServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/UploadServiceTest.kt @@ -61,7 +61,7 @@ class UploadServiceTest { uploadService.complete( UploadCompleteParams.builder() .uploadId("upload_abc123") - .partIds(listOf("string")) + .addPartId("string") .md5("md5") .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/AssistantServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/AssistantServiceTest.kt index e4c75e15..5973e62e 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/AssistantServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/AssistantServiceTest.kt @@ -48,45 +48,40 @@ class AssistantServiceTest { BetaAssistantCreateParams.ToolResources.builder() .codeInterpreter( BetaAssistantCreateParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaAssistantCreateParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) - .vectorStores( - listOf( - BetaAssistantCreateParams.ToolResources.FileSearch - .VectorStore - .builder() - .chunkingStrategy( - FileChunkingStrategyParam - .ofAutoFileChunkingStrategyParam( - AutoFileChunkingStrategyParam.builder() - .type( - AutoFileChunkingStrategyParam - .Type - .AUTO - ) - .build() - ) - ) - .fileIds(listOf("string")) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .addVectorStoreId("string") + .addVectorStore( + BetaAssistantCreateParams.ToolResources.FileSearch + .VectorStore + .builder() + .chunkingStrategy( + FileChunkingStrategyParam + .ofAutoFileChunkingStrategyParam( + AutoFileChunkingStrategyParam.builder() + .type( + AutoFileChunkingStrategyParam.Type + .AUTO + ) + .build() + ) + ) + .addFileId("string") + .metadata(JsonValue.from(mapOf())) + .build() ) .build() ) .build() ) - .tools( - listOf( - AssistantTool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + AssistantTool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .topP(1.0) @@ -139,23 +134,21 @@ class AssistantServiceTest { BetaAssistantUpdateParams.ToolResources.builder() .codeInterpreter( BetaAssistantUpdateParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaAssistantUpdateParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) + .addVectorStoreId("string") .build() ) .build() ) - .tools( - listOf( - AssistantTool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + AssistantTool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .topP(1.0) diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/ThreadServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/ThreadServiceTest.kt index 12612321..ccb09922 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/ThreadServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/ThreadServiceTest.kt @@ -33,69 +33,54 @@ class ThreadServiceTest { val thread = threadService.create( BetaThreadCreateParams.builder() - .messages( - listOf( - BetaThreadCreateParams.Message.builder() - .content( - BetaThreadCreateParams.Message.Content.ofTextContent("string") - ) - .role(BetaThreadCreateParams.Message.Role.USER) - .attachments( - listOf( - BetaThreadCreateParams.Message.Attachment.builder() - .fileId("file_id") - .tools( - listOf( - BetaThreadCreateParams.Message.Attachment.Tool - .ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type( - CodeInterpreterTool.Type - .CODE_INTERPRETER - ) - .build() - ) - ) + .addMessage( + BetaThreadCreateParams.Message.builder() + .content(BetaThreadCreateParams.Message.Content.ofTextContent("string")) + .role(BetaThreadCreateParams.Message.Role.USER) + .addAttachment( + BetaThreadCreateParams.Message.Attachment.builder() + .fileId("file_id") + .addTool( + BetaThreadCreateParams.Message.Attachment.Tool + .ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) - .build() ) - ) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .build() + ) + .metadata(JsonValue.from(mapOf())) + .build() ) .metadata(JsonValue.from(mapOf())) .toolResources( BetaThreadCreateParams.ToolResources.builder() .codeInterpreter( BetaThreadCreateParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaThreadCreateParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) - .vectorStores( - listOf( - BetaThreadCreateParams.ToolResources.FileSearch - .VectorStore - .builder() - .chunkingStrategy( - FileChunkingStrategyParam - .ofAutoFileChunkingStrategyParam( - AutoFileChunkingStrategyParam.builder() - .type( - AutoFileChunkingStrategyParam - .Type - .AUTO - ) - .build() - ) - ) - .fileIds(listOf("string")) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .addVectorStoreId("string") + .addVectorStore( + BetaThreadCreateParams.ToolResources.FileSearch.VectorStore + .builder() + .chunkingStrategy( + FileChunkingStrategyParam + .ofAutoFileChunkingStrategyParam( + AutoFileChunkingStrategyParam.builder() + .type( + AutoFileChunkingStrategyParam.Type + .AUTO + ) + .build() + ) + ) + .addFileId("string") + .metadata(JsonValue.from(mapOf())) + .build() ) .build() ) @@ -138,12 +123,12 @@ class ThreadServiceTest { BetaThreadUpdateParams.ToolResources.builder() .codeInterpreter( BetaThreadUpdateParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaThreadUpdateParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) + .addVectorStoreId("string") .build() ) .build() @@ -194,42 +179,34 @@ class ThreadServiceTest { .temperature(1.0) .thread( BetaThreadCreateAndRunParams.Thread.builder() - .messages( - listOf( - BetaThreadCreateAndRunParams.Thread.Message.builder() - .content( - BetaThreadCreateAndRunParams.Thread.Message.Content - .ofTextContent("string") - ) - .role(BetaThreadCreateAndRunParams.Thread.Message.Role.USER) - .attachments( - listOf( + .addMessage( + BetaThreadCreateAndRunParams.Thread.Message.builder() + .content( + BetaThreadCreateAndRunParams.Thread.Message.Content + .ofTextContent("string") + ) + .role(BetaThreadCreateAndRunParams.Thread.Message.Role.USER) + .addAttachment( + BetaThreadCreateAndRunParams.Thread.Message.Attachment + .builder() + .fileId("file_id") + .addTool( BetaThreadCreateAndRunParams.Thread.Message .Attachment - .builder() - .fileId("file_id") - .tools( - listOf( - BetaThreadCreateAndRunParams.Thread - .Message - .Attachment - .Tool - .ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type( - CodeInterpreterTool.Type - .CODE_INTERPRETER - ) - .build() - ) - ) + .Tool + .ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type( + CodeInterpreterTool.Type + .CODE_INTERPRETER + ) + .build() ) - .build() ) - ) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .build() + ) + .metadata(JsonValue.from(mapOf())) + .build() ) .metadata(JsonValue.from(mapOf())) .toolResources( @@ -238,39 +215,34 @@ class ThreadServiceTest { BetaThreadCreateAndRunParams.Thread.ToolResources .CodeInterpreter .builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaThreadCreateAndRunParams.Thread.ToolResources.FileSearch .builder() - .vectorStoreIds(listOf("string")) - .vectorStores( - listOf( - BetaThreadCreateAndRunParams.Thread - .ToolResources - .FileSearch - .VectorStore - .builder() - .chunkingStrategy( - FileChunkingStrategyParam - .ofAutoFileChunkingStrategyParam( - AutoFileChunkingStrategyParam - .builder() - .type( - AutoFileChunkingStrategyParam - .Type - .AUTO - ) - .build() - ) - ) - .fileIds(listOf("string")) - .metadata( - JsonValue.from(mapOf()) - ) - .build() - ) + .addVectorStoreId("string") + .addVectorStore( + BetaThreadCreateAndRunParams.Thread.ToolResources + .FileSearch + .VectorStore + .builder() + .chunkingStrategy( + FileChunkingStrategyParam + .ofAutoFileChunkingStrategyParam( + AutoFileChunkingStrategyParam + .builder() + .type( + AutoFileChunkingStrategyParam + .Type + .AUTO + ) + .build() + ) + ) + .addFileId("string") + .metadata(JsonValue.from(mapOf())) + .build() ) .build() ) @@ -287,23 +259,21 @@ class ThreadServiceTest { BetaThreadCreateAndRunParams.ToolResources.builder() .codeInterpreter( BetaThreadCreateAndRunParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaThreadCreateAndRunParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) + .addVectorStoreId("string") .build() ) .build() ) - .tools( - listOf( - BetaThreadCreateAndRunParams.Tool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + BetaThreadCreateAndRunParams.Tool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .topP(1.0) @@ -346,42 +316,34 @@ class ThreadServiceTest { .temperature(1.0) .thread( BetaThreadCreateAndRunParams.Thread.builder() - .messages( - listOf( - BetaThreadCreateAndRunParams.Thread.Message.builder() - .content( - BetaThreadCreateAndRunParams.Thread.Message.Content - .ofTextContent("string") - ) - .role(BetaThreadCreateAndRunParams.Thread.Message.Role.USER) - .attachments( - listOf( + .addMessage( + BetaThreadCreateAndRunParams.Thread.Message.builder() + .content( + BetaThreadCreateAndRunParams.Thread.Message.Content + .ofTextContent("string") + ) + .role(BetaThreadCreateAndRunParams.Thread.Message.Role.USER) + .addAttachment( + BetaThreadCreateAndRunParams.Thread.Message.Attachment + .builder() + .fileId("file_id") + .addTool( BetaThreadCreateAndRunParams.Thread.Message .Attachment - .builder() - .fileId("file_id") - .tools( - listOf( - BetaThreadCreateAndRunParams.Thread - .Message - .Attachment - .Tool - .ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type( - CodeInterpreterTool.Type - .CODE_INTERPRETER - ) - .build() - ) - ) + .Tool + .ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type( + CodeInterpreterTool.Type + .CODE_INTERPRETER + ) + .build() ) - .build() ) - ) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .build() + ) + .metadata(JsonValue.from(mapOf())) + .build() ) .metadata(JsonValue.from(mapOf())) .toolResources( @@ -390,39 +352,34 @@ class ThreadServiceTest { BetaThreadCreateAndRunParams.Thread.ToolResources .CodeInterpreter .builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaThreadCreateAndRunParams.Thread.ToolResources.FileSearch .builder() - .vectorStoreIds(listOf("string")) - .vectorStores( - listOf( - BetaThreadCreateAndRunParams.Thread - .ToolResources - .FileSearch - .VectorStore - .builder() - .chunkingStrategy( - FileChunkingStrategyParam - .ofAutoFileChunkingStrategyParam( - AutoFileChunkingStrategyParam - .builder() - .type( - AutoFileChunkingStrategyParam - .Type - .AUTO - ) - .build() - ) - ) - .fileIds(listOf("string")) - .metadata( - JsonValue.from(mapOf()) - ) - .build() - ) + .addVectorStoreId("string") + .addVectorStore( + BetaThreadCreateAndRunParams.Thread.ToolResources + .FileSearch + .VectorStore + .builder() + .chunkingStrategy( + FileChunkingStrategyParam + .ofAutoFileChunkingStrategyParam( + AutoFileChunkingStrategyParam + .builder() + .type( + AutoFileChunkingStrategyParam + .Type + .AUTO + ) + .build() + ) + ) + .addFileId("string") + .metadata(JsonValue.from(mapOf())) + .build() ) .build() ) @@ -439,23 +396,21 @@ class ThreadServiceTest { BetaThreadCreateAndRunParams.ToolResources.builder() .codeInterpreter( BetaThreadCreateAndRunParams.ToolResources.CodeInterpreter.builder() - .fileIds(listOf("string")) + .addFileId("string") .build() ) .fileSearch( BetaThreadCreateAndRunParams.ToolResources.FileSearch.builder() - .vectorStoreIds(listOf("string")) + .addVectorStoreId("string") .build() ) .build() ) - .tools( - listOf( - BetaThreadCreateAndRunParams.Tool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + BetaThreadCreateAndRunParams.Tool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .topP(1.0) diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/VectorStoreServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/VectorStoreServiceTest.kt index 5a47fce8..28daefcd 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/VectorStoreServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/VectorStoreServiceTest.kt @@ -42,7 +42,7 @@ class VectorStoreServiceTest { .days(1L) .build() ) - .fileIds(listOf("string")) + .addFileId("string") .metadata(JsonValue.from(mapOf())) .name("name") .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/threads/MessageServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/threads/MessageServiceTest.kt index 411d5c2a..9a3d8dd9 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/threads/MessageServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/threads/MessageServiceTest.kt @@ -31,22 +31,17 @@ class MessageServiceTest { .threadId("thread_id") .content(BetaThreadMessageCreateParams.Content.ofTextContent("string")) .role(BetaThreadMessageCreateParams.Role.USER) - .attachments( - listOf( - BetaThreadMessageCreateParams.Attachment.builder() - .fileId("file_id") - .tools( - listOf( - BetaThreadMessageCreateParams.Attachment.Tool - .ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) - ) + .addAttachment( + BetaThreadMessageCreateParams.Attachment.builder() + .fileId("file_id") + .addTool( + BetaThreadMessageCreateParams.Attachment.Tool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) - .build() - ) + ) + .build() ) .metadata(JsonValue.from(mapOf())) .build() diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/threads/RunServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/threads/RunServiceTest.kt index 4b3268a6..2e5f13e5 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/threads/RunServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/threads/RunServiceTest.kt @@ -36,44 +36,31 @@ class RunServiceTest { BetaThreadRunCreateParams.builder() .threadId("thread_id") .assistantId("assistant_id") - .include( - listOf(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT) - ) + .addInclude(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT) .additionalInstructions("additional_instructions") - .additionalMessages( - listOf( - BetaThreadRunCreateParams.AdditionalMessage.builder() - .content( - BetaThreadRunCreateParams.AdditionalMessage.Content - .ofTextContent("string") + .addAdditionalMessage( + BetaThreadRunCreateParams.AdditionalMessage.builder() + .content( + BetaThreadRunCreateParams.AdditionalMessage.Content.ofTextContent( + "string" ) - .role(BetaThreadRunCreateParams.AdditionalMessage.Role.USER) - .attachments( - listOf( - BetaThreadRunCreateParams.AdditionalMessage.Attachment - .builder() - .fileId("file_id") - .tools( - listOf( - BetaThreadRunCreateParams.AdditionalMessage - .Attachment - .Tool - .ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type( - CodeInterpreterTool.Type - .CODE_INTERPRETER - ) - .build() - ) - ) + ) + .role(BetaThreadRunCreateParams.AdditionalMessage.Role.USER) + .addAttachment( + BetaThreadRunCreateParams.AdditionalMessage.Attachment.builder() + .fileId("file_id") + .addTool( + BetaThreadRunCreateParams.AdditionalMessage.Attachment.Tool + .ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) - .build() ) - ) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .build() + ) + .metadata(JsonValue.from(mapOf())) + .build() ) .instructions("instructions") .maxCompletionTokens(256L) @@ -92,13 +79,11 @@ class RunServiceTest { AssistantToolChoiceOption.Behavior.NONE ) ) - .tools( - listOf( - AssistantTool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + AssistantTool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .topP(1.0) @@ -128,44 +113,31 @@ class RunServiceTest { BetaThreadRunCreateParams.builder() .threadId("thread_id") .assistantId("assistant_id") - .include( - listOf(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT) - ) + .addInclude(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT) .additionalInstructions("additional_instructions") - .additionalMessages( - listOf( - BetaThreadRunCreateParams.AdditionalMessage.builder() - .content( - BetaThreadRunCreateParams.AdditionalMessage.Content - .ofTextContent("string") + .addAdditionalMessage( + BetaThreadRunCreateParams.AdditionalMessage.builder() + .content( + BetaThreadRunCreateParams.AdditionalMessage.Content.ofTextContent( + "string" ) - .role(BetaThreadRunCreateParams.AdditionalMessage.Role.USER) - .attachments( - listOf( - BetaThreadRunCreateParams.AdditionalMessage.Attachment - .builder() - .fileId("file_id") - .tools( - listOf( - BetaThreadRunCreateParams.AdditionalMessage - .Attachment - .Tool - .ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type( - CodeInterpreterTool.Type - .CODE_INTERPRETER - ) - .build() - ) - ) + ) + .role(BetaThreadRunCreateParams.AdditionalMessage.Role.USER) + .addAttachment( + BetaThreadRunCreateParams.AdditionalMessage.Attachment.builder() + .fileId("file_id") + .addTool( + BetaThreadRunCreateParams.AdditionalMessage.Attachment.Tool + .ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) - .build() ) - ) - .metadata(JsonValue.from(mapOf())) - .build() - ) + .build() + ) + .metadata(JsonValue.from(mapOf())) + .build() ) .instructions("instructions") .maxCompletionTokens(256L) @@ -184,13 +156,11 @@ class RunServiceTest { AssistantToolChoiceOption.Behavior.NONE ) ) - .tools( - listOf( - AssistantTool.ofCodeInterpreterTool( - CodeInterpreterTool.builder() - .type(CodeInterpreterTool.Type.CODE_INTERPRETER) - .build() - ) + .addTool( + AssistantTool.ofCodeInterpreterTool( + CodeInterpreterTool.builder() + .type(CodeInterpreterTool.Type.CODE_INTERPRETER) + .build() ) ) .topP(1.0) @@ -290,13 +260,11 @@ class RunServiceTest { BetaThreadRunSubmitToolOutputsParams.builder() .threadId("thread_id") .runId("run_id") - .toolOutputs( - listOf( - BetaThreadRunSubmitToolOutputsParams.ToolOutput.builder() - .output("output") - .toolCallId("tool_call_id") - .build() - ) + .addToolOutput( + BetaThreadRunSubmitToolOutputsParams.ToolOutput.builder() + .output("output") + .toolCallId("tool_call_id") + .build() ) .build() ) @@ -318,13 +286,11 @@ class RunServiceTest { BetaThreadRunSubmitToolOutputsParams.builder() .threadId("thread_id") .runId("run_id") - .toolOutputs( - listOf( - BetaThreadRunSubmitToolOutputsParams.ToolOutput.builder() - .output("output") - .toolCallId("tool_call_id") - .build() - ) + .addToolOutput( + BetaThreadRunSubmitToolOutputsParams.ToolOutput.builder() + .output("output") + .toolCallId("tool_call_id") + .build() ) .build() ) diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/threads/runs/StepServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/threads/runs/StepServiceTest.kt index 78323548..9dde52cd 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/threads/runs/StepServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/threads/runs/StepServiceTest.kt @@ -27,9 +27,7 @@ class StepServiceTest { .threadId("thread_id") .runId("run_id") .stepId("step_id") - .include( - listOf(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT) - ) + .addInclude(RunStepInclude.STEP_DETAILS_TOOL_CALLS_FILE_SEARCH_RESULTS_CONTENT) .build() ) println(runStep) diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/vectorStores/FileBatchServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/vectorStores/FileBatchServiceTest.kt index dead951f..94107980 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/vectorStores/FileBatchServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/beta/vectorStores/FileBatchServiceTest.kt @@ -28,7 +28,7 @@ class FileBatchServiceTest { fileBatchService.create( BetaVectorStoreFileBatchCreateParams.builder() .vectorStoreId("vs_abc123") - .fileIds(listOf("string")) + .addFileId("string") .chunkingStrategy( FileChunkingStrategyParam.ofAutoFileChunkingStrategyParam( AutoFileChunkingStrategyParam.builder() diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/chat/CompletionServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/chat/CompletionServiceTest.kt index af3e8f65..35c2e7a2 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/chat/CompletionServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/chat/CompletionServiceTest.kt @@ -36,19 +36,17 @@ class CompletionServiceTest { val chatCompletion = completionService.create( ChatCompletionCreateParams.builder() - .messages( - listOf( - ChatCompletionMessageParam.ofChatCompletionDeveloperMessageParam( - ChatCompletionDeveloperMessageParam.builder() - .content( - ChatCompletionDeveloperMessageParam.Content.ofTextContent( - "string" - ) + .addMessage( + ChatCompletionMessageParam.ofChatCompletionDeveloperMessageParam( + ChatCompletionDeveloperMessageParam.builder() + .content( + ChatCompletionDeveloperMessageParam.Content.ofTextContent( + "string" ) - .role(ChatCompletionDeveloperMessageParam.Role.DEVELOPER) - .name("name") - .build() - ) + ) + .role(ChatCompletionDeveloperMessageParam.Role.DEVELOPER) + .name("name") + .build() ) ) .model(ChatModel.O1) @@ -64,18 +62,16 @@ class CompletionServiceTest { ChatCompletionCreateParams.FunctionCall.Behavior.NONE ) ) - .functions( - listOf( - ChatCompletionCreateParams.Function.builder() - .name("name") - .description("description") - .parameters( - FunctionParameters.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .build() - ) + .addFunction( + ChatCompletionCreateParams.Function.builder() + .name("name") + .description("description") + .parameters( + FunctionParameters.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() ) .logitBias( ChatCompletionCreateParams.LogitBias.builder() @@ -90,7 +86,7 @@ class CompletionServiceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) - .modalities(listOf(ChatCompletionModality.TEXT)) + .addModality(ChatCompletionModality.TEXT) .n(1L) .parallelToolCalls(true) .prediction( @@ -119,24 +115,22 @@ class CompletionServiceTest { ChatCompletionToolChoiceOption.Behavior.NONE ) ) - .tools( - listOf( - ChatCompletionTool.builder() - .function( - FunctionDefinition.builder() - .name("name") - .description("description") - .parameters( - FunctionParameters.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .strict(true) - .build() - ) - .type(ChatCompletionTool.Type.FUNCTION) - .build() - ) + .addTool( + ChatCompletionTool.builder() + .function( + FunctionDefinition.builder() + .name("name") + .description("description") + .parameters( + FunctionParameters.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .strict(true) + .build() + ) + .type(ChatCompletionTool.Type.FUNCTION) + .build() ) .topLogprobs(0L) .topP(1.0) @@ -159,19 +153,17 @@ class CompletionServiceTest { val chatCompletionStream = completionService.createStreaming( ChatCompletionCreateParams.builder() - .messages( - listOf( - ChatCompletionMessageParam.ofChatCompletionDeveloperMessageParam( - ChatCompletionDeveloperMessageParam.builder() - .content( - ChatCompletionDeveloperMessageParam.Content.ofTextContent( - "string" - ) + .addMessage( + ChatCompletionMessageParam.ofChatCompletionDeveloperMessageParam( + ChatCompletionDeveloperMessageParam.builder() + .content( + ChatCompletionDeveloperMessageParam.Content.ofTextContent( + "string" ) - .role(ChatCompletionDeveloperMessageParam.Role.DEVELOPER) - .name("name") - .build() - ) + ) + .role(ChatCompletionDeveloperMessageParam.Role.DEVELOPER) + .name("name") + .build() ) ) .model(ChatModel.O1) @@ -187,18 +179,16 @@ class CompletionServiceTest { ChatCompletionCreateParams.FunctionCall.Behavior.NONE ) ) - .functions( - listOf( - ChatCompletionCreateParams.Function.builder() - .name("name") - .description("description") - .parameters( - FunctionParameters.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .build() - ) + .addFunction( + ChatCompletionCreateParams.Function.builder() + .name("name") + .description("description") + .parameters( + FunctionParameters.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .build() ) .logitBias( ChatCompletionCreateParams.LogitBias.builder() @@ -213,7 +203,7 @@ class CompletionServiceTest { .putAdditionalProperty("foo", JsonValue.from("string")) .build() ) - .modalities(listOf(ChatCompletionModality.TEXT)) + .addModality(ChatCompletionModality.TEXT) .n(1L) .parallelToolCalls(true) .prediction( @@ -242,24 +232,22 @@ class CompletionServiceTest { ChatCompletionToolChoiceOption.Behavior.NONE ) ) - .tools( - listOf( - ChatCompletionTool.builder() - .function( - FunctionDefinition.builder() - .name("name") - .description("description") - .parameters( - FunctionParameters.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .strict(true) - .build() - ) - .type(ChatCompletionTool.Type.FUNCTION) - .build() - ) + .addTool( + ChatCompletionTool.builder() + .function( + FunctionDefinition.builder() + .name("name") + .description("description") + .parameters( + FunctionParameters.builder() + .putAdditionalProperty("foo", JsonValue.from("bar")) + .build() + ) + .strict(true) + .build() + ) + .type(ChatCompletionTool.Type.FUNCTION) + .build() ) .topLogprobs(0L) .topP(1.0) diff --git a/openai-java-core/src/test/kotlin/com/openai/services/blocking/fineTuning/JobServiceTest.kt b/openai-java-core/src/test/kotlin/com/openai/services/blocking/fineTuning/JobServiceTest.kt index 11809180..9ee28ca5 100644 --- a/openai-java-core/src/test/kotlin/com/openai/services/blocking/fineTuning/JobServiceTest.kt +++ b/openai-java-core/src/test/kotlin/com/openai/services/blocking/fineTuning/JobServiceTest.kt @@ -52,20 +52,18 @@ class JobServiceTest { ) .build() ) - .integrations( - listOf( - FineTuningJobCreateParams.Integration.builder() - .type(FineTuningJobCreateParams.Integration.Type.WANDB) - .wandb( - FineTuningJobCreateParams.Integration.Wandb.builder() - .project("my-wandb-project") - .entity("entity") - .name("name") - .tags(listOf("custom-tag")) - .build() - ) - .build() - ) + .addIntegration( + FineTuningJobCreateParams.Integration.builder() + .type(FineTuningJobCreateParams.Integration.Type.WANDB) + .wandb( + FineTuningJobCreateParams.Integration.Wandb.builder() + .project("my-wandb-project") + .entity("entity") + .name("name") + .addTag("custom-tag") + .build() + ) + .build() ) .method( FineTuningJobCreateParams.Method.builder()