feat: robust pattern-matching cost estimation and trace decorator resilience - #87
Open
archittmittal wants to merge 1 commit into
Open
feat: robust pattern-matching cost estimation and trace decorator resilience#87archittmittal wants to merge 1 commit into
archittmittal wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This Pull Request resolves Issue #25, Issue #29, and Issue #11.
Key Changes:
packages/sdk/agentscope/_pricing.pyto resolve model cost estimations using prefix/pattern matching. Base pricing patterns are sorted by length in descending order to guarantee that more specific version-pinned names (e.g.gpt-4o-2024-05-13) match before generic ones.update_pricing_table) and environment variable configuration overrides viaAGENTSCOPE_CUSTOM_PRICINGparsed dynamically at runtime.PRICING_TABLEforclaude-3-haiku,claude-3-opus, andgemini-1.5-flash.try/exceptblocks inpackages/sdk/agentscope/decorators.pyto ensure telemetry server connectivity errors never propagate and disrupt user-defined synchronous/asynchronous logic.packages/sdk/tests/test_sdk.pywithtest_decorators_resilienceconfirming telemetry emit failures do not halt execution, and added version-matching, overrides, and Claude/Gemini cost assertions totest_calculate_cost.All tests pass successfully.