aboutsummaryrefslogtreecommitdiff
path: root/apps/docs/user-profiles/examples.mdx
diff options
context:
space:
mode:
authorDhravya Shah <[email protected]>2026-01-08 18:36:48 -0800
committerGitHub <[email protected]>2026-01-08 18:36:48 -0800
commitca8eb295db1a06d50ce405b0637ca9a59aa7f4a8 (patch)
tree0714528560fc0a07b9af1af989cace74f5afece4 /apps/docs/user-profiles/examples.mdx
parentfeat: allow prompt template for @supermemory/tools package (#655) (diff)
downloadsupermemory-ca8eb295db1a06d50ce405b0637ca9a59aa7f4a8.tar.xz
supermemory-ca8eb295db1a06d50ce405b0637ca9a59aa7f4a8.zip
Add threshold parameter to profile API docs (#659)
Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com>
Diffstat (limited to 'apps/docs/user-profiles/examples.mdx')
-rw-r--r--apps/docs/user-profiles/examples.mdx51
1 files changed, 51 insertions, 0 deletions
diff --git a/apps/docs/user-profiles/examples.mdx b/apps/docs/user-profiles/examples.mdx
index 75ae163a..496f905f 100644
--- a/apps/docs/user-profiles/examples.mdx
+++ b/apps/docs/user-profiles/examples.mdx
@@ -180,6 +180,57 @@ Relevant Information:
</CodeGroup>
+## Filtering with Threshold
+
+Use the optional `threshold` parameter to filter search results by relevance score:
+
+<CodeGroup>
+
+```typescript TypeScript
+async function getHighQualityContext(userId: string, userQuery: string) {
+ const response = await fetch('https://api.supermemory.ai/v4/profile', {
+ method: 'POST',
+ headers: {
+ 'Authorization': `Bearer ${process.env.SUPERMEMORY_API_KEY}`,
+ 'Content-Type': 'application/json'
+ },
+ body: JSON.stringify({
+ containerTag: userId,
+ threshold: 0.7, // Only include high-confidence results
+ q: userQuery
+ })
+ });
+
+ const data = await response.json();
+
+ // Only highly relevant memories are included
+ return data;
+}
+```
+
+```python Python
+async def get_high_quality_context(user_id: str, user_query: str):
+ response = requests.post(
+ 'https://api.supermemory.ai/v4/profile',
+ headers={
+ 'Authorization': f'Bearer {os.getenv("SUPERMEMORY_API_KEY")}',
+ 'Content-Type': 'application/json'
+ },
+ json={
+ 'containerTag': user_id,
+ 'threshold': 0.7, # Only include high-confidence results
+ 'q': user_query
+ }
+ )
+
+ data = response.json()
+
+ # Only highly relevant memories are included
+ return data
+```
+
+</CodeGroup>
+
## Separate Profile and Search
For more control, you can call profile and search endpoints separately: