Skip to content

Commit e830bb6

Browse files
committed
improved ability to use openAiApi to support DeepSeek
1 parent 5503d41 commit e830bb6

File tree

1 file changed

+13
-2
lines changed
  • models/spring-ai-openai/src/main/java/org/springframework/ai/openai/api

1 file changed

+13
-2
lines changed

models/spring-ai-openai/src/main/java/org/springframework/ai/openai/api/OpenAiApi.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,17 +1323,28 @@ public record TopLogProbs(// @formatter:off
13231323
* completion).
13241324
* @param promptTokensDetails Breakdown of tokens used in the prompt.
13251325
* @param completionTokenDetails Breakdown of tokens used in a completion.
1326+
* @param promptCacheHitTokens Number of tokens in the prompt that were served from
1327+
* (util for
1328+
* <a href="https://api-docs.deepseek.com/api/create-chat-completion">DeepSeek</a>
1329+
* support).
1330+
* @param promptCacheMissTokens Number of tokens in the prompt that were not served
1331+
* (util for
1332+
* <a href="https://api-docs.deepseek.com/api/create-chat-completion">DeepSeek</a>
1333+
* support).
13261334
*/
13271335
@JsonInclude(Include.NON_NULL)
1336+
@JsonIgnoreProperties(ignoreUnknown = true)
13281337
public record Usage(// @formatter:off
13291338
@JsonProperty("completion_tokens") Integer completionTokens,
13301339
@JsonProperty("prompt_tokens") Integer promptTokens,
13311340
@JsonProperty("total_tokens") Integer totalTokens,
13321341
@JsonProperty("prompt_tokens_details") PromptTokensDetails promptTokensDetails,
1333-
@JsonProperty("completion_tokens_details") CompletionTokenDetails completionTokenDetails) { // @formatter:on
1342+
@JsonProperty("completion_tokens_details") CompletionTokenDetails completionTokenDetails,
1343+
@JsonProperty("prompt_cache_hit_tokens") Integer promptCacheHitTokens,
1344+
@JsonProperty("prompt_cache_miss_tokens") Integer promptCacheMissTokens) { // @formatter:on
13341345

13351346
public Usage(Integer completionTokens, Integer promptTokens, Integer totalTokens) {
1336-
this(completionTokens, promptTokens, totalTokens, null, null);
1347+
this(completionTokens, promptTokens, totalTokens, null, null, null, null);
13371348
}
13381349

13391350
/**

0 commit comments

Comments
 (0)