Smritea

Search methods and rerankers

Smritea has three search methods and six rerankers. Learn what each does and which limits apply.

Ask AI about this page

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

Search methods

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

MethodWhat it doesCost in search credits
quick_searchFinds memories by vector similarity. It runs no language model. Results rank by similarity and recency.1
deep_searchFinds memories with a set of vector searches, then follows entities and relationships in your app's knowledge graph. A reranker orders the result.3
context_aware_searchUses a language model to read the conversation context and pick starting points, then follows the knowledge graph. Results rank by similarity and recency.5

Costs come from the plan catalog. See Limits, quotas and credits. If you leave out method, Smritea charges the deep_search cost, even on a Quick Search app. Pass method to control the cost.

A Quick Search app stores text without extracting facts or entities. Deep methods suit a Deep Search app. See How Smritea stores memory.

Rerankers

Pass reranker_type to choose a reranker. It applies to deep_search only. The default is cross_encoder.

RerankerHow it orders results
cross_encoderScores how well each memory text answers the query.
rrfCombines four signals: match score, relationship count, recency and importance.
temporalMultiplies the score by a weight that favors recent memories.
rrf_temporalApplies rrf, then temporal.
node_distanceFavors memories that sit close to the starting entities in the graph.
mmrReorders for variety. It leaves the scores unchanged.

Choose a method and a reranker

Pass method and reranker_type to search, as in this deep_search call with the rrf reranker.

These examples reuse client and a scope named alice, built as in Scope memories. The Go and Java examples take client and alice as parameters. The Go example also takes ctx.

from smritea import SmriteaError

try:
    results = client.search(
        "What does Alice eat?",
        scope=alice,
        method="deep_search",
        reranker_type="rrf",
    )
    for r in results:
        if r.memory:
            print(f"{r.score:.2f}  {r.memory.content}")
except SmriteaError as e:
    print(e.http_status, e.code, e.request_id)

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, code TOP_N_OUT_OF_RANGE
graph_depth25HTTP 400, code GRAPH_DEPTH_OUT_OF_RANGE

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

Reading the score

Each result has a score. The scale depends on how the last step ordered the results. A cross_encoder score and an rrf score are different kinds of numbers. Compare scores only within one search call. Do not compare them across methods or rerankers.

Last updated on