Skip to content

Commit 3e53589

Browse files
committed
make linter happy
1 parent 8be2fdd commit 3e53589

File tree

3 files changed

+106
-13
lines changed

3 files changed

+106
-13
lines changed

chat.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,8 @@ func (m *ChatCompletionMessage) UnmarshalJSON(bs []byte) error {
216216
type ChatCompletionAudio struct {
217217
// Unique identifier for this audio response.
218218
ID string `json:"id"`
219-
// The Unix timestamp (in seconds) for when this audio response will no longer be accessible on the server for use in multi-turn conversations.
219+
// The Unix timestamp (in seconds) for when this audio response will no longer
220+
// be accessible on the server for use in multi-turn conversations.
220221
ExpiresAt int64 `json:"expires_at"`
221222
// Base64 encoded audio bytes generated by the model, in the format specified in the request.
222223
Data string `json:"data"`
@@ -308,8 +309,10 @@ type ChatCompletionRequest struct {
308309
Store bool `json:"store,omitempty"`
309310
// Metadata to store with the completion.
310311
Metadata map[string]string `json:"metadata,omitempty"`
311-
// Output types that you would like the model to generate for this request. Most models are capable of generating text, which is the default: ["text"]
312-
// The gpt-4o-audio-preview model can also be used to generate audio. To request that this model generate both text and audio responses, you can use: ["text", "audio"]
312+
// Output types that you would like the model to generate for this request.
313+
// Most models are capable of generating text, which is the default: ["text"]
314+
// The gpt-4o-audio-preview model can also be used to generate audio.
315+
// To request that this model generate both text and audio responses, you can use: ["text", "audio"]
313316
Modalities []Modality `json:"modalities,omitempty"`
314317
// Parameters for audio output. Required when audio output is requested with modalities: ["audio"]
315318
Audio *AudioOutput `json:"audio,omitempty"`

chat_test.go

Lines changed: 97 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -785,7 +785,23 @@ func TestChatCompletionRequestAudio(t *testing.T) {
785785
},
786786
},
787787
},
788-
want: `{"model":"gpt-4o-audio-preview","modalities":["text","audio"],"audio":{"voice":"alloy","format":"pcm16"},"messages":[{"role":"user","content":"Is a golden retriever a good family dog?"}]}`,
788+
want: `{
789+
"model": "gpt-4o-audio-preview",
790+
"modalities": [
791+
"text",
792+
"audio"
793+
],
794+
"audio": {
795+
"voice": "alloy",
796+
"format": "pcm16"
797+
},
798+
"messages": [
799+
{
800+
"role": "user",
801+
"content": "Is a golden retriever a good family dog?"
802+
}
803+
]
804+
}`,
789805
},
790806
}
791807

@@ -820,7 +836,7 @@ func TestChatCompletionResponseAudio(t *testing.T) {
820836
ID: "audio_6731c23369048190aee358c51e0373d2",
821837
Data: "base64 encoded data",
822838
ExpiresAt: 1731317827,
823-
Transcript: "Yes, golden retrievers are known to be excellent family dogs. They are friendly, gentle, and great with children. Golden retrievers are also intelligent and eager to please, making them easy to train. They tend to get along well with other pets and are known for their loyalty and protective nature.",
839+
Transcript: "Yes, golden retrievers are known to be excellent family dogs. They are friendly, gentle, and great with children. Golden retrievers are also intelligent and eager to please, making them easy to train. They tend to get along well with other pets and are known for their loyalty and protective nature.", //nolint:lll
824840
},
825841
},
826842
FinishReason: openai.FinishReasonStop,
@@ -846,7 +862,7 @@ func TestChatCompletionResponseAudio(t *testing.T) {
846862
},
847863
SystemFingerprint: "fp_49254d0e9b",
848864
},
849-
want: `{"id":"chatcmpl-ASKCthZk3MUOqqRh64CbUbeTmZ6xl","object":"chat.completion","created":1731314223,"model":"gpt-4o-audio-preview-2024-10-01","choices":[{"index":0,"message":{"role":"assistant","content":null,"refusal":null,"audio":{"id":"audio_6731c23369048190aee358c51e0373d2","data":"base64 encoded data","expires_at":1731317827,"transcript":"Yes, golden retrievers are known to be excellent family dogs. They are friendly, gentle, and great with children. Golden retrievers are also intelligent and eager to please, making them easy to train. They tend to get along well with other pets and are known for their loyalty and protective nature."}},"finish_reason":"stop"}],"usage":{"prompt_tokens":17,"completion_tokens":483,"total_tokens":500,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0,"text_tokens":17,"image_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":398,"text_tokens":85,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"system_fingerprint":"fp_49254d0e9b"}`,
865+
want: `{"id":"chatcmpl-ASKCthZk3MUOqqRh64CbUbeTmZ6xl","object":"chat.completion","created":1731314223,"model":"gpt-4o-audio-preview-2024-10-01","choices":[{"index":0,"message":{"role":"assistant","content":null,"refusal":null,"audio":{"id":"audio_6731c23369048190aee358c51e0373d2","data":"base64 encoded data","expires_at":1731317827,"transcript":"Yes, golden retrievers are known to be excellent family dogs. They are friendly, gentle, and great with children. Golden retrievers are also intelligent and eager to please, making them easy to train. They tend to get along well with other pets and are known for their loyalty and protective nature."}},"finish_reason":"stop"}],"usage":{"prompt_tokens":17,"completion_tokens":483,"total_tokens":500,"prompt_tokens_details":{"cached_tokens":0,"audio_tokens":0,"text_tokens":17,"image_tokens":0},"completion_tokens_details":{"reasoning_tokens":0,"audio_tokens":398,"text_tokens":85,"accepted_prediction_tokens":0,"rejected_prediction_tokens":0}},"system_fingerprint":"fp_49254d0e9b"}`, //nolint:lll
850866
},
851867
}
852868

@@ -882,7 +898,26 @@ func TestChatCompletionStreamResponseAudio(t *testing.T) {
882898
},
883899
},
884900
},
885-
want: `{"id":"chatcmpl-ASK8gd4isaVFw7qClLmtrcwWvka7p","object":"chat.completion.chunk","created":1731313962,"model":"gpt-4o-audio-preview-2024-10-01","system_fingerprint":"fp_49254d0e9b","choices":[{"index":0,"delta":{"content":null,"audio":{"id":"audio_6731c12b1c148190bb8db8af1330221a","transcript":"Yes"}},"finish_reason":null}]}`,
901+
want: `{
902+
"id": "chatcmpl-ASK8gd4isaVFw7qClLmtrcwWvka7p",
903+
"object": "chat.completion.chunk",
904+
"created": 1731313962,
905+
"model": "gpt-4o-audio-preview-2024-10-01",
906+
"system_fingerprint": "fp_49254d0e9b",
907+
"choices": [
908+
{
909+
"index": 0,
910+
"delta": {
911+
"content": null,
912+
"audio": {
913+
"id": "audio_6731c12b1c148190bb8db8af1330221a",
914+
"transcript": "Yes"
915+
}
916+
},
917+
"finish_reason": null
918+
}
919+
]
920+
}`,
886921
},
887922
{
888923
response: openai.ChatCompletionStreamResponse{
@@ -902,7 +937,24 @@ func TestChatCompletionStreamResponseAudio(t *testing.T) {
902937
},
903938
},
904939
},
905-
want: `{"id":"chatcmpl-ASK8gd4isaVFw7qClLmtrcwWvka7p","object":"chat.completion.chunk","created":1731313962,"model":"gpt-4o-audio-preview-2024-10-01","system_fingerprint":"fp_49254d0e9b","choices":[{"index":0,"delta":{"audio":{"transcript":","}},"finish_reason":null}]}`,
940+
want: `{
941+
"id": "chatcmpl-ASK8gd4isaVFw7qClLmtrcwWvka7p",
942+
"object": "chat.completion.chunk",
943+
"created": 1731313962,
944+
"model": "gpt-4o-audio-preview-2024-10-01",
945+
"system_fingerprint": "fp_49254d0e9b",
946+
"choices": [
947+
{
948+
"index": 0,
949+
"delta": {
950+
"audio": {
951+
"transcript": ","
952+
}
953+
},
954+
"finish_reason": null
955+
}
956+
]
957+
}`,
906958
},
907959
{
908960
response: openai.ChatCompletionStreamResponse{
@@ -924,7 +976,28 @@ func TestChatCompletionStreamResponseAudio(t *testing.T) {
924976
},
925977
},
926978
},
927-
want: `{"id":"chatcmpl-ASK8gd4isaVFw7qClLmtrcwWvka7p","object":"chat.completion.chunk","created":1731313962,"model":"gpt-4o-audio-preview-2024-10-01","system_fingerprint":"fp_49254d0e9b","choices":[{"index":0,"delta":{"role":"assistant","content":null,"refusal":null,"audio":{"id":"audio_6731c12b1c148190bb8db8af1330221a","data":"base64 encoded data"}},"finish_reason":null}]}`,
979+
want: `{
980+
"id": "chatcmpl-ASK8gd4isaVFw7qClLmtrcwWvka7p",
981+
"object": "chat.completion.chunk",
982+
"created": 1731313962,
983+
"model": "gpt-4o-audio-preview-2024-10-01",
984+
"system_fingerprint": "fp_49254d0e9b",
985+
"choices": [
986+
{
987+
"index": 0,
988+
"delta": {
989+
"role": "assistant",
990+
"content": null,
991+
"refusal": null,
992+
"audio": {
993+
"id": "audio_6731c12b1c148190bb8db8af1330221a",
994+
"data": "base64 encoded data"
995+
}
996+
},
997+
"finish_reason": null
998+
}
999+
]
1000+
}`,
9281001
},
9291002
{
9301003
response: openai.ChatCompletionStreamResponse{
@@ -944,7 +1017,24 @@ func TestChatCompletionStreamResponseAudio(t *testing.T) {
9441017
},
9451018
},
9461019
},
947-
want: `{"id":"chatcmpl-ASK8gd4isaVFw7qClLmtrcwWvka7p","object":"chat.completion.chunk","created":1731313962,"model":"gpt-4o-audio-preview-2024-10-01","system_fingerprint":"fp_49254d0e9b","choices":[{"index":0,"delta":{"audio":{"data":"base64 encoded data"}},"finish_reason":null}]}`,
1020+
want: `{
1021+
"id": "chatcmpl-ASK8gd4isaVFw7qClLmtrcwWvka7p",
1022+
"object": "chat.completion.chunk",
1023+
"created": 1731313962,
1024+
"model": "gpt-4o-audio-preview-2024-10-01",
1025+
"system_fingerprint": "fp_49254d0e9b",
1026+
"choices": [
1027+
{
1028+
"index": 0,
1029+
"delta": {
1030+
"audio": {
1031+
"data": "base64 encoded data"
1032+
}
1033+
},
1034+
"finish_reason": null
1035+
}
1036+
]
1037+
}`,
9481038
},
9491039
}
9501040

internal/test/checks/checks.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ type tHelper interface {
7373
// Pointer variable equality is determined based on the equality of the
7474
// referenced values (as opposed to the memory addresses). Function equality
7575
// cannot be determined and will always fail.
76-
func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool {
76+
func Equal(t TestingT, expected, actual interface{}) bool {
7777
if h, ok := t.(tHelper); ok {
7878
h.Helper()
7979
}
@@ -93,7 +93,7 @@ func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{})
9393
// JSONEq asserts that two JSON strings are equivalent.
9494
//
9595
// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)
96-
func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool {
96+
func JSONEq(t TestingT, expected string, actual string) bool {
9797
if h, ok := t.(tHelper); ok {
9898
h.Helper()
9999
}
@@ -107,7 +107,7 @@ func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{
107107
t.Fatalf("Input ('%s') needs to be valid json.\nJSON parsing error: '%s'", actual, err.Error())
108108
}
109109

110-
return Equal(t, expectedJSONAsInterface, actualJSONAsInterface, msgAndArgs...)
110+
return Equal(t, expectedJSONAsInterface, actualJSONAsInterface)
111111
}
112112

113113
// validateEqualArgs checks whether provided arguments can be safely used in the

0 commit comments

Comments
 (0)