Skip to content

feat(sdk): add precision_level fetch parameter (high|medium) - #13

Merged
Shreyanshsingh23 merged 1 commit into
mainfrom
feat/precision-level
Jul 6, 2026
Merged

feat(sdk): add precision_level fetch parameter (high|medium)#13
Shreyanshsingh23 merged 1 commit into
mainfrom
feat/precision-level

Conversation

@Shreyanshsingh23

Copy link
Copy Markdown
Collaborator

SDK companion to maximem-ai/maximem_synap#878 (merged): optional precision_level kwarg on all five context fetch surfaces — "high" (default) keeps the server-side relevance-refinement pass; "medium" skips it for faster, less precisely filtered results (recall isn't impacted).

  • Validation mirrors mode (InvalidInputError on bad values) on all four scoped interfaces + unified fetch delegation.
  • SDK local cache params include it — medium/high never share a cache entry.
  • Body emission only when non-default — wire contract to older servers unchanged.
  • Tool schema enum + _invoke_scope_fetch, facade controllers, JS SDK (precisionLevel).
  • Version 0.2.6 → 0.3.0 (additive, minor). PyPI publish follows merge (separate step).

Tests: 11 new in tests/sdk/test_precision_level_param.py, all green. Pre-existing failures on main are untouched and documented in the commit message.

🤖 Generated with Claude Code

Optional precision_level kwarg on all five context fetch surfaces (unified
sdk.fetch + conversation/user/customer/client), matching the server-side
parameter shipped in maximem_synap#878: "high" (default) keeps the
server-side relevance-refinement pass; "medium" skips it for faster,
less precisely filtered results (recall isn't impacted — the same
candidate memories are searched).

- Client-side validation mirroring mode: InvalidInputError on bad values.
- Included in SDK local cache params (medium/high never share an entry).
- Emitted in the HTTP body only when non-default, so the wire contract to
  older servers is unchanged.
- LLM tool schema + _invoke_scope_fetch threading; facade controllers and
  JS SDK passthrough (precisionLevel -> precision_level).
- Version 0.2.6 -> 0.3.0 (additive feature, minor bump).

Tests: tests/sdk/test_precision_level_param.py (validation on all four
scoped interfaces, conditional body emission, cache-param inclusion).
Pre-existing on main and untouched: test_phase2_local_st_merge.py
collection error (imports a function that only exists on the unmerged
fix/checkpointer-lookup-mode branch) and 3 test_short_term_store.py
timestamp failures.
Copilot AI review requested due to automatic review settings July 6, 2026 11:57

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds an optional precision_level fetch parameter across the SDK context-fetch surfaces to trade result-filtering precision for speed while preserving backwards-compatible request bodies when the default is used.

Changes:

  • Introduces precision_level ("high" default, "medium") through Python SDK fetch APIs, tool schema, and scope-fetch delegation.
  • Ensures precision_level participates in local cache keys and is only emitted over the wire when non-default.
  • Adds SDK-side tests covering validation, body emission, and cache-keying; bumps SDK version to 0.3.0; updates JS client fetch methods to accept precisionLevel.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
tests/sdk/test_precision_level_param.py New tests for validation, body emission, and cache-key behavior for precision_level.
packages/sdks/maximem-synap/maximem_synap/sdk.py Threads precision_level through fetch flows, validates inputs, adds tool schema enum, updates cache keys and request bodies.
packages/sdks/maximem-synap/maximem_synap/facade/controllers.py Adds precision_level to facade controller fetch signatures and payload emission behavior.
packages/sdks/maximem-synap/maximem_synap/_version.py Bumps Python SDK version from 0.2.6 to 0.3.0.
packages/sdks/maximem-synap-js/src/synap-client.js Adds precisionLevel support to JS context fetch methods and forwards it to the bridge call params.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 279 to +281
if (types !== undefined) params.types = types;
if (mode !== undefined) params.mode = mode;
if (precisionLevel !== undefined) params.precision_level = precisionLevel;
Comment on lines 294 to +296
if (types !== undefined) params.types = types;
if (mode !== undefined) params.mode = mode;
if (precisionLevel !== undefined) params.precision_level = precisionLevel;
Comment on lines 308 to +310
if (types !== undefined) params.types = types;
if (mode !== undefined) params.mode = mode;
if (precisionLevel !== undefined) params.precision_level = precisionLevel;
Comment on lines 54 to 58
max_results: int = 10,
types: Optional[List["ContextType"]] = None,
mode: str = "fast",
precision_level: str = "high",
):
Comment on lines 218 to 223
search_query: Optional[List[str]] = None,
max_results: int = 10,
types: Optional[List["ContextType"]] = None,
mode: str = "fast",
precision_level: str = "high",
):
Comment on lines 283 to 288
search_query: Optional[List[str]] = None,
max_results: int = 10,
types: Optional[List["ContextType"]] = None,
mode: str = "fast",
precision_level: str = "high",
):
Comment on lines 348 to 352
max_results: int = 10,
types: Optional[List["ContextType"]] = None,
mode: str = "fast",
precision_level: str = "high",
):
Comment on lines 1717 to 1721
mode: Retrieval mode - "fast" (default) or "accurate"
precision_level: "high" (default) keeps the server-side relevance-refinement
pass; "medium" skips it for faster, less precisely filtered results.
- "fast": Direct query, low latency (~50-100ms)
- "accurate": LLM-enhanced queries, higher quality (~200-500ms)
@Shreyanshsingh23
Shreyanshsingh23 merged commit 6fae7e7 into main Jul 6, 2026
1 check passed
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.

2 participants