Skip to content

Added inputTokenCount to MessageMetaData to expose it#67

Closed
MarkSu-Railtown wants to merge 1 commit into
christopherkarani:mainfrom
RailtownAI:expose-input-token-count
Closed

Added inputTokenCount to MessageMetaData to expose it#67
MarkSu-Railtown wants to merge 1 commit into
christopherkarani:mainfrom
RailtownAI:expose-input-token-count

Conversation

@MarkSu-Railtown
Copy link
Copy Markdown

  • also added providerExtra dictionary to store system_fingerprint

- also added providerExtra dictionary to store system_fingerprint
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines 174 to 179
metadata: MessageMetadata(
tokenCount: tokenCount,
inputTokenCount: usage?.promptTokens,
generationTime: generationTime,
tokensPerSecond: tokensPerSecond,
toolCalls: toolCalls.isEmpty ? nil : toolCalls
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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]?
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@MarkSu-Railtown MarkSu-Railtown deleted the expose-input-token-count branch May 20, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant