Skip to content

Commit

Permalink
Fix bug HamaWhiteGG#64: UnrecognizedPropertyException in CompletionResp
Browse files Browse the repository at this point in the history
  • Loading branch information
HamaWhiteGG committed Aug 5, 2023
1 parent 59fadf9 commit 609737e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 3 additions & 0 deletions openai-client/src/main/java/com/hw/openai/OpenAiClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

package com.hw.openai;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hw.openai.entity.chat.ChatCompletion;
import com.hw.openai.entity.chat.ChatCompletionResp;
Expand Down Expand Up @@ -133,6 +134,8 @@ public OpenAiClient init() {
// Used for automatic discovery and registration of Jackson modules
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.findAndRegisterModules();
// Ignore unknown fields
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

Retrofit retrofit = new Retrofit.Builder()
.baseUrl(openaiApiBase)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
@Data
public class CompletionResp {

private String warning;

private String id;

private String object;
Expand Down

0 comments on commit 609737e

Please sign in to comment.