Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.maximem.ai/llms.txt

Use this file to discover all available pages before exploring further.

await sdk.client.context.fetch(
    conversation_id=None,
    search_query=None,
    max_results=10,
    types=None,
    mode="fast",
)
Retrieve organizational context scoped to your application (client). Client-scoped memories are visible to all users across all customers. This is typically used for product knowledge, documentation, and announcements that were ingested via bootstrap ingestion.

Parameters

conversation_id
string
Optional conversation identifier. When provided, results are biased toward memories relevant to the active conversation.
search_query
string | string[]
One or more search queries to find relevant organizational memories. If omitted, returns the most recent and highest-confidence client-scoped memories.
max_results
integer
Maximum number of memory items to return. Defaults to 10. Maximum 50.
types
string[]
Filter results to specific memory types. If omitted, all types are included.
ValueDescription
factFactual information about your organization or product
preferenceOrganizational preferences and standards
episodeSignificant organizational events
temporal_eventTime-bound organizational events (launches, deadlines)
mode
string
Retrieval mode that controls the speed-quality tradeoff.
ValueDescription
fastVector search only. Lowest latency (~50-100ms). Default.
accurateFull vector + graph + re-ranking. Highest quality (~200-500ms).

Returns

A ContextResponse with the following fields:
facts
array
Array of fact memories relevant to the query. Each includes content, confidence, entities, source, and relevance_score.
preferences
array
Array of preference memories.
episodes
array
Array of episode memories.
metadata
object
Response metadata including total_results, query_time_ms, tokens_used, scope, and mode.

Example

from maximem_synap import MaximemSynapSDK

sdk = MaximemSynapSDK(api_key="synap_your_key_here")
await sdk.initialize()

context = await sdk.client.context.fetch(
    search_query=["product features", "API rate limits"],
    max_results=5,
    types=["fact"],
    mode="accurate",
)

for fact in context.facts:
    print(f"[{fact.confidence:.2f}] {fact.content}")
Response
{
  "facts": [
    {
      "id": "mem_org_a1b2c3d4",
      "content": "The API rate limit is 1000 requests per minute for Enterprise tier",
      "confidence": 0.97,
      "entities": [],
      "source": {
        "ingestion_id": "ing_bootstrap_001",
        "document_type": "knowledge-article",
        "document_created_at": "2025-01-10T00:00:00Z"
      },
      "relevance_score": 0.94
    },
    {
      "id": "mem_org_e5f67890",
      "content": "Platform supports SSO with SAML and OIDC protocols",
      "confidence": 0.95,
      "entities": [],
      "source": {
        "ingestion_id": "ing_bootstrap_002",
        "document_type": "document",
        "document_created_at": "2025-01-10T00:00:00Z"
      },
      "relevance_score": 0.87
    }
  ],
  "preferences": [],
  "episodes": [],
  "metadata": {
    "total_results": 2,
    "query_time_ms": 124,
    "tokens_used": 289,
    "scope": {
      "client_id": "cli_a1b2c3d4e5f67890"
    },
    "mode": "accurate"
  }
}
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.

Raises

  • InvalidInputError — when mode is not "fast" or "accurate".
  • SDKNotInitializedError — when called before await sdk.initialize().
  • AuthenticationError — when the API key is invalid or revoked.

See also