Smritea search methods and rerankers: which to pick

Smritea search methods and rerankers: which to pick

by Tushar Dwivedi
Ask AI about this page

A search method is the strategy Smritea uses to find memories. A reranker is a step that reorders the memories it found. You can choose both on each search call.

The three search methods

Pass method to choose one. If you leave it out, Smritea uses your app's storage engine.

MethodWhat it doesSearch credits
quick_searchFinds memories by vector similarity. Runs no language model1
deep_searchRuns a set of vector searches, then follows entities and relationships in the knowledge graph3
context_aware_searchA language model reads the conversation context and picks starting points, then follows the graph5

If you omit method, Smritea charges the deep_search cost, even on a Quick Search app. Pass method when you want to control the cost.

The six rerankers

A reranker applies to deep_search only. Pass reranker_type to choose one. The default is cross_encoder.

RerankerHow it orders results
cross_encoderScores how well each memory answers the query
rrfCombines match score, relationship count, recency and importance
temporalWeights recent memories higher
rrf_temporalApplies rrf, then temporal
node_distanceFavors memories close to the starting entities in the graph
mmrReorders for variety and leaves the scores unchanged

Compare the methods on one question

import os

from smritea import MemoryScope, SmriteaClient, SmriteaError

client = SmriteaClient(
    api_key=os.environ["SMRITEA_API_KEY"],
    app_id=os.environ["SMRITEA_APP_ID"],
)
alice = MemoryScope(actor_id="alice", actor_type="user")

try:
    for method in ("quick_search", "deep_search"):
        results = client.search(
            "What does Alice eat?",
            scope=alice,
            method=method,
            limit=5,
        )
        print(method, [round(r.score, 2) for r in results])
except SmriteaError as e:
    print(e.http_status, e.code, e.request_id)

Compare scores only within one call. A cross_encoder score and an rrf score are different kinds of numbers.

Limits

The table gives the default and the cap for two search settings. It also says what happens above the cap.

SettingDefaultCapOver the cap
limitThe app's own setting, else 1020HTTP 400, TOP_N_OUT_OF_RANGE
graph_depth25HTTP 400, GRAPH_DEPTH_OUT_OF_RANGE

The server rejects a value above the cap. It does not cut the value down.

Learn more

The docs page Search methods and rerankers has the full reference. A Quick Search app stores text without extracting facts or entities, so the deep methods suit a Deep Search app. Read How Smritea stores memory for the difference.

Related posts

Comments