(t *testing.T)
| 6 | ) |
| 7 | |
| 8 | func TestSendChat(t *testing.T) { |
| 9 | type args struct { |
| 10 | request ChatCompletionRequest |
| 11 | } |
| 12 | var tests = []struct { |
| 13 | name string |
| 14 | args args |
| 15 | wantChatCompletionResponse ChatCompletionResponse |
| 16 | wantErr bool |
| 17 | }{ |
| 18 | { |
| 19 | name: "1", |
| 20 | args: args{ChatCompletionRequest{ |
| 21 | MaxTokens: 5, |
| 22 | Model: Gpt3Dot5Turbo, |
| 23 | Messages: []ChatCompletionMessage{ |
| 24 | { |
| 25 | Role: ChatMessageRoleUser, |
| 26 | Content: "Hello!", |
| 27 | }, |
| 28 | }, |
| 29 | }}, |
| 30 | wantChatCompletionResponse: ChatCompletionResponse{}, |
| 31 | wantErr: false, |
| 32 | }, |
| 33 | } |
| 34 | for _, tt := range tests { |
| 35 | t.Run(tt.name, func(t *testing.T) { |
| 36 | gotChatCompletionResponse, err := SendChat(tt.args.request) |
| 37 | if (err != nil) != tt.wantErr { |
| 38 | t.Errorf("SendChat() error = %v, wantErr %v", err, tt.wantErr) |
| 39 | return |
| 40 | } |
| 41 | if !reflect.DeepEqual(gotChatCompletionResponse, tt.wantChatCompletionResponse) { |
| 42 | t.Errorf("SendChat() gotChatCompletionResponse = %v, want %v", gotChatCompletionResponse, tt.wantChatCompletionResponse) |
| 43 | } |
| 44 | }) |
| 45 | } |
| 46 | } |
nothing calls this directly
no test coverage detected