@@ -191,11 +191,6 @@ func TestFIMCompletionResponseStructure(t *testing.T) {
191
191
assert .NotNil (t , choice .Index ) // Or assert.GreaterOrEqual(t, choice.Index, 0)
192
192
// LogProbs can be nil, so just check that it's present or handle it if you expect values.
193
193
assert .NotEmpty (t , choice .FinishReason ) // Check for valid values like "stop", "length"
194
-
195
- //Optional, if logprobs are requested
196
- if req .LogProbs > 0 {
197
- assert .NotNil (t , choice .LogProbs )
198
- }
199
194
}
200
195
201
196
// Check usage structure
@@ -206,37 +201,50 @@ func TestFIMCompletionResponseStructure(t *testing.T) {
206
201
207
202
}
208
203
209
- func TestFIMCompletionResponseWithLogProbs (t * testing.T ) {
210
- testutil .SkipIfShort (t )
211
- config := testutil .LoadTestConfig (t )
212
- client := deepseek .NewClient (config .APIKey )
213
-
214
- req := & deepseek.FIMCompletionRequest {
215
- Model : deepseek .DeepSeekChat ,
216
- Prompt : "func main() {\n fmt.Println(\" hel" ,
217
- LogProbs : 1 , // Request log probabilities
218
- }
219
-
220
- ctx , cancel := context .WithTimeout (context .Background (), config .TestTimeout )
221
- defer cancel ()
222
-
223
- resp , err := client .CreateFIMCompletion (ctx , req )
224
- require .NoError (t , err )
225
- require .NotNil (t , resp )
226
-
227
- // Check choices array
228
- for _ , choice := range resp .Choices {
229
- assert .NotEmpty (t , choice .Text )
230
- assert .NotNil (t , choice .Index )
231
- assert .NotNil (t , choice .LogProbs ) // Now LogProbs should definitely be present
232
-
233
- logProbsMap , ok := choice .LogProbs .(map [string ]interface {})
234
- if ok {
235
- assert .NotEmpty (t , logProbsMap ) // Check that the map is not empty
236
- } else {
237
- t .Errorf ("Unexpected type for LogProbs: %T" , choice .LogProbs )
238
- }
239
-
240
- assert .NotEmpty (t , choice .FinishReason )
241
- }
242
- }
204
+ // The api doesn't return logprobs in the response so this test will fail
205
+ // func TestFIMCompletionResponseWithLogProbs(t *testing.T) {
206
+ // testutil.SkipIfShort(t)
207
+ // config := testutil.LoadTestConfig(t)
208
+ // client := deepseek.NewClient(config.APIKey)
209
+
210
+ // req := &deepseek.FIMCompletionRequest{
211
+ // Model: deepseek.DeepSeekChat,
212
+ // Prompt: "func main() {\n fmt.Println(\"hel",
213
+ // Logprobs: 10, // Request log probabilities
214
+ // }
215
+
216
+ // ctx, cancel := context.WithTimeout(context.Background(), config.TestTimeout)
217
+ // defer cancel()
218
+
219
+ // resp, err := client.CreateFIMCompletion(ctx, req)
220
+ // require.NoError(t, err)
221
+ // require.NotNil(t, resp)
222
+
223
+ // // Check choices array
224
+ // for _, choice := range resp.Choices {
225
+ // assert.NotEmpty(t, choice.Text)
226
+ // assert.NotNil(t, choice.Index)
227
+ // assert.NotNil(t, choice.Logprobs) // LogProbs should be present
228
+
229
+ // logProbs := choice.Logprobs
230
+ // log.Printf("LogProbs: %+v\n", logProbs)
231
+ // assert.NotEmpty(t, logProbs.Content) // Check Content is not empty
232
+ // for _, contentToken := range logProbs.Content {
233
+ // assert.NotEmpty(t, contentToken.Token)
234
+ // // assert.NotZero(t, contentToken.Logprob) // Consider checking Logprob value
235
+ // if contentToken.Bytes != nil {
236
+ // assert.NotEmpty(t, contentToken.Bytes) // Check bytes if present
237
+ // }
238
+ // }
239
+ // assert.NotEmpty(t, logProbs.TopLogprobs) // Check TopLogprobs is not empty
240
+ // for _, topLogprobToken := range logProbs.TopLogprobs {
241
+ // assert.NotEmpty(t, topLogprobToken.Token)
242
+ // // assert.NotZero(t, topLogprobToken.Logprob) // Consider checking Logprob value
243
+ // if topLogprobToken.Bytes != nil {
244
+ // assert.NotEmpty(t, topLogprobToken.Bytes) // Check bytes if present
245
+ // }
246
+ // }
247
+
248
+ // assert.NotEmpty(t, choice.FinishReason)
249
+ // }
250
+ // }
0 commit comments