Parameters
Optional conversation identifier. When provided, results are biased toward memories relevant to the active conversation. When supplied, it must be a valid UUID registered via
record_message.One or more search queries to find relevant organizational memories. If omitted, returns the most recent and highest-confidence client-scoped memories. A single fetch searches at most 5 queries; with more, the first five are searched and the response’s
retrieval.warnings says so. Send the rest in another fetch.How many items each search query may contribute when
search_query holds more than one. Without it, a query with many strong matches can take every place and a query with a single weaker match gets none. max_results stays the ceiling on the whole response: three queries at 5 each under max_results=10 return ten, not fifteen. Ignored with a single query. Optional; when omitted, the best max_results items overall are returned. In JavaScript and TypeScript, pass it as max_results_per_query (or maxResultsPerQuery).Retrieval mode that controls the speed-quality tradeoff: the retrieval axis (
fast vs accurate) of Retrieval Modes.For real per-mode latency on your instance, see Dashboard → Usage.
Controls how precisely results are filtered before they’re returned.
Independent of
mode; combine with either fast or accurate. For real latency on your instance, see Dashboard → Usage.The moment the question is being asked, for example
"2023-03-11". Synap resolves a time the question names (“in March”, “two months ago”) from that moment instead of from now, which matters when you replay a past conversation. Lenient: "2023-03-11", "2023/03/11 21:26" and "2023/03/11 (Sat) 21:26" all parse, and anything unreadable silently falls back to now instead of failing the read. Python 0.5.4 and later. JavaScript and TypeScript 0.5.4 and later, as query_date (or queryDate).How the memories come back. Pass
"ranked": you get one list, items, with the most relevant memory first across every type. Each item carries its type (category), its place (rank, from 1) and the score it was ranked by (metadata.rank_score). Quotes from your source conversations and documents come back as their own type, "excerpts", placed by their own score. You can pass the list to your model as it is: there is nothing to merge or sort.The typed lists (
facts, preferences, …) are filled either way, with one difference: the quotes from your source conversations and documents are in excerpts and not in facts, so code that reads only facts no longer sees them. The list is in rank order, but when the token budget is exceeded the cut keeps whole memory types in a fixed order, so it does not always keep the best items overall. In JavaScript and TypeScript, pass it as response_shape (or responseShape).The level of your scope ladder to read from, named in full, for example
{"customer": "acme", "team": "payments", "user": "dana"}. Only needed when your ladder has a level between customer and user: the ids alone reach only the default three levels. Every level above the one you read from must be named; a path with a gap is refused (400), as is any path when nested scoping is off or the ladder has not been accepted. Python 0.4.6 and later. JavaScript and TypeScript 0.5.10 and later, as scope_path (or scopePath).Returns
AContextResponse with the following fields:
With
response_shape="ranked": every memory once, most relevant first across types. Each item has id, rank (1 is best), category (facts, preferences, episodes, emotions, temporal_events or excerpts), content, metadata.rank_score (higher is better), confidence, the date fields and matched_queries. Empty with by_type.With
response_shape="ranked": the quotes from your source conversations and documents, as their own list. With by_type they are filed under facts.Array of fact memories relevant to the query. Each includes
content, confidence, entities, source, and relevance_score. Every memory item also carries matched_queries: the search_query strings that found it, in the order you sent them. A result of a subquery the server wrote names the query it came from. In JavaScript and TypeScript, read it as matchedQueries.Example
Response
Client context is cached with a 30-minute TTL. Repeated queries within the TTL window are served from cache without re-querying the storage engines. New bootstrap ingestions automatically invalidate the cache.
Ranked results
Withresponse_shape="ranked", read items in order. The most relevant memory comes first, whatever its type.
Raises
InvalidInputError: whenmodeis not"fast"or"accurate".InvalidInputError: whenprecision_levelis not"high"or"medium".InvalidInputError: whenresponse_shapeis not"ranked"or"by_type".AuthenticationErrorwith the message “SDK not initialized”: when called beforeawait sdk.initialize()(Python). JavaScript resolves the client’s identity on the first call instead.AuthenticationError: when the API key is invalid or revoked.
See also
sdk.user.context.fetch: user-scoped contextsdk.customer.context.fetch: customer-scoped contextsdk.context.fetch: unified scope-chain fetch