Added inputTokenCount to MessageMetaData to expose it#67
Added inputTokenCount to MessageMetaData to expose it#67MarkSu-Railtown wants to merge 1 commit into
Conversation
MarkSu-Railtown
commented
May 20, 2026
- also added providerExtra dictionary to store system_fingerprint
- also added providerExtra dictionary to store system_fingerprint
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1034144d32
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| metadata: MessageMetadata( | ||
| tokenCount: tokenCount, | ||
| inputTokenCount: usage?.promptTokens, | ||
| generationTime: generationTime, | ||
| tokensPerSecond: tokensPerSecond, | ||
| toolCalls: toolCalls.isEmpty ? nil : toolCalls |
There was a problem hiding this comment.
Preserve providerExtra in assistant message bridge
GenerationResult.assistantMessage() now copies inputTokenCount but still drops providerExtra, so callers that rely on this bridge (e.g., tool-loop integrations outside ChatSession) lose provider metadata like OpenAI system_fingerprint even though it is present on the result. This makes metadata propagation inconsistent depending on which conversion path is used.
Useful? React with 👍 / 👎.
| public let finishReason: FinishReason | ||
|
|
||
| /// Provider specific data | ||
| public let providerExtra: [String: String]? |
There was a problem hiding this comment.
Include providerExtra in GenerationResult equality
A new persisted field (providerExtra) was added to GenerationResult, but the custom == implementation does not compare it, so two results with different provider metadata are treated as equal. Any tests, caches, or dedup logic using Equatable can silently collapse distinct results after this change.
Useful? React with 👍 / 👎.