Skip to content

fix(python-sdks): add missing exports and openai_responses example#216

Open
Vswaroop04 wants to merge 1 commit into
BetterDB-inc:masterfrom
Vswaroop04:feat/python-sdk-missing-exports
Open

fix(python-sdks): add missing exports and openai_responses example#216
Vswaroop04 wants to merge 1 commit into
BetterDB-inc:masterfrom
Vswaroop04:feat/python-sdk-missing-exports

Conversation

@Vswaroop04
Copy link
Copy Markdown
Contributor

@Vswaroop04 Vswaroop04 commented May 20, 2026

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.

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.
@Vswaroop04 Vswaroop04 force-pushed the feat/python-sdk-missing-exports branch from 8e9e424 to 7ad302e Compare May 20, 2026 17:37
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