mirror of
https://github.com/openai/openai-go.git
synced 2026-04-01 09:07:22 +09:00
chore(internal): use different example values for some enums
This commit is contained in:
10
README.md
10
README.md
@@ -67,7 +67,7 @@ func main() {
|
||||
},
|
||||
},
|
||||
}},
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModelGPT4o,
|
||||
})
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
@@ -339,7 +339,7 @@ To handle errors, we recommend that you use the `errors.As` pattern:
|
||||
|
||||
```go
|
||||
_, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{
|
||||
Model: openai.FineTuningJobNewParamsModelBabbage002,
|
||||
Model: openai.FineTuningJobNewParamsModel("gpt-4o"),
|
||||
TrainingFile: "file-abc123",
|
||||
})
|
||||
if err != nil {
|
||||
@@ -376,7 +376,7 @@ client.Chat.Completions.New(
|
||||
},
|
||||
},
|
||||
}},
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModelGPT4o,
|
||||
},
|
||||
// This sets the per-retry timeout
|
||||
option.WithRequestTimeout(20*time.Second),
|
||||
@@ -442,7 +442,7 @@ client.Chat.Completions.New(
|
||||
},
|
||||
},
|
||||
}},
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModelGPT4o,
|
||||
},
|
||||
option.WithMaxRetries(5),
|
||||
)
|
||||
@@ -466,7 +466,7 @@ chatCompletion, err := client.Chat.Completions.New(
|
||||
},
|
||||
},
|
||||
}},
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModelGPT4o,
|
||||
},
|
||||
option.WithResponseInto(&response),
|
||||
)
|
||||
|
||||
@@ -28,8 +28,8 @@ func TestAudioSpeechNewWithOptionalParams(t *testing.T) {
|
||||
)
|
||||
resp, err := client.Audio.Speech.New(context.TODO(), openai.AudioSpeechNewParams{
|
||||
Input: "input",
|
||||
Model: openai.SpeechModelTTS1,
|
||||
Voice: openai.AudioSpeechNewParamsVoiceAlloy,
|
||||
Model: openai.SpeechModel("string"),
|
||||
Voice: openai.AudioSpeechNewParamsVoiceAsh,
|
||||
Instructions: openai.String("instructions"),
|
||||
ResponseFormat: openai.AudioSpeechNewParamsResponseFormatMP3,
|
||||
Speed: openai.Float(0.25),
|
||||
|
||||
@@ -30,7 +30,7 @@ func TestAudioTranscriptionNewWithOptionalParams(t *testing.T) {
|
||||
)
|
||||
_, err := client.Audio.Transcriptions.New(context.TODO(), openai.AudioTranscriptionNewParams{
|
||||
File: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
|
||||
Model: openai.AudioModelWhisper1,
|
||||
Model: openai.AudioModelGPT4oTranscribe,
|
||||
ChunkingStrategy: openai.AudioTranscriptionNewParamsChunkingStrategyUnion{
|
||||
OfAuto: constant.ValueOf[constant.Auto](),
|
||||
},
|
||||
|
||||
@@ -28,7 +28,7 @@ func TestBetaAssistantNewWithOptionalParams(t *testing.T) {
|
||||
option.WithAPIKey("My API Key"),
|
||||
)
|
||||
_, err := client.Beta.Assistants.New(context.TODO(), openai.BetaAssistantNewParams{
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModelGPT4o,
|
||||
Description: openai.String("description"),
|
||||
Instructions: openai.String("instructions"),
|
||||
Metadata: shared.Metadata{
|
||||
@@ -114,7 +114,7 @@ func TestBetaAssistantUpdateWithOptionalParams(t *testing.T) {
|
||||
Metadata: shared.Metadata{
|
||||
"foo": "string",
|
||||
},
|
||||
Model: openai.BetaAssistantUpdateParamsModelGPT5,
|
||||
Model: openai.BetaAssistantUpdateParamsModel("string"),
|
||||
Name: openai.String("name"),
|
||||
ReasoningEffort: shared.ReasoningEffortNone,
|
||||
ResponseFormat: openai.AssistantResponseFormatOptionUnionParam{
|
||||
|
||||
@@ -175,7 +175,7 @@ func TestBetaThreadNewAndRunWithOptionalParams(t *testing.T) {
|
||||
Metadata: shared.Metadata{
|
||||
"foo": "string",
|
||||
},
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModel("string"),
|
||||
ParallelToolCalls: openai.Bool(true),
|
||||
ResponseFormat: openai.AssistantResponseFormatOptionUnionParam{
|
||||
OfAuto: constant.ValueOf[constant.Auto](),
|
||||
|
||||
@@ -55,7 +55,7 @@ func TestBetaThreadRunNewWithOptionalParams(t *testing.T) {
|
||||
Metadata: shared.Metadata{
|
||||
"foo": "string",
|
||||
},
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModel("string"),
|
||||
ParallelToolCalls: openai.Bool(true),
|
||||
ReasoningEffort: shared.ReasoningEffortNone,
|
||||
ResponseFormat: openai.AssistantResponseFormatOptionUnionParam{
|
||||
|
||||
@@ -35,10 +35,10 @@ func TestChatCompletionNewWithOptionalParams(t *testing.T) {
|
||||
Name: openai.String("name"),
|
||||
},
|
||||
}},
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModelGPT4o,
|
||||
Audio: openai.ChatCompletionAudioParam{
|
||||
Format: openai.ChatCompletionAudioParamFormatWAV,
|
||||
Voice: openai.ChatCompletionAudioParamVoiceAlloy,
|
||||
Voice: openai.ChatCompletionAudioParamVoiceAsh,
|
||||
},
|
||||
FrequencyPenalty: openai.Float(-2),
|
||||
FunctionCall: openai.ChatCompletionNewParamsFunctionCallUnion{
|
||||
|
||||
@@ -48,7 +48,7 @@ func TestUserAgentHeader(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}},
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModelGPT4o,
|
||||
})
|
||||
if userAgent != fmt.Sprintf("OpenAI/Go %s", internal.PackageVersion) {
|
||||
t.Errorf("Expected User-Agent to be correct, but got: %#v", userAgent)
|
||||
@@ -81,7 +81,7 @@ func TestRetryAfter(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}},
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModelGPT4o,
|
||||
})
|
||||
if err == nil {
|
||||
t.Error("Expected there to be a cancel error")
|
||||
@@ -125,7 +125,7 @@ func TestDeleteRetryCountHeader(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}},
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModelGPT4o,
|
||||
})
|
||||
if err == nil {
|
||||
t.Error("Expected there to be a cancel error")
|
||||
@@ -164,7 +164,7 @@ func TestOverwriteRetryCountHeader(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}},
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModelGPT4o,
|
||||
})
|
||||
if err == nil {
|
||||
t.Error("Expected there to be a cancel error")
|
||||
@@ -202,7 +202,7 @@ func TestRetryAfterMs(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}},
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModelGPT4o,
|
||||
})
|
||||
if err == nil {
|
||||
t.Error("Expected there to be a cancel error")
|
||||
@@ -234,7 +234,7 @@ func TestContextCancel(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}},
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModelGPT4o,
|
||||
})
|
||||
if err == nil {
|
||||
t.Error("Expected there to be a cancel error")
|
||||
@@ -263,7 +263,7 @@ func TestContextCancelDelay(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}},
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModelGPT4o,
|
||||
})
|
||||
if err == nil {
|
||||
t.Error("expected there to be a cancel error")
|
||||
@@ -298,7 +298,7 @@ func TestContextDeadline(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}},
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModelGPT4o,
|
||||
})
|
||||
if err == nil {
|
||||
t.Error("expected there to be a deadline error")
|
||||
@@ -352,7 +352,7 @@ func TestContextDeadlineStreaming(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}},
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModelGPT4o,
|
||||
})
|
||||
for stream.Next() {
|
||||
_ = stream.Current()
|
||||
@@ -408,7 +408,7 @@ func TestContextDeadlineStreamingWithRequestTimeout(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}},
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModelGPT4o,
|
||||
},
|
||||
option.WithRequestTimeout((100 * time.Millisecond)),
|
||||
)
|
||||
|
||||
@@ -26,7 +26,7 @@ func TestCompletionNewWithOptionalParams(t *testing.T) {
|
||||
option.WithAPIKey("My API Key"),
|
||||
)
|
||||
_, err := client.Completions.New(context.TODO(), openai.CompletionNewParams{
|
||||
Model: openai.CompletionNewParamsModelGPT3_5TurboInstruct,
|
||||
Model: openai.CompletionNewParamsModel("string"),
|
||||
Prompt: openai.CompletionNewParamsPromptUnion{
|
||||
OfString: openai.String("This is a test."),
|
||||
},
|
||||
|
||||
@@ -29,7 +29,7 @@ func TestEmbeddingNewWithOptionalParams(t *testing.T) {
|
||||
Input: openai.EmbeddingNewParamsInputUnion{
|
||||
OfString: openai.String("The quick brown fox jumped over the lazy dog"),
|
||||
},
|
||||
Model: openai.EmbeddingModelTextEmbeddingAda002,
|
||||
Model: openai.EmbeddingModelTextEmbedding3Small,
|
||||
Dimensions: openai.Int(1),
|
||||
EncodingFormat: openai.EmbeddingNewParamsEncodingFormatFloat,
|
||||
User: openai.String("user-1234"),
|
||||
|
||||
@@ -28,7 +28,7 @@ func TestFineTuningJobNewWithOptionalParams(t *testing.T) {
|
||||
option.WithAPIKey("My API Key"),
|
||||
)
|
||||
_, err := client.FineTuning.Jobs.New(context.TODO(), openai.FineTuningJobNewParams{
|
||||
Model: openai.FineTuningJobNewParamsModelBabbage002,
|
||||
Model: openai.FineTuningJobNewParamsModelGPT4oMini,
|
||||
TrainingFile: "file-abc123",
|
||||
Hyperparameters: openai.FineTuningJobNewParamsHyperparameters{
|
||||
BatchSize: openai.FineTuningJobNewParamsHyperparametersBatchSizeUnion{
|
||||
|
||||
@@ -29,7 +29,7 @@ func TestImageNewVariationWithOptionalParams(t *testing.T) {
|
||||
)
|
||||
_, err := client.Images.NewVariation(context.TODO(), openai.ImageNewVariationParams{
|
||||
Image: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
|
||||
Model: openai.ImageModelGPTImage1_5,
|
||||
Model: openai.ImageModel("string"),
|
||||
N: openai.Int(1),
|
||||
ResponseFormat: openai.ImageNewVariationParamsResponseFormatURL,
|
||||
Size: openai.ImageNewVariationParamsSize1024x1024,
|
||||
@@ -64,7 +64,7 @@ func TestImageEditWithOptionalParams(t *testing.T) {
|
||||
Background: openai.ImageEditParamsBackgroundTransparent,
|
||||
InputFidelity: openai.ImageEditParamsInputFidelityHigh,
|
||||
Mask: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
|
||||
Model: openai.ImageModelGPTImage1_5,
|
||||
Model: openai.ImageModel("string"),
|
||||
N: openai.Int(1),
|
||||
OutputCompression: openai.Int(100),
|
||||
OutputFormat: openai.ImageEditParamsOutputFormatPNG,
|
||||
@@ -98,7 +98,7 @@ func TestImageGenerateWithOptionalParams(t *testing.T) {
|
||||
_, err := client.Images.Generate(context.TODO(), openai.ImageGenerateParams{
|
||||
Prompt: "A cute baby sea otter",
|
||||
Background: openai.ImageGenerateParamsBackgroundTransparent,
|
||||
Model: openai.ImageModelGPTImage1_5,
|
||||
Model: openai.ImageModel("string"),
|
||||
Moderation: openai.ImageGenerateParamsModerationLow,
|
||||
N: openai.Int(1),
|
||||
OutputCompression: openai.Int(100),
|
||||
|
||||
@@ -29,7 +29,7 @@ func TestModerationNewWithOptionalParams(t *testing.T) {
|
||||
Input: openai.ModerationNewParamsInputUnion{
|
||||
OfString: openai.String("I want to kill them."),
|
||||
},
|
||||
Model: openai.ModerationModelOmniModerationLatest,
|
||||
Model: openai.ModerationModel("string"),
|
||||
})
|
||||
if err != nil {
|
||||
var apierr *openai.Error
|
||||
|
||||
@@ -46,7 +46,7 @@ func TestCallAcceptWithOptionalParams(t *testing.T) {
|
||||
},
|
||||
Transcription: realtime.AudioTranscriptionParam{
|
||||
Language: openai.String("language"),
|
||||
Model: realtime.AudioTranscriptionModelWhisper1,
|
||||
Model: realtime.AudioTranscriptionModel("string"),
|
||||
Prompt: openai.String("prompt"),
|
||||
},
|
||||
TurnDetection: realtime.RealtimeAudioInputTurnDetectionUnionParam{
|
||||
@@ -68,7 +68,7 @@ func TestCallAcceptWithOptionalParams(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Speed: openai.Float(0.25),
|
||||
Voice: realtime.RealtimeAudioConfigOutputVoiceAlloy,
|
||||
Voice: realtime.RealtimeAudioConfigOutputVoiceAsh,
|
||||
},
|
||||
},
|
||||
Include: []string{"item.input_audio_transcription.logprobs"},
|
||||
@@ -76,7 +76,7 @@ func TestCallAcceptWithOptionalParams(t *testing.T) {
|
||||
MaxOutputTokens: realtime.RealtimeSessionCreateRequestMaxOutputTokensUnionParam{
|
||||
OfInt: openai.Int(0),
|
||||
},
|
||||
Model: realtime.RealtimeSessionCreateRequestModelGPTRealtime,
|
||||
Model: realtime.RealtimeSessionCreateRequestModel("string"),
|
||||
OutputModalities: []string{"text"},
|
||||
Prompt: responses.ResponsePromptParam{
|
||||
ID: "id",
|
||||
|
||||
@@ -48,7 +48,7 @@ func TestClientSecretNewWithOptionalParams(t *testing.T) {
|
||||
},
|
||||
Transcription: realtime.AudioTranscriptionParam{
|
||||
Language: openai.String("language"),
|
||||
Model: realtime.AudioTranscriptionModelWhisper1,
|
||||
Model: realtime.AudioTranscriptionModel("string"),
|
||||
Prompt: openai.String("prompt"),
|
||||
},
|
||||
TurnDetection: realtime.RealtimeAudioInputTurnDetectionUnionParam{
|
||||
@@ -70,7 +70,7 @@ func TestClientSecretNewWithOptionalParams(t *testing.T) {
|
||||
},
|
||||
},
|
||||
Speed: openai.Float(0.25),
|
||||
Voice: realtime.RealtimeAudioConfigOutputVoiceAlloy,
|
||||
Voice: realtime.RealtimeAudioConfigOutputVoiceAsh,
|
||||
},
|
||||
},
|
||||
Include: []string{"item.input_audio_transcription.logprobs"},
|
||||
@@ -78,7 +78,7 @@ func TestClientSecretNewWithOptionalParams(t *testing.T) {
|
||||
MaxOutputTokens: realtime.RealtimeSessionCreateRequestMaxOutputTokensUnionParam{
|
||||
OfInt: openai.Int(0),
|
||||
},
|
||||
Model: realtime.RealtimeSessionCreateRequestModelGPTRealtime,
|
||||
Model: realtime.RealtimeSessionCreateRequestModel("string"),
|
||||
OutputModalities: []string{"text"},
|
||||
Prompt: responses.ResponsePromptParam{
|
||||
ID: "id",
|
||||
|
||||
@@ -33,7 +33,7 @@ func TestUsage(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}},
|
||||
Model: shared.ChatModelGPT5_2,
|
||||
Model: shared.ChatModelGPT4o,
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatalf("err should be nil: %s", err.Error())
|
||||
|
||||
@@ -32,7 +32,7 @@ func TestVideoNewWithOptionalParams(t *testing.T) {
|
||||
_, err := client.Videos.New(context.TODO(), openai.VideoNewParams{
|
||||
Prompt: "x",
|
||||
InputReference: io.Reader(bytes.NewBuffer([]byte("some file contents"))),
|
||||
Model: openai.VideoModelSora2,
|
||||
Model: openai.VideoModel("string"),
|
||||
Seconds: openai.VideoSeconds4,
|
||||
Size: openai.VideoSize720x1280,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user