diff --git a/.release-please-manifest.json b/.release-please-manifest.json index c412e97..52b3e83 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.1.0-alpha.29" + ".": "0.1.0-alpha.30" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 984e8a8..e1a430e 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-8729aaa35436531ab453224af10e67f89677db8f350f0346bb3537489edea649.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai-f9320ebf347140052c7f8b0bc5c7db24f5e367c368c8cb34c3606af4e2b6591b.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index c1ae048..8a9c6c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## 0.1.0-alpha.30 (2024-10-22) + +Full Changelog: [v0.1.0-alpha.29...v0.1.0-alpha.30](https://github.com/openai/openai-go/compare/v0.1.0-alpha.29...v0.1.0-alpha.30) + +### ⚠ BREAKING CHANGES + +* **client:** improve naming of some variants ([#89](https://github.com/openai/openai-go/issues/89)) + +### Features + +* **client:** improve naming of some variants ([#89](https://github.com/openai/openai-go/issues/89)) ([12ac070](https://github.com/openai/openai-go/commit/12ac070611061e98ae2aaaeefa8eb661ff7f995f)) + ## 0.1.0-alpha.29 (2024-10-17) Full Changelog: [v0.1.0-alpha.28...v0.1.0-alpha.29](https://github.com/openai/openai-go/compare/v0.1.0-alpha.28...v0.1.0-alpha.29) diff --git a/README.md b/README.md index f70cda6..325f3d5 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.29' +go get -u 'github.com/openai/openai-go@v0.1.0-alpha.30' ``` diff --git a/chatcompletion.go b/chatcompletion.go index a5b61de..177831a 100644 --- a/chatcompletion.go +++ b/chatcompletion.go @@ -1558,7 +1558,7 @@ func (r ChatCompletionToolType) IsKnown() bool { // `none` is the default when no tools are present. `auto` is the default if tools // are present. // -// Satisfied by [ChatCompletionToolChoiceOptionString], +// Satisfied by [ChatCompletionToolChoiceOptionBehavior], // [ChatCompletionNamedToolChoiceParam]. type ChatCompletionToolChoiceOptionUnionParam interface { implementsChatCompletionToolChoiceOptionUnionParam() @@ -1567,23 +1567,24 @@ type ChatCompletionToolChoiceOptionUnionParam interface { // `none` means the model will not call any tool and instead generates a message. // `auto` means the model can pick between generating a message or calling one or // more tools. `required` means the model must call one or more tools. -type ChatCompletionToolChoiceOptionString string +type ChatCompletionToolChoiceOptionBehavior string const ( - ChatCompletionToolChoiceOptionStringNone ChatCompletionToolChoiceOptionString = "none" - ChatCompletionToolChoiceOptionStringAuto ChatCompletionToolChoiceOptionString = "auto" - ChatCompletionToolChoiceOptionStringRequired ChatCompletionToolChoiceOptionString = "required" + ChatCompletionToolChoiceOptionBehaviorNone ChatCompletionToolChoiceOptionBehavior = "none" + ChatCompletionToolChoiceOptionBehaviorAuto ChatCompletionToolChoiceOptionBehavior = "auto" + ChatCompletionToolChoiceOptionBehaviorRequired ChatCompletionToolChoiceOptionBehavior = "required" ) -func (r ChatCompletionToolChoiceOptionString) IsKnown() bool { +func (r ChatCompletionToolChoiceOptionBehavior) IsKnown() bool { switch r { - case ChatCompletionToolChoiceOptionStringNone, ChatCompletionToolChoiceOptionStringAuto, ChatCompletionToolChoiceOptionStringRequired: + case ChatCompletionToolChoiceOptionBehaviorNone, ChatCompletionToolChoiceOptionBehaviorAuto, ChatCompletionToolChoiceOptionBehaviorRequired: return true } return false } -func (r ChatCompletionToolChoiceOptionString) implementsChatCompletionToolChoiceOptionUnionParam() {} +func (r ChatCompletionToolChoiceOptionBehavior) implementsChatCompletionToolChoiceOptionUnionParam() { +} type ChatCompletionToolMessageParam struct { // The contents of the tool message. @@ -1838,7 +1839,7 @@ func (r ChatCompletionNewParams) MarshalJSON() (data []byte, err error) { // `none` is the default when no functions are present. `auto` is the default if // functions are present. // -// Satisfied by [ChatCompletionNewParamsFunctionCallString], +// Satisfied by [ChatCompletionNewParamsFunctionCallBehavior], // [ChatCompletionFunctionCallOptionParam]. type ChatCompletionNewParamsFunctionCallUnion interface { implementsChatCompletionNewParamsFunctionCallUnion() @@ -1847,22 +1848,22 @@ type ChatCompletionNewParamsFunctionCallUnion interface { // `none` means the model will not call a function and instead generates a message. // `auto` means the model can pick between generating a message or calling a // function. -type ChatCompletionNewParamsFunctionCallString string +type ChatCompletionNewParamsFunctionCallBehavior string const ( - ChatCompletionNewParamsFunctionCallStringNone ChatCompletionNewParamsFunctionCallString = "none" - ChatCompletionNewParamsFunctionCallStringAuto ChatCompletionNewParamsFunctionCallString = "auto" + ChatCompletionNewParamsFunctionCallBehaviorNone ChatCompletionNewParamsFunctionCallBehavior = "none" + ChatCompletionNewParamsFunctionCallBehaviorAuto ChatCompletionNewParamsFunctionCallBehavior = "auto" ) -func (r ChatCompletionNewParamsFunctionCallString) IsKnown() bool { +func (r ChatCompletionNewParamsFunctionCallBehavior) IsKnown() bool { switch r { - case ChatCompletionNewParamsFunctionCallStringNone, ChatCompletionNewParamsFunctionCallStringAuto: + case ChatCompletionNewParamsFunctionCallBehaviorNone, ChatCompletionNewParamsFunctionCallBehaviorAuto: return true } return false } -func (r ChatCompletionNewParamsFunctionCallString) implementsChatCompletionNewParamsFunctionCallUnion() { +func (r ChatCompletionNewParamsFunctionCallBehavior) implementsChatCompletionNewParamsFunctionCallUnion() { } type ChatCompletionNewParamsFunction struct { diff --git a/chatcompletion_test.go b/chatcompletion_test.go index 2ea479c..8ced44c 100644 --- a/chatcompletion_test.go +++ b/chatcompletion_test.go @@ -38,7 +38,7 @@ func TestChatCompletionNewWithOptionalParams(t *testing.T) { Voice: openai.F(openai.ChatCompletionAudioParamVoiceAlloy), }), FrequencyPenalty: openai.F(-2.000000), - FunctionCall: openai.F[openai.ChatCompletionNewParamsFunctionCallUnion](openai.ChatCompletionNewParamsFunctionCallString(openai.ChatCompletionNewParamsFunctionCallStringNone)), + FunctionCall: openai.F[openai.ChatCompletionNewParamsFunctionCallUnion](openai.ChatCompletionNewParamsFunctionCallBehavior(openai.ChatCompletionNewParamsFunctionCallBehaviorNone)), Functions: openai.F([]openai.ChatCompletionNewParamsFunction{{ Name: openai.F("name"), Description: openai.F("description"), @@ -70,7 +70,7 @@ func TestChatCompletionNewWithOptionalParams(t *testing.T) { IncludeUsage: openai.F(true), }), Temperature: openai.F(1.000000), - ToolChoice: openai.F[openai.ChatCompletionToolChoiceOptionUnionParam](openai.ChatCompletionToolChoiceOptionString(openai.ChatCompletionToolChoiceOptionStringNone)), + ToolChoice: openai.F[openai.ChatCompletionToolChoiceOptionUnionParam](openai.ChatCompletionToolChoiceOptionBehavior(openai.ChatCompletionToolChoiceOptionBehaviorNone)), Tools: openai.F([]openai.ChatCompletionToolParam{{ Function: openai.F(shared.FunctionDefinitionParam{ Name: openai.F("name"), diff --git a/finetuningjob.go b/finetuningjob.go index 0106e20..04f74fe 100644 --- a/finetuningjob.go +++ b/finetuningjob.go @@ -279,7 +279,7 @@ func (r fineTuningJobHyperparametersJSON) RawJSON() string { // on the size of the dataset. If setting the number manually, we support any // number between 1 and 50 epochs. // -// Union satisfied by [FineTuningJobHyperparametersNEpochsString] or +// Union satisfied by [FineTuningJobHyperparametersNEpochsBehavior] or // [shared.UnionInt]. type FineTuningJobHyperparametersNEpochsUnion interface { ImplementsFineTuningJobHyperparametersNEpochsUnion() @@ -291,7 +291,7 @@ func init() { "", apijson.UnionVariant{ TypeFilter: gjson.String, - Type: reflect.TypeOf(FineTuningJobHyperparametersNEpochsString("")), + Type: reflect.TypeOf(FineTuningJobHyperparametersNEpochsBehavior("")), }, apijson.UnionVariant{ TypeFilter: gjson.Number, @@ -300,21 +300,21 @@ func init() { ) } -type FineTuningJobHyperparametersNEpochsString string +type FineTuningJobHyperparametersNEpochsBehavior string const ( - FineTuningJobHyperparametersNEpochsStringAuto FineTuningJobHyperparametersNEpochsString = "auto" + FineTuningJobHyperparametersNEpochsBehaviorAuto FineTuningJobHyperparametersNEpochsBehavior = "auto" ) -func (r FineTuningJobHyperparametersNEpochsString) IsKnown() bool { +func (r FineTuningJobHyperparametersNEpochsBehavior) IsKnown() bool { switch r { - case FineTuningJobHyperparametersNEpochsStringAuto: + case FineTuningJobHyperparametersNEpochsBehaviorAuto: return true } return false } -func (r FineTuningJobHyperparametersNEpochsString) ImplementsFineTuningJobHyperparametersNEpochsUnion() { +func (r FineTuningJobHyperparametersNEpochsBehavior) ImplementsFineTuningJobHyperparametersNEpochsUnion() { } // The object type, which is always "fine_tuning.job". @@ -586,80 +586,80 @@ func (r FineTuningJobNewParamsHyperparameters) MarshalJSON() (data []byte, err e // Number of examples in each batch. A larger batch size means that model // parameters are updated less frequently, but with lower variance. // -// Satisfied by [FineTuningJobNewParamsHyperparametersBatchSizeString], +// Satisfied by [FineTuningJobNewParamsHyperparametersBatchSizeBehavior], // [shared.UnionInt]. type FineTuningJobNewParamsHyperparametersBatchSizeUnion interface { ImplementsFineTuningJobNewParamsHyperparametersBatchSizeUnion() } -type FineTuningJobNewParamsHyperparametersBatchSizeString string +type FineTuningJobNewParamsHyperparametersBatchSizeBehavior string const ( - FineTuningJobNewParamsHyperparametersBatchSizeStringAuto FineTuningJobNewParamsHyperparametersBatchSizeString = "auto" + FineTuningJobNewParamsHyperparametersBatchSizeBehaviorAuto FineTuningJobNewParamsHyperparametersBatchSizeBehavior = "auto" ) -func (r FineTuningJobNewParamsHyperparametersBatchSizeString) IsKnown() bool { +func (r FineTuningJobNewParamsHyperparametersBatchSizeBehavior) IsKnown() bool { switch r { - case FineTuningJobNewParamsHyperparametersBatchSizeStringAuto: + case FineTuningJobNewParamsHyperparametersBatchSizeBehaviorAuto: return true } return false } -func (r FineTuningJobNewParamsHyperparametersBatchSizeString) ImplementsFineTuningJobNewParamsHyperparametersBatchSizeUnion() { +func (r FineTuningJobNewParamsHyperparametersBatchSizeBehavior) ImplementsFineTuningJobNewParamsHyperparametersBatchSizeUnion() { } // Scaling factor for the learning rate. A smaller learning rate may be useful to // avoid overfitting. // // Satisfied by -// [FineTuningJobNewParamsHyperparametersLearningRateMultiplierString], +// [FineTuningJobNewParamsHyperparametersLearningRateMultiplierBehavior], // [shared.UnionFloat]. type FineTuningJobNewParamsHyperparametersLearningRateMultiplierUnion interface { ImplementsFineTuningJobNewParamsHyperparametersLearningRateMultiplierUnion() } -type FineTuningJobNewParamsHyperparametersLearningRateMultiplierString string +type FineTuningJobNewParamsHyperparametersLearningRateMultiplierBehavior string const ( - FineTuningJobNewParamsHyperparametersLearningRateMultiplierStringAuto FineTuningJobNewParamsHyperparametersLearningRateMultiplierString = "auto" + FineTuningJobNewParamsHyperparametersLearningRateMultiplierBehaviorAuto FineTuningJobNewParamsHyperparametersLearningRateMultiplierBehavior = "auto" ) -func (r FineTuningJobNewParamsHyperparametersLearningRateMultiplierString) IsKnown() bool { +func (r FineTuningJobNewParamsHyperparametersLearningRateMultiplierBehavior) IsKnown() bool { switch r { - case FineTuningJobNewParamsHyperparametersLearningRateMultiplierStringAuto: + case FineTuningJobNewParamsHyperparametersLearningRateMultiplierBehaviorAuto: return true } return false } -func (r FineTuningJobNewParamsHyperparametersLearningRateMultiplierString) ImplementsFineTuningJobNewParamsHyperparametersLearningRateMultiplierUnion() { +func (r FineTuningJobNewParamsHyperparametersLearningRateMultiplierBehavior) ImplementsFineTuningJobNewParamsHyperparametersLearningRateMultiplierUnion() { } // The number of epochs to train the model for. An epoch refers to one full cycle // through the training dataset. // -// Satisfied by [FineTuningJobNewParamsHyperparametersNEpochsString], +// Satisfied by [FineTuningJobNewParamsHyperparametersNEpochsBehavior], // [shared.UnionInt]. type FineTuningJobNewParamsHyperparametersNEpochsUnion interface { ImplementsFineTuningJobNewParamsHyperparametersNEpochsUnion() } -type FineTuningJobNewParamsHyperparametersNEpochsString string +type FineTuningJobNewParamsHyperparametersNEpochsBehavior string const ( - FineTuningJobNewParamsHyperparametersNEpochsStringAuto FineTuningJobNewParamsHyperparametersNEpochsString = "auto" + FineTuningJobNewParamsHyperparametersNEpochsBehaviorAuto FineTuningJobNewParamsHyperparametersNEpochsBehavior = "auto" ) -func (r FineTuningJobNewParamsHyperparametersNEpochsString) IsKnown() bool { +func (r FineTuningJobNewParamsHyperparametersNEpochsBehavior) IsKnown() bool { switch r { - case FineTuningJobNewParamsHyperparametersNEpochsStringAuto: + case FineTuningJobNewParamsHyperparametersNEpochsBehaviorAuto: return true } return false } -func (r FineTuningJobNewParamsHyperparametersNEpochsString) ImplementsFineTuningJobNewParamsHyperparametersNEpochsUnion() { +func (r FineTuningJobNewParamsHyperparametersNEpochsBehavior) ImplementsFineTuningJobNewParamsHyperparametersNEpochsUnion() { } type FineTuningJobNewParamsIntegration struct { diff --git a/finetuningjob_test.go b/finetuningjob_test.go index 165b6fe..b8b381a 100644 --- a/finetuningjob_test.go +++ b/finetuningjob_test.go @@ -29,9 +29,9 @@ func TestFineTuningJobNewWithOptionalParams(t *testing.T) { Model: openai.F(openai.FineTuningJobNewParamsModelBabbage002), TrainingFile: openai.F("file-abc123"), Hyperparameters: openai.F(openai.FineTuningJobNewParamsHyperparameters{ - BatchSize: openai.F[openai.FineTuningJobNewParamsHyperparametersBatchSizeUnion](openai.FineTuningJobNewParamsHyperparametersBatchSizeString(openai.FineTuningJobNewParamsHyperparametersBatchSizeStringAuto)), - LearningRateMultiplier: openai.F[openai.FineTuningJobNewParamsHyperparametersLearningRateMultiplierUnion](openai.FineTuningJobNewParamsHyperparametersLearningRateMultiplierString(openai.FineTuningJobNewParamsHyperparametersLearningRateMultiplierStringAuto)), - NEpochs: openai.F[openai.FineTuningJobNewParamsHyperparametersNEpochsUnion](openai.FineTuningJobNewParamsHyperparametersNEpochsString(openai.FineTuningJobNewParamsHyperparametersNEpochsStringAuto)), + BatchSize: openai.F[openai.FineTuningJobNewParamsHyperparametersBatchSizeUnion](openai.FineTuningJobNewParamsHyperparametersBatchSizeBehavior(openai.FineTuningJobNewParamsHyperparametersBatchSizeBehaviorAuto)), + LearningRateMultiplier: openai.F[openai.FineTuningJobNewParamsHyperparametersLearningRateMultiplierUnion](openai.FineTuningJobNewParamsHyperparametersLearningRateMultiplierBehavior(openai.FineTuningJobNewParamsHyperparametersLearningRateMultiplierBehaviorAuto)), + NEpochs: openai.F[openai.FineTuningJobNewParamsHyperparametersNEpochsUnion](openai.FineTuningJobNewParamsHyperparametersNEpochsBehavior(openai.FineTuningJobNewParamsHyperparametersNEpochsBehaviorAuto)), }), Integrations: openai.F([]openai.FineTuningJobNewParamsIntegration{{ Type: openai.F(openai.FineTuningJobNewParamsIntegrationsTypeWandb), diff --git a/internal/version.go b/internal/version.go index 9563c03..fe6f633 100644 --- a/internal/version.go +++ b/internal/version.go @@ -2,4 +2,4 @@ package internal -const PackageVersion = "0.1.0-alpha.29" // x-release-please-version +const PackageVersion = "0.1.0-alpha.30" // x-release-please-version