feat: add brain context() recall to the Python SDK (v0.2.0)#11
Merged
Conversation
… client + raw); v0.2.0
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.
Summary
context()— the brain's primary recall API (GET /v1/brain/context) — to the Python SDK. Previously onlysearch/write/getwere wrapped, so callers had to drop to raw httpx for prompt-ready recall.\n- NewContextResponse/ContextHittypes (snake_case with wire aliases,extra=allowfor forward-compat).\n- Wired into sync + asyncDocumentsResource, theUnisonBrain/AsyncUnisonBrainconvenience methods, and the raw wrappers; exported from the package.\n- Bumped to 0.2.0.\n\n## Test plan\n- [x]test_contextadded; full suite passes (61 tests)\n- [x] live-tested against a running brain:client.context("…")returns ContextResponse (weak_evidence, hits[].snippet, context_md, top_score) and abstains on weak queriesSummary by cubic
Adds prompt-ready recall via
context()to the Python SDK by wrappingGET /v1/brain/contextacross sync, async, and raw clients. Introduces typed responses and bumpsunisonlabsto0.2.0.New Features
context()available onUnisonBrain,AsyncUnisonBrain,DocumentsResource, and raw wrappers.k,mode,max_entities,path_prefix,include_bodies(mapped to API aliases).ContextResponseandContextHit(snake_case fields with wire aliases,extra=allow).context_md,weak_evidence,hits,top_score, and entities; includes test coverage.Migration
unisonlabs0.2.0and callclient.context("your query")instead of hand-rolling HTTP calls.Written for commit fe32da8. Summary will update on new commits.