feat(sdk): add precision_level fetch parameter (high|medium) - #13
Merged
Conversation
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.
There was a problem hiding this comment.
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_levelparticipates 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 acceptprecisionLevel.
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) |
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.
SDK companion to maximem-ai/maximem_synap#878 (merged): optional
precision_levelkwarg 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).mode(InvalidInputError on bad values) on all four scoped interfaces + unified fetch delegation._invoke_scope_fetch, facade controllers, JS SDK (precisionLevel).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