diff options
| author | Dhravya Shah <[email protected]> | 2025-09-28 16:42:06 -0700 |
|---|---|---|
| committer | Dhravya Shah <[email protected]> | 2025-09-28 16:42:06 -0700 |
| commit | 2093b316d9ecb9cfa9c550f436caee08e12f5d11 (patch) | |
| tree | 07b87fbd48b0b38ef26b9d5f839ad8cd61d82331 /apps/docs/search/examples | |
| parent | Merge branch 'main' of https://github.com/supermemoryai/supermemory (diff) | |
| download | supermemory-2093b316d9ecb9cfa9c550f436caee08e12f5d11.tar.xz supermemory-2093b316d9ecb9cfa9c550f436caee08e12f5d11.zip | |
migrate docs to public
Diffstat (limited to 'apps/docs/search/examples')
| -rw-r--r-- | apps/docs/search/examples/document-search.mdx | 588 | ||||
| -rw-r--r-- | apps/docs/search/examples/memory-search.mdx | 472 |
2 files changed, 1060 insertions, 0 deletions
diff --git a/apps/docs/search/examples/document-search.mdx b/apps/docs/search/examples/document-search.mdx new file mode 100644 index 00000000..4ef11070 --- /dev/null +++ b/apps/docs/search/examples/document-search.mdx @@ -0,0 +1,588 @@ +--- +title: "Documents Search (/v3/search)" +description: "Full-featured search with extensive control over ranking, filtering, and results" +--- + +Documents search (`POST /v3/search`) provides maximum control over search behavior with extensive parameters for fine-tuning results. + +## Basic Implementation + +<Tabs> + <Tab title="TypeScript"> + ```typescript + import Supermemory from 'supermemory'; + + const client = new Supermemory({ + apiKey: process.env.SUPERMEMORY_API_KEY! + }); + + const results = await client.search.documents({ + q: "machine learning neural networks", + limit: 5 + }); + + console.log(`Found ${results.total} documents in ${results.timing}ms`); + + // Sample output structure + results.results.forEach((doc, i) => { + console.log(`${i + 1}. ${doc.title} (Score: ${doc.score})`); + console.log(` ${doc.chunks.length} chunks found`); + }); + ``` + </Tab> + <Tab title="Python"> + ```python + from supermemory import Supermemory + import os + + client = Supermemory(api_key=os.environ.get("SUPERMEMORY_API_KEY")) + + results = client.search.documents( + q="machine learning neural networks", + limit=5 + ) + + print(f"Found {results.total} documents in {results.timing}ms") + + # Sample output structure + for i, doc in enumerate(results.results): + print(f"{i + 1}. {doc.title} (Score: {doc.score})") + print(f" {len(doc.chunks)} chunks found") + ``` + </Tab> + <Tab title="cURL"> + ```bash + curl -X POST "https://api.supermemory.ai/v3/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "machine learning neural networks", + "limit": 5 + }' + ``` + </Tab> +</Tabs> + +**Sample Output:** +```json +{ + "results": [ + { + "documentId": "doc_ml_guide_2024", + "title": "Machine Learning with Neural Networks: A Comprehensive Guide", + "score": 0.89, + "chunks": [ + { + "content": "Neural networks are computational models inspired by biological neural networks. They consist of interconnected nodes (neurons) that process information through weighted connections...", + "score": 0.92, + "isRelevant": true + }, + { + "content": "Deep learning, a subset of machine learning, uses neural networks with multiple hidden layers to learn complex patterns in data...", + "score": 0.87, + "isRelevant": true + } + ], + "createdAt": "2024-01-15T10:30:00Z", + "metadata": { + "category": "ai", + "difficulty": "intermediate" + } + } + ], + "total": 12, + "timing": 156 +} +``` + +## Container Tags Filtering + +Container tags are the primary way to isolate search results by user, project, or organization. + +**Key behaviors:** +- **Array-based**: Unlike `/v4/search`, this endpoint accepts multiple container tags as an array +- **Exact array matching**: Documents must have the EXACT same container tags array to match + +<Tabs> + <Tab title="TypeScript"> + ```typescript + const results = await client.search.documents({ + q: "quarterly reports", + containerTags: ["user_123"], + limit: 10 + }); + ``` + </Tab> + <Tab title="Python"> + ```python + results = client.search.documents( + q="quarterly reports", + container_tags=["user_123"], + limit=10 + ) + ``` + </Tab> + <Tab title="cURL"> + ```bash + curl -X POST "https://api.supermemory.ai/v3/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "quarterly reports", + "containerTags": ["user_123"], + "limit": 10 + }' + ``` + </Tab> +</Tabs> + +## Metadata Filtering + +Metadata filtering allows complex conditions on structured data attached to your documents. This uses SQL-like query construction in the backend, requiring explicit AND/OR structures. + +**Filter structure rules:** +- **Must wrap conditions** in AND or OR arrays, even for single conditions +- **Supports string matching** (exact), numeric operators, and array contains +- **Negate any condition** with `negate: true` +- **Combines with container tags** - both filters are applied + +<Tabs> + <Tab title="TypeScript"> + ```typescript + const results = await client.search.documents({ + q: "machine learning", + filters: { + AND: [ + { + key: "category", + value: "technology", + negate: false + }, + { + filterType: "numeric", + key: "readingTime", + value: "5", + negate: false, + numericOperator: "<=" + } + ] + }, + limit: 10 + }); + ``` + </Tab> + <Tab title="Python"> + ```python + results = client.search.documents( + q="machine learning", + filters={ + "AND": [ + { + "key": "category", + "value": "technology", + "negate": False + }, + { + "filterType": "numeric", + "key": "readingTime", + "value": "5", + "negate": False, + "numericOperator": "<=" + } + ] + }, + limit=10 + ) + ``` + </Tab> + <Tab title="cURL"> + ```bash + curl -X POST "https://api.supermemory.ai/v3/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "machine learning", + "filters": { + "AND": [ + { + "key": "category", + "value": "technology", + "negate": false + }, + { + "filterType": "numeric", + "key": "readingTime", + "value": "5", + "negate": false, + "numericOperator": "<=" + } + ] + }, + "limit": 10 + }' + ``` + </Tab> +</Tabs> + +**Sample Output:** +```json +{ + "results": [ + { + "documentId": "doc_tech_trends_2024", + "title": "Technology Trends in Machine Learning", + "score": 0.91, + "chunks": [ + { + "content": "Machine learning continues to evolve with new architectures and optimization techniques. Reading time for this comprehensive overview is approximately 8 minutes...", + "score": 0.88, + "isRelevant": true + } + ], + "metadata": { + "category": "technology", + "readingTime": 8, + "difficulty": "intermediate", + "published": true + } + } + ], + "total": 6, + "timing": 189 +} +``` + +## Array Contains Filtering + +When your metadata includes arrays (like participant lists, tags, or categories), use `array_contains` to check if the array includes a specific value. + +<Tabs> + <Tab title="TypeScript"> + ```typescript + const results = await client.search.documents({ + q: "meeting discussion", + filters: { + AND: [ + { + key: "participants", + value: "john.doe", + filterType: "array_contains" + } + ] + }, + limit: 5 + }); + ``` + </Tab> + <Tab title="Python"> + ```python + results = client.search.documents( + q="meeting discussion", + filters={ + "AND": [ + { + "key": "participants", + "value": "john.doe", + "filterType": "array_contains" + } + ] + }, + limit=5 + ) + ``` + </Tab> + <Tab title="cURL"> + ```bash + curl -X POST "https://api.supermemory.ai/v3/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "meeting discussion", + "filters": { + "AND": [ + { + "key": "participants", + "value": "john.doe", + "filterType": "array_contains" + } + ] + }, + "limit": 5 + }' + ``` + </Tab> +</Tabs> + +## Threshold Control + +Control result quality with sensitivity thresholds: + +<Tabs> + <Tab title="TypeScript"> + ```typescript + const results = await client.search.documents({ + q: "artificial intelligence", + documentThreshold: 0.7, // Higher = fewer, more relevant documents + chunkThreshold: 0.8, // Higher = fewer, more relevant chunks + limit: 10 + }); + ``` + </Tab> + <Tab title="Python"> + ```python + results = client.search.documents( + q="artificial intelligence", + document_threshold=0.7, # Higher = fewer, more relevant documents + chunk_threshold=0.8, # Higher = fewer, more relevant chunks + limit=10 + ) + ``` + </Tab> + <Tab title="cURL"> + ```bash + curl -X POST "https://api.supermemory.ai/v3/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "artificial intelligence", + "documentThreshold": 0.7, + "chunkThreshold": 0.8, + "limit": 10 + }' + ``` + </Tab> +</Tabs> + +## Query Rewriting + +Improve search accuracy with automatic query rewriting: + +<Tabs> + <Tab title="TypeScript"> + ```typescript + const results = await client.search.documents({ + q: "What is the capital of France?", + rewriteQuery: true, // +400ms latency but better results + limit: 5 + }); + ``` + </Tab> + <Tab title="Python"> + ```python + results = client.search.documents( + q="What is the capital of France?", + rewrite_query=True, # +400ms latency but better results + limit=5 + ) + ``` + </Tab> + <Tab title="cURL"> + ```bash + curl -X POST "https://api.supermemory.ai/v3/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "What is the capital of France?", + "rewriteQuery": true, + "limit": 5 + }' + ``` + </Tab> +</Tabs> + +<Note> +Query rewriting generates multiple query variations and searches through all of them, then merges results. No additional cost but adds ~400ms latency. +</Note> + +## Reranking + +Improve result quality with secondary ranking: + +<Tabs> + <Tab title="TypeScript"> + ```typescript + const results = await client.search.documents({ + q: "machine learning applications", + rerank: true, // Apply secondary ranking algorithm + limit: 10 + }); + ``` + </Tab> + <Tab title="Python"> + ```python + results = client.search.documents( + q="machine learning applications", + rerank=True, # Apply secondary ranking algorithm + limit=10 + ) + ``` + </Tab> + <Tab title="cURL"> + ```bash + curl -X POST "https://api.supermemory.ai/v3/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "machine learning applications", + "rerank": true, + "limit": 10 + }' + ``` + </Tab> +</Tabs> + +## Document-Specific Search + +Search within a specific large document: + +<Tabs> + <Tab title="TypeScript"> + ```typescript + const results = await client.search.documents({ + q: "neural networks", + docId: "doc_123", // Search only within this document + limit: 10 + }); + ``` + </Tab> + <Tab title="Python"> + ```python + results = client.search.documents( + q="neural networks", + doc_id="doc_123", # Search only within this document + limit=10 + ) + ``` + </Tab> + <Tab title="cURL"> + ```bash + curl -X POST "https://api.supermemory.ai/v3/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "neural networks", + "docId": "doc_123", + "limit": 10 + }' + ``` + </Tab> +</Tabs> + +## Full Context Options + +Include complete document content and summaries: + +<Tabs> + <Tab title="TypeScript"> + ```typescript + const results = await client.search.documents({ + q: "research findings", + includeFullDocs: true, // Include complete document content + includeSummary: true, // Include document summaries + onlyMatchingChunks: false, // Include all chunks, not just matching ones + limit: 5 + }); + ``` + </Tab> + <Tab title="Python"> + ```python + results = client.search.documents( + q="research findings", + include_full_docs=True, # Include complete document content + include_summary=True, # Include document summaries + only_matching_chunks=False, # Include all chunks, not just matching ones + limit=5 + ) + ``` + </Tab> + <Tab title="cURL"> + ```bash + curl -X POST "https://api.supermemory.ai/v3/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "research findings", + "includeFullDocs": true, + "includeSummary": true, + "onlyMatchingChunks": false, + "limit": 5 + }' + ``` + </Tab> +</Tabs> + +## Complete Advanced Example + +Combining all features for maximum control: + +<Tabs> + <Tab title="TypeScript"> + ```typescript + const results = await client.search.documents({ + q: "machine learning performance metrics", + containerTags: ["research_project"], + filters: { + AND: [ + { key: "category", value: "ai", negate: false }, + { key: "status", value: "published", negate: false } + ] + }, + documentThreshold: 0.6, + chunkThreshold: 0.7, + rewriteQuery: true, + rerank: true, + includeFullDocs: false, + includeSummary: true, + onlyMatchingChunks: true, + limit: 10 + }); + ``` + </Tab> + <Tab title="Python"> + ```python + results = client.search.documents( + q="machine learning performance metrics", + container_tags=["research_project"], + filters={ + "AND": [ + {"key": "category", "value": "ai", "negate": False}, + {"key": "status", "value": "published", "negate": False} + ] + }, + document_threshold=0.6, + chunk_threshold=0.7, + rewrite_query=True, + rerank=True, + include_full_docs=False, + include_summary=True, + only_matching_chunks=True, + limit=10 + ) + ``` + </Tab> + <Tab title="cURL"> + ```bash + curl -X POST "https://api.supermemory.ai/v3/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "machine learning performance metrics", + "containerTags": ["research_project"], + "filters": { + "AND": [ + {"key": "category", "value": "ai", "negate": false}, + {"key": "status", "value": "published", "negate": false} + ] + }, + "documentThreshold": 0.6, + "chunkThreshold": 0.7, + "rewriteQuery": true, + "rerank": true, + "includeFullDocs": false, + "includeSummary": true, + "onlyMatchingChunks": true, + "limit": 10 + }' + ``` + </Tab> +</Tabs> diff --git a/apps/docs/search/examples/memory-search.mdx b/apps/docs/search/examples/memory-search.mdx new file mode 100644 index 00000000..e3cfe7d6 --- /dev/null +++ b/apps/docs/search/examples/memory-search.mdx @@ -0,0 +1,472 @@ +--- +title: "Memories Search (/v4/search)" +description: "Minimal-latency search optimized for chatbots and conversational AI" +--- + + +Memories search (`POST /v4/search`) provides minimal-latency search optimized for real-time interactions. This endpoint prioritizes speed over extensive control, making it perfect for chatbots, Q&A systems, and any application where users expect immediate responses. + +## Basic Search + +<Tabs> + <Tab title="TypeScript"> + ```typescript + import Supermemory from 'supermemory'; + + const client = new Supermemory({ + apiKey: process.env.SUPERMEMORY_API_KEY! + }); + + const results = await client.search.memories({ + q: "machine learning applications", + limit: 5 + }); + + console.log(results) + ``` + </Tab> + <Tab title="Python"> + ```python + from supermemory import Supermemory + import os + + client = Supermemory(api_key=os.environ.get("SUPERMEMORY_API_KEY")) + + results = client.search.memories( + q="machine learning applications", + limit=5 + ) + + console.log(results) + ``` + </Tab> + <Tab title="cURL"> + ```bash + curl -X POST "https://api.supermemory.ai/v4/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "machine learning applications", + "limit": 5 + }' + ``` + </Tab> +</Tabs> + +**Sample Output:** +```json +{ + "results": [ + { + "id": "mem_ml_apps_2024", + "memory": "Machine learning applications span numerous industries including healthcare (diagnostic imaging, drug discovery), finance (fraud detection, algorithmic trading), autonomous vehicles (computer vision, path planning), and natural language processing (chatbots, translation services).", + "similarity": 0.92, + "title": "Machine Learning Industry Applications", + "type": "text", + "metadata": { + "topic": "machine-learning", + "industry": "technology", + "created": "2024-01-10" + } + }, + { + "id": "mem_ml_healthcare", + "memory": "In healthcare, machine learning enables early disease detection through medical imaging analysis, personalized treatment recommendations, and drug discovery acceleration by predicting molecular behavior.", + "similarity": 0.89, + "title": "ML in Healthcare", + "type": "text" + } + ], + "total": 8, + "timing": 87 +} +``` + +## Container Tag Filtering + +Filter by user, project, or organization: + +<Tabs> + <Tab title="TypeScript"> + ```typescript + const results = await client.search.memories({ + q: "project updates", + containerTag: "user_123", // Note: singular, not plural + limit: 10 + }); + ``` + </Tab> + <Tab title="Python"> + ```python + results = client.search.memories( + q="project updates", + container_tag="user_123", # Note: singular, not plural + limit=10 + ) + ``` + </Tab> + <Tab title="cURL"> + ```bash + curl -X POST "https://api.supermemory.ai/v4/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "project updates", + "containerTag": "user_123", + "limit": 10 + }' + ``` + </Tab> +</Tabs> + +## Threshold Control + +Control result quality with similarity threshold: + +<Tabs> + <Tab title="TypeScript"> + ```typescript + const results = await client.search.memories({ + q: "artificial intelligence research", + threshold: 0.7, // Higher = fewer, more similar results + limit: 10 + }); + ``` + </Tab> + <Tab title="Python"> + ```python + results = client.search.memories( + q="artificial intelligence research", + threshold=0.7, # Higher = fewer, more similar results + limit=10 + ) + ``` + </Tab> + <Tab title="cURL"> + ```bash + curl -X POST "https://api.supermemory.ai/v4/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "artificial intelligence research", + "threshold": 0.7, + "limit": 10 + }' + ``` + </Tab> +</Tabs> + +## Reranking + +Improve result quality with secondary ranking: + +<Tabs> + <Tab title="TypeScript"> + ```typescript + const results = await client.search.memories({ + q: "quantum computing breakthrough", + rerank: true, // Better relevance, slight latency increase + limit: 5 + }); + ``` + </Tab> + <Tab title="Python"> + ```python + results = client.search.memories( + q="quantum computing breakthrough", + rerank=True, # Better relevance, slight latency increase + limit=5 + ) + ``` + </Tab> + <Tab title="cURL"> + ```bash + curl -X POST "https://api.supermemory.ai/v4/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "quantum computing breakthrough", + "rerank": true, + "limit": 5 + }' + ``` + </Tab> +</Tabs> + +## Query Rewriting + +Improve search accuracy with automatic query expansion: + +<Tabs> + <Tab title="TypeScript"> + ```typescript + const results = await client.search.memories({ + q: "How do neural networks learn?", + rewriteQuery: true, // +400ms latency but better results + limit: 5 + }); + ``` + </Tab> + <Tab title="Python"> + ```python + results = client.search.memories( + q="How do neural networks learn?", + rewrite_query=True, # +400ms latency but better results + limit=5 + ) + ``` + </Tab> + <Tab title="cURL"> + ```bash + curl -X POST "https://api.supermemory.ai/v4/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "How do neural networks learn?", + "rewriteQuery": true, + "limit": 5 + }' + ``` + </Tab> +</Tabs> + +## Include Related Content + +Include documents, related memories, and summaries: + +<Tabs> + <Tab title="TypeScript"> + ```typescript + const results = await client.search.memories({ + q: "machine learning trends", + include: { + documents: true, // Include source documents + relatedMemories: true, // Include related memory entries + summaries: true // Include memory summaries + }, + limit: 5 + }); + ``` + </Tab> + <Tab title="Python"> + ```python + results = client.search.memories( + q="machine learning trends", + include={ + "documents": True, # Include source documents + "relatedMemories": True, # Include related memory entries + "summaries": True # Include memory summaries + }, + limit=5 + ) + ``` + </Tab> + <Tab title="cURL"> + ```bash + curl -X POST "https://api.supermemory.ai/v4/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "machine learning trends", + "include": { + "documents": true, + "relatedMemories": true, + "summaries": true + }, + "limit": 5 + }' + ``` + </Tab> +</Tabs> + +## Metadata Filtering + +Simple metadata filtering for Memories search: + +<Tabs> + <Tab title="TypeScript"> + ```typescript + const results = await client.search.memories({ + q: "research findings", + filters: { + AND: [ + { key: "category", value: "science", negate: false }, + { key: "status", value: "published", negate: false } + ] + }, + limit: 10 + }); + ``` + </Tab> + <Tab title="Python"> + ```python + results = client.search.memories( + q="research findings", + filters={ + "AND": [ + {"key": "category", "value": "science", "negate": False}, + {"key": "status", "value": "published", "negate": False} + ] + }, + limit=10 + ) + ``` + </Tab> + <Tab title="cURL"> + ```bash + curl -X POST "https://api.supermemory.ai/v4/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "research findings", + "filters": { + "AND": [ + {"key": "category", "value": "science", "negate": false}, + {"key": "status", "value": "published", "negate": false} + ] + }, + "limit": 10 + }' + ``` + </Tab> +</Tabs> + +## Chatbot Example + +Optimal configuration for conversational AI: + +<Tabs> + <Tab title="TypeScript"> + ```typescript + // Optimized for chatbot responses + const results = await client.search.memories({ + q: userMessage, + containerTag: userId, + threshold: 0.6, // Balanced relevance + rerank: false, // Skip for speed + rewriteQuery: false, // Skip for speed + limit: 3 // Few, relevant results + }); + + // Quick response for chat + const context = results.results + .map(r => r.memory) + .join('\n\n'); + ``` + </Tab> + <Tab title="Python"> + ```python + # Optimized for chatbot responses + results = client.search.memories( + q=user_message, + container_tag=user_id, + threshold=0.6, # Balanced relevance + rerank=False, # Skip for speed + rewrite_query=False, # Skip for speed + limit=3 # Few, relevant results + ) + + # Quick response for chat + context = '\n\n'.join([r.memory for r in results.results]) + ``` + </Tab> + <Tab title="cURL"> + ```bash + # Optimized for chatbot responses + curl -X POST "https://api.supermemory.ai/v4/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "user question here", + "containerTag": "user_123", + "threshold": 0.6, + "rerank": false, + "rewriteQuery": false, + "limit": 3 + }' + ``` + </Tab> +</Tabs> + +## Complete Memories Search Example + +Combining features for comprehensive results: + +<Tabs> + <Tab title="TypeScript"> + ```typescript + const results = await client.search.memories({ + q: "machine learning model performance", + containerTag: "research_team", + filters: { + AND: [ + { key: "topic", value: "ai", negate: false } + ] + }, + threshold: 0.7, + rerank: true, + rewriteQuery: false, // Skip for speed + include: { + documents: true, + relatedMemories: false, + summaries: true + }, + limit: 5 + }); + ``` + </Tab> + <Tab title="Python"> + ```python + results = client.search.memories( + q="machine learning model performance", + container_tag="research_team", + filters={ + "AND": [ + {"key": "topic", "value": "ai", "negate": False} + ] + }, + threshold=0.7, + rerank=True, + rewrite_query=False, # Skip for speed + include={ + "documents": True, + "relatedMemories": False, + "summaries": True + }, + limit=5 + ) + ``` + </Tab> + <Tab title="cURL"> + ```bash + curl -X POST "https://api.supermemory.ai/v4/search" \ + -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "q": "machine learning model performance", + "containerTag": "research_team", + "filters": { + "AND": [ + {"key": "topic", "value": "ai", "negate": false} + ] + }, + "threshold": 0.7, + "rerank": true, + "rewriteQuery": false, + "include": { + "documents": true, + "relatedMemories": false, + "summaries": true + }, + "limit": 5 + }' + ``` + </Tab> +</Tabs> + +## Comon Use Cases + +- **Chatbots**: Basic search with container tag and low threshold +- **Q&A Systems**: Add reranking for better relevance +- **Knowledge Retrieval**: Include documents and summaries +- **Real-time Search**: Skip rewriting and reranking for maximum speed |