Skip to content

Commit 5d302df

Browse files
jfrench9claude
andauthored
Fix token pricing precision by changing attributes from int to float (#46)
## Summary Updates the TokenPricing model to use float data types instead of integers for input and output token pricing attributes, enabling more precise cost calculations. ## Key Changes - Modified TokenPricing model attribute types from `int` to `float` - Enhanced precision for token cost calculations - Improved accuracy in pricing computations ## Impact - **Breaking Change**: This change modifies the data model and may affect existing integrations that expect integer values - Applications consuming the TokenPricing model will now receive float values instead of integers - Database schema may require migration if persisting these values ## Testing Considerations - Verify that all token pricing calculations work correctly with float values - Test backward compatibility with existing API consumers - Validate precision improvements in cost computation scenarios - Ensure proper handling of decimal values in pricing workflows ## Technical Notes - The change affects the core pricing model used throughout the robosystems client - Consider updating any validation rules that may have assumed integer constraints - Review serialization/deserialization logic to ensure proper float handling --- 🤖 Generated with [Claude Code](https://claude.ai/code) **Branch Info:** - Source: `bugfix/token-float` - Target: `main` - Type: bugfix Co-Authored-By: Claude <noreply@anthropic.com>
2 parents a640fbd + 80ba42a commit 5d302df

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

robosystems_client/models/token_pricing.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ class TokenPricing:
1414
"""AI token pricing for a specific model.
1515
1616
Attributes:
17-
input_per_1k_tokens (int): Credits per 1K input tokens
18-
output_per_1k_tokens (int): Credits per 1K output tokens
17+
input_per_1k_tokens (float): Credits per 1K input tokens
18+
output_per_1k_tokens (float): Credits per 1K output tokens
1919
"""
2020

21-
input_per_1k_tokens: int
22-
output_per_1k_tokens: int
21+
input_per_1k_tokens: float
22+
output_per_1k_tokens: float
2323
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
2424

2525
def to_dict(self) -> dict[str, Any]:

0 commit comments

Comments
 (0)