Skip to content

Commit e0146d2

Browse files
committed
make linter happy
1 parent 26d6417 commit e0146d2

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"`
@@ -310,8 +311,10 @@ type ChatCompletionRequest struct {
310311
ReasoningEffort string `json:"reasoning_effort,omitempty"`
311312
// Metadata to store with the completion.
312313
Metadata map[string]string `json:"metadata,omitempty"`
313-
// 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"]
314-
// 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"]
314+
// Output types that you would like the model to generate for this request.
315+
// Most models are capable of generating text, which is the default: ["text"]
316+
// The gpt-4o-audio-preview model can also be used to generate audio.
317+
// To request that this model generate both text and audio responses, you can use: ["text", "audio"]
315318
Modalities []Modality `json:"modalities,omitempty"`
316319
// Parameters for audio output. Required when audio output is requested with modalities: ["audio"]
317320
Audio *AudioOutput `json:"audio,omitempty"`

chat_test.go

Lines changed: 97 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,23 @@ func TestChatCompletionRequestAudio(t *testing.T) {
922922
},
923923
},
924924
},
925-
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?"}]}`,
925+
want: `{
926+
"model": "gpt-4o-audio-preview",
927+
"modalities": [
928+
"text",
929+
"audio"
930+
],
931+
"audio": {
932+
"voice": "alloy",
933+
"format": "pcm16"
934+
},
935+
"messages": [
936+
{
937+
"role": "user",
938+
"content": "Is a golden retriever a good family dog?"
939+
}
940+
]
941+
}`,
926942
},
927943
}
928944

@@ -957,7 +973,7 @@ func TestChatCompletionResponseAudio(t *testing.T) {
957973
ID: "audio_6731c23369048190aee358c51e0373d2",
958974
Data: "base64 encoded data",
959975
ExpiresAt: 1731317827,
960-
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.",
976+
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
961977
},
962978
},
963979
FinishReason: openai.FinishReasonStop,
@@ -983,7 +999,7 @@ func TestChatCompletionResponseAudio(t *testing.T) {
983999
},
9841000
SystemFingerprint: "fp_49254d0e9b",
9851001
},
986-
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"}`,
1002+
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
9871003
},
9881004
}
9891005

@@ -1019,7 +1035,26 @@ func TestChatCompletionStreamResponseAudio(t *testing.T) {
10191035
},
10201036
},
10211037
},
1022-
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}]}`,
1038+
want: `{
1039+
"id": "chatcmpl-ASK8gd4isaVFw7qClLmtrcwWvka7p",
1040+
"object": "chat.completion.chunk",
1041+
"created": 1731313962,
1042+
"model": "gpt-4o-audio-preview-2024-10-01",
1043+
"system_fingerprint": "fp_49254d0e9b",
1044+
"choices": [
1045+
{
1046+
"index": 0,
1047+
"delta": {
1048+
"content": null,
1049+
"audio": {
1050+
"id": "audio_6731c12b1c148190bb8db8af1330221a",
1051+
"transcript": "Yes"
1052+
}
1053+
},
1054+
"finish_reason": null
1055+
}
1056+
]
1057+
}`,
10231058
},
10241059
{
10251060
response: openai.ChatCompletionStreamResponse{
@@ -1039,7 +1074,24 @@ func TestChatCompletionStreamResponseAudio(t *testing.T) {
10391074
},
10401075
},
10411076
},
1042-
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}]}`,
1077+
want: `{
1078+
"id": "chatcmpl-ASK8gd4isaVFw7qClLmtrcwWvka7p",
1079+
"object": "chat.completion.chunk",
1080+
"created": 1731313962,
1081+
"model": "gpt-4o-audio-preview-2024-10-01",
1082+
"system_fingerprint": "fp_49254d0e9b",
1083+
"choices": [
1084+
{
1085+
"index": 0,
1086+
"delta": {
1087+
"audio": {
1088+
"transcript": ","
1089+
}
1090+
},
1091+
"finish_reason": null
1092+
}
1093+
]
1094+
}`,
10431095
},
10441096
{
10451097
response: openai.ChatCompletionStreamResponse{
@@ -1061,7 +1113,28 @@ func TestChatCompletionStreamResponseAudio(t *testing.T) {
10611113
},
10621114
},
10631115
},
1064-
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}]}`,
1116+
want: `{
1117+
"id": "chatcmpl-ASK8gd4isaVFw7qClLmtrcwWvka7p",
1118+
"object": "chat.completion.chunk",
1119+
"created": 1731313962,
1120+
"model": "gpt-4o-audio-preview-2024-10-01",
1121+
"system_fingerprint": "fp_49254d0e9b",
1122+
"choices": [
1123+
{
1124+
"index": 0,
1125+
"delta": {
1126+
"role": "assistant",
1127+
"content": null,
1128+
"refusal": null,
1129+
"audio": {
1130+
"id": "audio_6731c12b1c148190bb8db8af1330221a",
1131+
"data": "base64 encoded data"
1132+
}
1133+
},
1134+
"finish_reason": null
1135+
}
1136+
]
1137+
}`,
10651138
},
10661139
{
10671140
response: openai.ChatCompletionStreamResponse{
@@ -1081,7 +1154,24 @@ func TestChatCompletionStreamResponseAudio(t *testing.T) {
10811154
},
10821155
},
10831156
},
1084-
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}]}`,
1157+
want: `{
1158+
"id": "chatcmpl-ASK8gd4isaVFw7qClLmtrcwWvka7p",
1159+
"object": "chat.completion.chunk",
1160+
"created": 1731313962,
1161+
"model": "gpt-4o-audio-preview-2024-10-01",
1162+
"system_fingerprint": "fp_49254d0e9b",
1163+
"choices": [
1164+
{
1165+
"index": 0,
1166+
"delta": {
1167+
"audio": {
1168+
"data": "base64 encoded data"
1169+
}
1170+
},
1171+
"finish_reason": null
1172+
}
1173+
]
1174+
}`,
10851175
},
10861176
}
10871177

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)