Skip to main content

Search

Semantic search across your memory corpus. Returns ranked results with relevance scores, cosine similarity, and match confidence. Supports tag filtering, agent scoping, recency weighting, and minimum score thresholds.

Base URL: https://novyx-ram-api.fly.dev


GET /v1/memories/search

Search memories by semantic similarity. The query is embedded and compared against all stored memory embeddings. Results are ranked by a blended score combining cosine similarity and optional recency weighting.

Query parameters

ParameterTypeRequiredDefaultDescription
qstringYesSearch query (natural language)
limitnumberNo5Max results (1–100)
min_scorenumberNo0Minimum similarity score (0–1). Results below this threshold are excluded
tagsstringNoComma-separated tag filter. Only memories with at least one matching tag are returned
agent_idstringNoFilter by agent identifier
space_idstringNoFilter by space namespace (Pro+)
recency_weightnumberNo0Blend recency into scoring (0–1). 0 = pure semantic, 1 = heavily favor recent memories
include_supersededbooleanNofalseInclude memories that have been superseded by newer versions

Response fields

FieldTypeDescription
querystringOriginal search query
total_resultsnumberNumber of results returned
memoriesarrayRanked array of memory results
memories[].uuidstringMemory ID
memories[].observationstringMemory content
memories[].scorenumberCombined relevance score (0–1)
memories[].similaritynumberRaw cosine similarity (0–1)
memories[].match_confidencenumberMatch confidence indicator
memories[].tagsstring[]Memory tags
memories[].importancenumberImportance score
memories[].created_atstringCreation timestamp

Examples

from novyx import Novyx

nx = Novyx(api_key="nram_your_key")

# Basic semantic search
results = nx.recall("user preferences")
for mem in results["memories"]:
print(f"{mem['score']:.2f}{mem['observation']}")

# Filtered search with minimum score
results = nx.recall(
"dark mode settings",
tags="preferences",
min_score=0.7,
limit=3,
)

# Recency-weighted search
results = nx.recall(
"what did the user say recently?",
recency_weight=0.8,
limit=10,
)

Response

{
"query": "user preferences",
"total_results": 3,
"memories": [
{
"uuid": "urn:uuid:a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"observation": "User prefers dark mode and compact layouts",
"score": 0.92,
"similarity": 0.92,
"match_confidence": 0.95,
"tags": ["preferences", "ui"],
"importance": 8,
"created_at": "2026-03-09T12:00:00Z"
},
{
"uuid": "urn:uuid:b2c3d4e5-f6a7-8901-bcde-f12345678901",
"observation": "User timezone is America/New_York",
"score": 0.78,
"similarity": 0.78,
"match_confidence": 0.82,
"tags": ["preferences"],
"importance": 6,
"created_at": "2026-03-08T10:30:00Z"
}
]
}

How scoring works

The score field is a blended relevance score:

  • Without recency weighting (recency_weight=0): Score equals cosine similarity between the query embedding and memory embedding.
  • With recency weighting (recency_weight=0.5): Score blends similarity with temporal proximity. Recent memories score higher even with slightly lower semantic match.

The similarity field always contains the raw cosine similarity, regardless of recency weighting. Use this when you need the unblended semantic match.

The match_confidence field indicates how reliable the match is — factoring in the memory's recall frequency and importance.

Errors

StatusCodeCause
400VALIDATION_ERRORMissing q parameter or invalid limit range
429RATE_LIMITEDExceeded plan API call quota

Tips

  • Use min_score to filter out low-quality matches. Start with 0.6 and adjust based on your use case.
  • Tag filtering happens before semantic ranking — it narrows the candidate set, not the final results.
  • recency_weight is useful for conversational agents where recent context matters more than historical knowledge.
  • Set include_superseded=true if you need to search the full history including replaced memories.