Skip to content

Commit 5455792

Browse files
abrookinsclaude
andcommitted
docs: add descriptive parameter examples
Updates documentation with clean examples using descriptive parameter names: - Update API documentation example with descriptive recency parameters - Add comprehensive recency configuration section to client README - Demonstrate clear, readable parameter naming 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent c8bdeb9 commit 5455792

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

agent-memory-client/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,39 @@ results = await client.search_long_term_memory(
240240
)
241241
```
242242

243+
## Recency-Aware Search
244+
245+
```python
246+
from agent_memory_client.models import RecencyConfig
247+
248+
# Search with recency-aware ranking
249+
recency_config = RecencyConfig(
250+
recency_boost=True,
251+
semantic_weight=0.8, # Weight for semantic similarity
252+
recency_weight=0.2, # Weight for recency score
253+
freshness_weight=0.6, # Weight for freshness component
254+
novelty_weight=0.4, # Weight for novelty/age component
255+
half_life_last_access_days=7, # Last accessed decay half-life
256+
half_life_created_days=30, # Creation date decay half-life
257+
server_side_recency=True # Use server-side optimization
258+
)
259+
260+
results = await client.search_long_term_memory(
261+
text="project updates",
262+
recency=recency_config,
263+
limit=10
264+
)
265+
266+
# Legacy parameter names are still supported for backward compatibility
267+
legacy_config = RecencyConfig(
268+
recency_boost=True,
269+
w_sem=0.8, # Deprecated: use semantic_weight
270+
w_recency=0.2, # Deprecated: use recency_weight
271+
wf=0.6, # Deprecated: use freshness_weight
272+
wa=0.4 # Deprecated: use novelty_weight
273+
)
274+
```
275+
243276
## Error Handling
244277

245278
```python

docs/api.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,19 @@ The following endpoints are available:
8989
"last_accessed": { "gt": 1704063600 },
9090
"user_id": { "eq": "user-456" },
9191
"recency_boost": true,
92-
"recency_w_sem": 0.8,
93-
"recency_w_recency": 0.2,
94-
"recency_wf": 0.6,
95-
"recency_wa": 0.4,
92+
"recency_semantic_weight": 0.8,
93+
"recency_recency_weight": 0.2,
94+
"recency_freshness_weight": 0.6,
95+
"recency_novelty_weight": 0.4,
9696
"recency_half_life_last_access_days": 7.0,
9797
"recency_half_life_created_days": 30.0
9898
}
9999
```
100100

101101
When `recency_boost` is enabled (default), results are re-ranked using a combined score of semantic similarity and a recency score computed from `last_accessed` and `created_at`. The optional fields adjust weighting and half-lives. The server rate-limits updates to `last_accessed` in the background when results are returned.
102102

103+
**Note:** Legacy parameter names (`recency_w_sem`, `recency_w_recency`, `recency_wf`, `recency_wa`) are still supported for backward compatibility but are deprecated. Use the descriptive names shown above for new implementations.
104+
103105
- **POST /v1/long-term-memory/forget**
104106
Trigger a forgetting pass (admin/maintenance).
105107

0 commit comments

Comments
 (0)