Skip to content

Commit d822129

Browse files
fix for deeepseek
1 parent e589864 commit d822129

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
[![swiftui-version](https://img.shields.io/badge/swiftui-brightgreen)](https://developer.apple.com/documentation/swiftui)
88
[![xcode-version](https://img.shields.io/badge/xcode-15%20-brightgreen)](https://developer.apple.com/xcode/)
99
[![swift-package-manager](https://img.shields.io/badge/package%20manager-compatible-brightgreen.svg?logo=data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNjJweCIgaGVpZ2h0PSI0OXB4IiB2aWV3Qm94PSIwIDAgNjIgNDkiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDYzLjEgKDkyNDUyKSAtIGh0dHBzOi8vc2tldGNoLmNvbSAtLT4KICAgIDx0aXRsZT5Hcm91cDwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxnIGlkPSJQYWdlLTEiIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxnIGlkPSJHcm91cCIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgPHBvbHlnb24gaWQ9IlBhdGgiIGZpbGw9IiNEQkI1NTEiIHBvaW50cz0iNTEuMzEwMzQ0OCAwIDEwLjY4OTY1NTIgMCAwIDEzLjUxNzI0MTQgMCA0OSA2MiA0OSA2MiAxMy41MTcyNDE0Ij48L3BvbHlnb24+CiAgICAgICAgICAgIDxwb2x5Z29uIGlkPSJQYXRoIiBmaWxsPSIjRjdFM0FGIiBwb2ludHM9IjI3IDI1IDMxIDI1IDM1IDI1IDM3IDI1IDM3IDE0IDI1IDE0IDI1IDI1Ij48L3BvbHlnb24+CiAgICAgICAgICAgIDxwb2x5Z29uIGlkPSJQYXRoIiBmaWxsPSIjRUZDNzVFIiBwb2ludHM9IjEwLjY4OTY1NTIgMCAwIDE0IDYyIDE0IDUxLjMxMDM0NDggMCI+PC9wb2x5Z29uPgogICAgICAgICAgICA8cG9seWdvbiBpZD0iUmVjdGFuZ2xlIiBmaWxsPSIjRjdFM0FGIiBwb2ludHM9IjI3IDAgMzUgMCAzNyAxNCAyNSAxNCI+PC9wb2x5Z29uPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+)](https://github.com/apple/swift-package-manager)
10+
[![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://buymeacoffee.com/jamesrochabrun)
1011

1112
An open-source Swift package designed for effortless interaction with OpenAI's public API.
1213

Sources/OpenAI/Public/ResponseModels/Chat/ChatUsage.swift

+9-9
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import Foundation
99

1010
public struct ChatUsage: Decodable {
1111
/// Number of tokens in the prompt
12-
public let promptTokens: Int
12+
public let promptTokens: Int?
1313
/// Number of tokens in the generated completion
14-
public let completionTokens: Int
14+
public let completionTokens: Int?
1515
/// Total number of tokens used in the request (prompt + completion)
16-
public let totalTokens: Int
16+
public let totalTokens: Int?
1717
/// Detailed breakdown of prompt tokens
1818
public let promptTokensDetails: PromptTokenDetails?
1919
/// Detailed breakdown of completion tokens
@@ -30,9 +30,9 @@ public struct ChatUsage: Decodable {
3030

3131
public struct PromptTokenDetails: Decodable {
3232
/// Number of tokens retrieved from cache
33-
public let cachedTokens: Int
33+
public let cachedTokens: Int?
3434
/// Number of tokens used for audio processing
35-
public let audioTokens: Int
35+
public let audioTokens: Int?
3636

3737
enum CodingKeys: String, CodingKey {
3838
case cachedTokens = "cached_tokens"
@@ -42,13 +42,13 @@ public struct PromptTokenDetails: Decodable {
4242

4343
public struct CompletionTokenDetails: Decodable {
4444
/// Number of tokens used for reasoning
45-
public let reasoningTokens: Int
45+
public let reasoningTokens: Int?
4646
/// Number of tokens used for audio processing
47-
public let audioTokens: Int
47+
public let audioTokens: Int?
4848
/// Number of tokens in accepted predictions
49-
public let acceptedPredictionTokens: Int
49+
public let acceptedPredictionTokens: Int?
5050
/// Number of tokens in rejected predictions
51-
public let rejectedPredictionTokens: Int
51+
public let rejectedPredictionTokens: Int?
5252

5353
enum CodingKeys: String, CodingKey {
5454
case reasoningTokens = "reasoning_tokens"

0 commit comments

Comments
 (0)