fix(python-sdks): add missing exports and openai_responses example#216
Open
Vswaroop04 wants to merge 1 commit into
Open
fix(python-sdks): add missing exports and openai_responses example#216Vswaroop04 wants to merge 1 commit into
Vswaroop04 wants to merge 1 commit into
Conversation
semantic-cache-py: export DEFAULT_COST_TABLE and BlockHints from __init__.py; both existed in the package but were not re-exported, breaking parity with the JS API surface. agent-cache-py: add ToolRecommendation Literal type alias, use it in ToolEffectivenessEntry.recommendation, and add CacheResult = Union[LlmCacheResult, ToolCacheResult] type alias — matching the JS index exports. Add examples/openai_responses/main.py to semantic-cache-py; the JS package had this example but the Python package was missing it.
8e9e424 to
7ad302e
Compare
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.
The Python SDK packages had a few gaps where their public API surface did not fully match their JavaScript counterparts.
In betterdb-semantic-cache, DEFAULT_COST_TABLE and BlockHints already existed internally but were not re-exported from the package root through init.py. As a result, users had to import them from internal modules directly. This PR exposes both from the package root, bringing the Python package in line with what the JavaScript package already exports. Additionally, an examples/openai_responses/main.py example has been added. The JavaScript package has included a Responses API adapter example since v0.2.0, but the Python implementation was missing an equivalent example.
In betterdb-agent-cache, two exports available in JavaScript were missing from Python. The first is ToolRecommendation, a named alias representing the recommendation values: increase_ttl, optimal, and decrease_ttl_or_disable. Previously, this type was defined anonymously inside ToolEffectivenessEntry. The second is CacheResult, a union alias equivalent to the JavaScript CacheResult interface. Both are now exported from the package root, and ToolEffectivenessEntry.recommendation has been updated to use the named alias.
All existing tests continue to pass successfully: 136/136 in semantic-cache-py and 165/165 in agent-cache-py.