From 5560e6ba5f77e774d6be40e71628c1b62f8b3005 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 10:29:25 +0000 Subject: [PATCH 1/4] chore(tests): limit array example length (#128) --- audiotranscription_test.go | 2 +- betaassistant_test.go | 14 +-- betathread_test.go | 188 ++----------------------------------- betathreadmessage_test.go | 22 ----- betathreadrun_test.go | 96 ------------------- betavectorstore_test.go | 2 +- chatcompletion_test.go | 22 +---- finetuningjob_test.go | 18 +--- upload_test.go | 2 +- 9 files changed, 14 insertions(+), 352 deletions(-) diff --git a/audiotranscription_test.go b/audiotranscription_test.go index 958d43d6..3547baa0 100644 --- a/audiotranscription_test.go +++ b/audiotranscription_test.go @@ -34,7 +34,7 @@ func TestAudioTranscriptionNewWithOptionalParams(t *testing.T) { Prompt: openai.F("prompt"), ResponseFormat: openai.F(openai.AudioResponseFormatJSON), Temperature: openai.F(0.000000), - TimestampGranularities: openai.F([]openai.AudioTranscriptionNewParamsTimestampGranularity{openai.AudioTranscriptionNewParamsTimestampGranularityWord, openai.AudioTranscriptionNewParamsTimestampGranularitySegment}), + TimestampGranularities: openai.F([]openai.AudioTranscriptionNewParamsTimestampGranularity{openai.AudioTranscriptionNewParamsTimestampGranularityWord}), }) if err != nil { var apierr *openai.Error diff --git a/betaassistant_test.go b/betaassistant_test.go index 8fbe3aba..320efd09 100644 --- a/betaassistant_test.go +++ b/betaassistant_test.go @@ -34,7 +34,7 @@ func TestBetaAssistantNewWithOptionalParams(t *testing.T) { Temperature: openai.F(1.000000), ToolResources: openai.F(openai.BetaAssistantNewParamsToolResources{ CodeInterpreter: openai.F(openai.BetaAssistantNewParamsToolResourcesCodeInterpreter{ - FileIDs: openai.F([]string{"string", "string", "string"}), + FileIDs: openai.F([]string{"string"}), }), FileSearch: openai.F(openai.BetaAssistantNewParamsToolResourcesFileSearch{ VectorStoreIDs: openai.F([]string{"string"}), @@ -42,17 +42,13 @@ func TestBetaAssistantNewWithOptionalParams(t *testing.T) { ChunkingStrategy: openai.F[openai.FileChunkingStrategyParamUnion](openai.AutoFileChunkingStrategyParam{ Type: openai.F(openai.AutoFileChunkingStrategyParamTypeAuto), }), - FileIDs: openai.F([]string{"string", "string", "string"}), + FileIDs: openai.F([]string{"string"}), Metadata: openai.F[any](map[string]interface{}{}), }}), }), }), Tools: openai.F([]openai.AssistantToolUnionParam{openai.CodeInterpreterToolParam{ Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), }}), TopP: openai.F(1.000000), }) @@ -111,7 +107,7 @@ func TestBetaAssistantUpdateWithOptionalParams(t *testing.T) { Temperature: openai.F(1.000000), ToolResources: openai.F(openai.BetaAssistantUpdateParamsToolResources{ CodeInterpreter: openai.F(openai.BetaAssistantUpdateParamsToolResourcesCodeInterpreter{ - FileIDs: openai.F([]string{"string", "string", "string"}), + FileIDs: openai.F([]string{"string"}), }), FileSearch: openai.F(openai.BetaAssistantUpdateParamsToolResourcesFileSearch{ VectorStoreIDs: openai.F([]string{"string"}), @@ -119,10 +115,6 @@ func TestBetaAssistantUpdateWithOptionalParams(t *testing.T) { }), Tools: openai.F([]openai.AssistantToolUnionParam{openai.CodeInterpreterToolParam{ Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), }}), TopP: openai.F(1.000000), }, diff --git a/betathread_test.go b/betathread_test.go index c7ea2aa6..849e2571 100644 --- a/betathread_test.go +++ b/betathread_test.go @@ -33,92 +33,6 @@ func TestBetaThreadNewWithOptionalParams(t *testing.T) { FileID: openai.F("file_id"), Tools: openai.F([]openai.BetaThreadNewParamsMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadNewParamsMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadNewParamsMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }}), - Metadata: openai.F[any](map[string]interface{}{}), - }, { - Content: openai.F([]openai.MessageContentPartParamUnion{openai.ImageFileContentBlockParam{ImageFile: openai.F(openai.ImageFileParam{FileID: openai.F("file_id"), Detail: openai.F(openai.ImageFileDetailAuto)}), Type: openai.F(openai.ImageFileContentBlockTypeImageFile)}}), - Role: openai.F(openai.BetaThreadNewParamsMessagesRoleUser), - Attachments: openai.F([]openai.BetaThreadNewParamsMessagesAttachment{{ - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadNewParamsMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadNewParamsMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadNewParamsMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }}), - Metadata: openai.F[any](map[string]interface{}{}), - }, { - Content: openai.F([]openai.MessageContentPartParamUnion{openai.ImageFileContentBlockParam{ImageFile: openai.F(openai.ImageFileParam{FileID: openai.F("file_id"), Detail: openai.F(openai.ImageFileDetailAuto)}), Type: openai.F(openai.ImageFileContentBlockTypeImageFile)}}), - Role: openai.F(openai.BetaThreadNewParamsMessagesRoleUser), - Attachments: openai.F([]openai.BetaThreadNewParamsMessagesAttachment{{ - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadNewParamsMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadNewParamsMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadNewParamsMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), }}), }}), Metadata: openai.F[any](map[string]interface{}{}), @@ -126,7 +40,7 @@ func TestBetaThreadNewWithOptionalParams(t *testing.T) { Metadata: openai.F[any](map[string]interface{}{}), ToolResources: openai.F(openai.BetaThreadNewParamsToolResources{ CodeInterpreter: openai.F(openai.BetaThreadNewParamsToolResourcesCodeInterpreter{ - FileIDs: openai.F([]string{"string", "string", "string"}), + FileIDs: openai.F([]string{"string"}), }), FileSearch: openai.F(openai.BetaThreadNewParamsToolResourcesFileSearch{ VectorStoreIDs: openai.F([]string{"string"}), @@ -134,7 +48,7 @@ func TestBetaThreadNewWithOptionalParams(t *testing.T) { ChunkingStrategy: openai.F[openai.FileChunkingStrategyParamUnion](openai.AutoFileChunkingStrategyParam{ Type: openai.F(openai.AutoFileChunkingStrategyParamTypeAuto), }), - FileIDs: openai.F([]string{"string", "string", "string"}), + FileIDs: openai.F([]string{"string"}), Metadata: openai.F[any](map[string]interface{}{}), }}), }), @@ -190,7 +104,7 @@ func TestBetaThreadUpdateWithOptionalParams(t *testing.T) { Metadata: openai.F[any](map[string]interface{}{}), ToolResources: openai.F(openai.BetaThreadUpdateParamsToolResources{ CodeInterpreter: openai.F(openai.BetaThreadUpdateParamsToolResourcesCodeInterpreter{ - FileIDs: openai.F([]string{"string", "string", "string"}), + FileIDs: openai.F([]string{"string"}), }), FileSearch: openai.F(openai.BetaThreadUpdateParamsToolResourcesFileSearch{ VectorStoreIDs: openai.F([]string{"string"}), @@ -258,92 +172,6 @@ func TestBetaThreadNewAndRunWithOptionalParams(t *testing.T) { FileID: openai.F("file_id"), Tools: openai.F([]openai.BetaThreadNewAndRunParamsThreadMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadNewAndRunParamsThreadMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadNewAndRunParamsThreadMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }}), - Metadata: openai.F[any](map[string]interface{}{}), - }, { - Content: openai.F([]openai.MessageContentPartParamUnion{openai.ImageFileContentBlockParam{ImageFile: openai.F(openai.ImageFileParam{FileID: openai.F("file_id"), Detail: openai.F(openai.ImageFileDetailAuto)}), Type: openai.F(openai.ImageFileContentBlockTypeImageFile)}}), - Role: openai.F(openai.BetaThreadNewAndRunParamsThreadMessagesRoleUser), - Attachments: openai.F([]openai.BetaThreadNewAndRunParamsThreadMessagesAttachment{{ - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadNewAndRunParamsThreadMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadNewAndRunParamsThreadMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadNewAndRunParamsThreadMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }}), - Metadata: openai.F[any](map[string]interface{}{}), - }, { - Content: openai.F([]openai.MessageContentPartParamUnion{openai.ImageFileContentBlockParam{ImageFile: openai.F(openai.ImageFileParam{FileID: openai.F("file_id"), Detail: openai.F(openai.ImageFileDetailAuto)}), Type: openai.F(openai.ImageFileContentBlockTypeImageFile)}}), - Role: openai.F(openai.BetaThreadNewAndRunParamsThreadMessagesRoleUser), - Attachments: openai.F([]openai.BetaThreadNewAndRunParamsThreadMessagesAttachment{{ - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadNewAndRunParamsThreadMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadNewAndRunParamsThreadMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadNewAndRunParamsThreadMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), }}), }}), Metadata: openai.F[any](map[string]interface{}{}), @@ -351,7 +179,7 @@ func TestBetaThreadNewAndRunWithOptionalParams(t *testing.T) { Metadata: openai.F[any](map[string]interface{}{}), ToolResources: openai.F(openai.BetaThreadNewAndRunParamsThreadToolResources{ CodeInterpreter: openai.F(openai.BetaThreadNewAndRunParamsThreadToolResourcesCodeInterpreter{ - FileIDs: openai.F([]string{"string", "string", "string"}), + FileIDs: openai.F([]string{"string"}), }), FileSearch: openai.F(openai.BetaThreadNewAndRunParamsThreadToolResourcesFileSearch{ VectorStoreIDs: openai.F([]string{"string"}), @@ -359,7 +187,7 @@ func TestBetaThreadNewAndRunWithOptionalParams(t *testing.T) { ChunkingStrategy: openai.F[openai.FileChunkingStrategyParamUnion](openai.AutoFileChunkingStrategyParam{ Type: openai.F(openai.AutoFileChunkingStrategyParamTypeAuto), }), - FileIDs: openai.F([]string{"string", "string", "string"}), + FileIDs: openai.F([]string{"string"}), Metadata: openai.F[any](map[string]interface{}{}), }}), }), @@ -368,7 +196,7 @@ func TestBetaThreadNewAndRunWithOptionalParams(t *testing.T) { ToolChoice: openai.F[openai.AssistantToolChoiceOptionUnionParam](openai.AssistantToolChoiceOptionBehavior(openai.AssistantToolChoiceOptionBehaviorNone)), ToolResources: openai.F(openai.BetaThreadNewAndRunParamsToolResources{ CodeInterpreter: openai.F(openai.BetaThreadNewAndRunParamsToolResourcesCodeInterpreter{ - FileIDs: openai.F([]string{"string", "string", "string"}), + FileIDs: openai.F([]string{"string"}), }), FileSearch: openai.F(openai.BetaThreadNewAndRunParamsToolResourcesFileSearch{ VectorStoreIDs: openai.F([]string{"string"}), @@ -376,10 +204,6 @@ func TestBetaThreadNewAndRunWithOptionalParams(t *testing.T) { }), Tools: openai.F([]openai.BetaThreadNewAndRunParamsToolUnion{openai.CodeInterpreterToolParam{ Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), }}), TopP: openai.F(1.000000), TruncationStrategy: openai.F(openai.BetaThreadNewAndRunParamsTruncationStrategy{ diff --git a/betathreadmessage_test.go b/betathreadmessage_test.go index 26d1a495..facc3d70 100644 --- a/betathreadmessage_test.go +++ b/betathreadmessage_test.go @@ -35,28 +35,6 @@ func TestBetaThreadMessageNewWithOptionalParams(t *testing.T) { FileID: openai.F("file_id"), Tools: openai.F([]openai.BetaThreadMessageNewParamsAttachmentsToolUnion{openai.CodeInterpreterToolParam{ Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadMessageNewParamsAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadMessageNewParamsAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), }}), }}), Metadata: openai.F[any](map[string]interface{}{}), diff --git a/betathreadrun_test.go b/betathreadrun_test.go index a136dfd2..8f1b3231 100644 --- a/betathreadrun_test.go +++ b/betathreadrun_test.go @@ -39,92 +39,6 @@ func TestBetaThreadRunNewWithOptionalParams(t *testing.T) { FileID: openai.F("file_id"), Tools: openai.F([]openai.BetaThreadRunNewParamsAdditionalMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadRunNewParamsAdditionalMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadRunNewParamsAdditionalMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }}), - Metadata: openai.F[any](map[string]interface{}{}), - }, { - Content: openai.F([]openai.MessageContentPartParamUnion{openai.ImageFileContentBlockParam{ImageFile: openai.F(openai.ImageFileParam{FileID: openai.F("file_id"), Detail: openai.F(openai.ImageFileDetailAuto)}), Type: openai.F(openai.ImageFileContentBlockTypeImageFile)}}), - Role: openai.F(openai.BetaThreadRunNewParamsAdditionalMessagesRoleUser), - Attachments: openai.F([]openai.BetaThreadRunNewParamsAdditionalMessagesAttachment{{ - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadRunNewParamsAdditionalMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadRunNewParamsAdditionalMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadRunNewParamsAdditionalMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }}), - Metadata: openai.F[any](map[string]interface{}{}), - }, { - Content: openai.F([]openai.MessageContentPartParamUnion{openai.ImageFileContentBlockParam{ImageFile: openai.F(openai.ImageFileParam{FileID: openai.F("file_id"), Detail: openai.F(openai.ImageFileDetailAuto)}), Type: openai.F(openai.ImageFileContentBlockTypeImageFile)}}), - Role: openai.F(openai.BetaThreadRunNewParamsAdditionalMessagesRoleUser), - Attachments: openai.F([]openai.BetaThreadRunNewParamsAdditionalMessagesAttachment{{ - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadRunNewParamsAdditionalMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadRunNewParamsAdditionalMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }}), - }, { - FileID: openai.F("file_id"), - Tools: openai.F([]openai.BetaThreadRunNewParamsAdditionalMessagesAttachmentsToolUnion{openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), }}), }}), Metadata: openai.F[any](map[string]interface{}{}), @@ -139,10 +53,6 @@ func TestBetaThreadRunNewWithOptionalParams(t *testing.T) { ToolChoice: openai.F[openai.AssistantToolChoiceOptionUnionParam](openai.AssistantToolChoiceOptionBehavior(openai.AssistantToolChoiceOptionBehaviorNone)), Tools: openai.F([]openai.AssistantToolUnionParam{openai.CodeInterpreterToolParam{ Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), - }, openai.CodeInterpreterToolParam{ - Type: openai.F(openai.CodeInterpreterToolTypeCodeInterpreter), }}), TopP: openai.F(1.000000), TruncationStrategy: openai.F(openai.BetaThreadRunNewParamsTruncationStrategy{ @@ -292,12 +202,6 @@ func TestBetaThreadRunSubmitToolOutputsWithOptionalParams(t *testing.T) { ToolOutputs: openai.F([]openai.BetaThreadRunSubmitToolOutputsParamsToolOutput{{ Output: openai.F("output"), ToolCallID: openai.F("tool_call_id"), - }, { - Output: openai.F("output"), - ToolCallID: openai.F("tool_call_id"), - }, { - Output: openai.F("output"), - ToolCallID: openai.F("tool_call_id"), }}), }, ) diff --git a/betavectorstore_test.go b/betavectorstore_test.go index cd5963ec..f19a530e 100644 --- a/betavectorstore_test.go +++ b/betavectorstore_test.go @@ -33,7 +33,7 @@ func TestBetaVectorStoreNewWithOptionalParams(t *testing.T) { Anchor: openai.F(openai.BetaVectorStoreNewParamsExpiresAfterAnchorLastActiveAt), Days: openai.F(int64(1)), }), - FileIDs: openai.F([]string{"string", "string", "string"}), + FileIDs: openai.F([]string{"string"}), Metadata: openai.F[any](map[string]interface{}{}), Name: openai.F("name"), }) diff --git a/chatcompletion_test.go b/chatcompletion_test.go index ff11aee8..7789b739 100644 --- a/chatcompletion_test.go +++ b/chatcompletion_test.go @@ -55,7 +55,7 @@ func TestChatCompletionNewWithOptionalParams(t *testing.T) { Metadata: openai.F(map[string]string{ "foo": "string", }), - Modalities: openai.F([]openai.ChatCompletionModality{openai.ChatCompletionModalityText, openai.ChatCompletionModalityAudio}), + Modalities: openai.F([]openai.ChatCompletionModality{openai.ChatCompletionModalityText}), N: openai.F(int64(1)), ParallelToolCalls: openai.F(true), Prediction: openai.F(openai.ChatCompletionPredictionContentParam{ @@ -85,26 +85,6 @@ func TestChatCompletionNewWithOptionalParams(t *testing.T) { Strict: openai.F(true), }), Type: openai.F(openai.ChatCompletionToolTypeFunction), - }, { - Function: openai.F(shared.FunctionDefinitionParam{ - Name: openai.F("name"), - Description: openai.F("description"), - Parameters: openai.F(shared.FunctionParameters{ - "foo": "bar", - }), - Strict: openai.F(true), - }), - Type: openai.F(openai.ChatCompletionToolTypeFunction), - }, { - Function: openai.F(shared.FunctionDefinitionParam{ - Name: openai.F("name"), - Description: openai.F("description"), - Parameters: openai.F(shared.FunctionParameters{ - "foo": "bar", - }), - Strict: openai.F(true), - }), - Type: openai.F(openai.ChatCompletionToolTypeFunction), }}), TopLogprobs: openai.F(int64(0)), TopP: openai.F(1.000000), diff --git a/finetuningjob_test.go b/finetuningjob_test.go index b8b381aa..cc730826 100644 --- a/finetuningjob_test.go +++ b/finetuningjob_test.go @@ -39,23 +39,7 @@ func TestFineTuningJobNewWithOptionalParams(t *testing.T) { Project: openai.F("my-wandb-project"), Entity: openai.F("entity"), Name: openai.F("name"), - Tags: openai.F([]string{"custom-tag", "custom-tag", "custom-tag"}), - }), - }, { - Type: openai.F(openai.FineTuningJobNewParamsIntegrationsTypeWandb), - Wandb: openai.F(openai.FineTuningJobNewParamsIntegrationsWandb{ - Project: openai.F("my-wandb-project"), - Entity: openai.F("entity"), - Name: openai.F("name"), - Tags: openai.F([]string{"custom-tag", "custom-tag", "custom-tag"}), - }), - }, { - Type: openai.F(openai.FineTuningJobNewParamsIntegrationsTypeWandb), - Wandb: openai.F(openai.FineTuningJobNewParamsIntegrationsWandb{ - Project: openai.F("my-wandb-project"), - Entity: openai.F("entity"), - Name: openai.F("name"), - Tags: openai.F([]string{"custom-tag", "custom-tag", "custom-tag"}), + Tags: openai.F([]string{"custom-tag"}), }), }}), Seed: openai.F(int64(42)), diff --git a/upload_test.go b/upload_test.go index e19a2775..9bd0cdaa 100644 --- a/upload_test.go +++ b/upload_test.go @@ -78,7 +78,7 @@ func TestUploadCompleteWithOptionalParams(t *testing.T) { context.TODO(), "upload_abc123", openai.UploadCompleteParams{ - PartIDs: openai.F([]string{"string", "string", "string"}), + PartIDs: openai.F([]string{"string"}), Md5: openai.F("md5"), }, ) From 23476d8131b009e38f7f22024d925fd7fe76e4db Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 18 Nov 2024 10:42:34 +0000 Subject: [PATCH 2/4] chore(internal): spec update (#130) --- .stats.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.stats.yml b/.stats.yml index f368bc88..fdef8d27 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-2f8ca92b9b1879fd535b685e4767338413fcd533d42f3baac13a9c41da3fce35.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-fb9db2d2c1f0d6b39d8ee042db5d5c59acba6ad1daf47c18792c1f5fb24b3401.yml From 8dabbd3d3f338986470049c1a3842e47a7194c1e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:17:55 +0000 Subject: [PATCH 3/4] feat(api): add gpt-4o-2024-11-20 model (#131) --- .stats.yml | 2 +- batch.go | 2 +- chat.go | 1 + chatcompletion.go | 10 ++++++---- file.go | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index fdef8d27..4827e538 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ configured_endpoints: 68 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-fb9db2d2c1f0d6b39d8ee042db5d5c59acba6ad1daf47c18792c1f5fb24b3401.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-aa9b01fc0c17eb0cbc200533fc20d6a49c5e764ceaf8049e08b294532be6e9ff.yml diff --git a/batch.go b/batch.go index b861bac0..7becfa86 100644 --- a/batch.go +++ b/batch.go @@ -308,7 +308,7 @@ type BatchNewParams struct { // Your input file must be formatted as a // [JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input), // and must be uploaded with the purpose `batch`. The file can contain up to 50,000 - // requests, and can be up to 100 MB in size. + // requests, and can be up to 200 MB in size. InputFileID param.Field[string] `json:"input_file_id,required"` // Optional custom metadata for the batch. Metadata param.Field[map[string]string] `json:"metadata"` diff --git a/chat.go b/chat.go index c685a92d..b298e586 100644 --- a/chat.go +++ b/chat.go @@ -35,6 +35,7 @@ const ( ChatModelO1Mini ChatModel = "o1-mini" ChatModelO1Mini2024_09_12 ChatModel = "o1-mini-2024-09-12" ChatModelGPT4o ChatModel = "gpt-4o" + ChatModelGPT4o2024_11_20 ChatModel = "gpt-4o-2024-11-20" ChatModelGPT4o2024_08_06 ChatModel = "gpt-4o-2024-08-06" ChatModelGPT4o2024_05_13 ChatModel = "gpt-4o-2024-05-13" ChatModelGPT4oRealtimePreview ChatModel = "gpt-4o-realtime-preview" diff --git a/chatcompletion.go b/chatcompletion.go index f2dbbc56..242776be 100644 --- a/chatcompletion.go +++ b/chatcompletion.go @@ -454,8 +454,9 @@ type ChatCompletionAudioParam struct { // Specifies the output audio format. Must be one of `wav`, `mp3`, `flac`, `opus`, // or `pcm16`. Format param.Field[ChatCompletionAudioParamFormat] `json:"format,required"` - // The voice the model uses to respond. Supported voices are `alloy`, `ash`, - // `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`. + // The voice the model uses to respond. Supported voices are `ash`, `ballad`, + // `coral`, `sage`, and `verse` (also supported but not recommended are `alloy`, + // `echo`, and `shimmer`; these voices are less expressive). Voice param.Field[ChatCompletionAudioParamVoice] `json:"voice,required"` } @@ -483,8 +484,9 @@ func (r ChatCompletionAudioParamFormat) IsKnown() bool { return false } -// The voice the model uses to respond. Supported voices are `alloy`, `ash`, -// `ballad`, `coral`, `echo`, `sage`, `shimmer`, and `verse`. +// The voice the model uses to respond. Supported voices are `ash`, `ballad`, +// `coral`, `sage`, and `verse` (also supported but not recommended are `alloy`, +// `echo`, and `shimmer`; these voices are less expressive). type ChatCompletionAudioParamVoice string const ( diff --git a/file.go b/file.go index 2b6584c7..9fa551fe 100644 --- a/file.go +++ b/file.go @@ -55,7 +55,7 @@ func NewFileService(opts ...option.RequestOption) (r *FileService) { // [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input) // models. // -// The Batch API only supports `.jsonl` files up to 100 MB in size. The input also +// The Batch API only supports `.jsonl` files up to 200 MB in size. The input also // has a specific required // [format](https://platform.openai.com/docs/api-reference/batch/request-input). // From e7cd7c7295e2f412926cdebdafdeb056d7ffdc2c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:18:18 +0000 Subject: [PATCH 4/4] release: 0.1.0-alpha.38 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ README.md | 2 +- internal/version.go | 2 +- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 154a6970..0c41cec4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.37" + ".": "0.1.0-alpha.38" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f2be2b93..4886f2eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.1.0-alpha.38 (2024-11-20) + +Full Changelog: [v0.1.0-alpha.37...v0.1.0-alpha.38](https://github.com/openai/openai-go/compare/v0.1.0-alpha.37...v0.1.0-alpha.38) + +### Features + +* **api:** add gpt-4o-2024-11-20 model ([#131](https://github.com/openai/openai-go/issues/131)) ([8dabbd3](https://github.com/openai/openai-go/commit/8dabbd3d3f338986470049c1a3842e47a7194c1e)) + + +### Chores + +* **internal:** spec update ([#130](https://github.com/openai/openai-go/issues/130)) ([23476d8](https://github.com/openai/openai-go/commit/23476d8131b009e38f7f22024d925fd7fe76e4db)) +* **tests:** limit array example length ([#128](https://github.com/openai/openai-go/issues/128)) ([5560e6b](https://github.com/openai/openai-go/commit/5560e6ba5f77e774d6be40e71628c1b62f8b3005)) + ## 0.1.0-alpha.37 (2024-11-12) Full Changelog: [v0.1.0-alpha.36...v0.1.0-alpha.37](https://github.com/openai/openai-go/compare/v0.1.0-alpha.36...v0.1.0-alpha.37) diff --git a/README.md b/README.md index 4edcf3f7..63098b3f 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Or to pin the version: ```sh -go get -u 'github.com/openai/openai-go@v0.1.0-alpha.37' +go get -u 'github.com/openai/openai-go@v0.1.0-alpha.38' ``` diff --git a/internal/version.go b/internal/version.go index 8366a3cc..1b09d262 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "0.1.0-alpha.37" // x-release-please-version +const PackageVersion = "0.1.0-alpha.38" // x-release-please-version