Rememberizer Docs
Sign inSign upContact us
English
English
  • Why Rememberizer?
  • Background
    • What are Vector Embeddings and Vector Databases?
    • Glossary
    • Standardized Terminology
  • Personal Use
    • Getting Started
      • Search your knowledge
      • Mementos Filter Access
      • Common knowledge
      • Manage your embedded knowledge
  • Integrations
    • Rememberizer App
    • Rememberizer Slack integration
    • Rememberizer Google Drive integration
    • Rememberizer Dropbox integration
    • Rememberizer Gmail integration
    • Rememberizer Memory integration
    • Rememberizer MCP Servers
    • Manage third-party apps
  • Developer Resources
    • Developer Overview
  • Integration Options
    • Registering and using API Keys
    • Registering Rememberizer apps
    • Authorizing Rememberizer apps
    • Creating a Rememberizer GPT
    • LangChain integration
    • Vector Stores
    • Talk-to-Slack the Sample Web App
  • Enterprise Integration
    • Enterprise Integration Patterns
  • API Reference
    • API Documentation Home
    • Authentication
  • Core APIs
    • Search for documents by semantic similarity
    • Retrieve documents
    • Retrieve document contents
    • Retrieve Slack content
    • Memorize content to Rememberizer
  • Account & Configuration
    • Retrieve current user account details
    • List available data source integrations
    • Mementos
    • Get all added public knowledge
  • Vector Store APIs
    • Vector Store Documentation
    • Get vector store information
    • Get a list of documents in a Vector Store
    • Get document information
    • Add new text document to a Vector Store
    • Upload files to a Vector Store
    • Update file content in a Vector Store
    • Remove a document in Vector Store
    • Search for Vector Store documents by semantic similarity
  • Additional Resources
    • Notices
      • Terms of Use
      • Privacy Policy
      • B2B
        • About Reddit Agent
  • Releases
    • Release Notes Home
  • 2025 Releases
    • Apr 25th, 2025
    • Apr 18th, 2025
    • Apr 11th, 2025
    • Apr 4th, 2025
    • Mar 28th, 2025
    • Mar 21st, 2025
    • Mar 14th, 2025
    • Jan 17th, 2025
  • 2024 Releases
    • Dec 27th, 2024
    • Dec 20th, 2024
    • Dec 13th, 2024
    • Dec 6th, 2024
  • Nov 29th, 2024
  • Nov 22nd, 2024
  • Nov 15th, 2024
  • Nov 8th, 2024
  • Nov 1st, 2024
  • Oct 25th, 2024
  • Oct 18th, 2024
  • Oct 11th, 2024
  • Oct 4th, 2024
  • Sep 27th, 2024
  • Sep 20th, 2024
  • Sep 13th, 2024
  • Aug 16th, 2024
  • Aug 9th, 2024
  • Aug 2nd, 2024
  • Jul 26th, 2024
  • Jul 12th, 2024
  • Jun 28th, 2024
  • Jun 14th, 2024
  • May 31st, 2024
  • May 17th, 2024
  • May 10th, 2024
  • Apr 26th, 2024
  • Apr 19th, 2024
  • Apr 12th, 2024
  • Apr 5th, 2024
  • Mar 25th, 2024
  • Mar 18th, 2024
  • Mar 11th, 2024
  • Mar 4th, 2024
  • Feb 26th, 2024
  • Feb 19th, 2024
  • Feb 12th, 2024
  • Feb 5th, 2024
  • Jan 29th, 2024
  • Jan 22nd, 2024
  • Jan 15th, 2024
  • LLM Documentation
    • Rememberizer LLM Ready Documentation
Powered by GitBook
On this page
  1. Vector Store APIs

Search for Vector Store documents by semantic similarity

Search Vector Store documents with semantic similarity and batch operations

PreviousRemove a document in Vector StoreNextNotices

Last updated 1 month ago

Example Requests

curl -X GET \
  "https://api.rememberizer.ai/api/v1/vector-stores/vs_abc123/documents/search?q=How%20to%20integrate%20our%20product%20with%20third-party%20systems&n=5&prev_chunks=1&next_chunks=1" \
  -H "x-api-key: YOUR_API_KEY"

Replace YOUR_API_KEY with your actual Vector Store API key and vs_abc123 with your Vector Store ID.

const searchVectorStore = async (vectorStoreId, query, numResults = 5, prevChunks = 1, nextChunks = 1) => {
  const url = new URL(`https://api.rememberizer.ai/api/v1/vector-stores/${vectorStoreId}/documents/search`);
  url.searchParams.append('q', query);
  url.searchParams.append('n', numResults);
  url.searchParams.append('prev_chunks', prevChunks);
  url.searchParams.append('next_chunks', nextChunks);
  
  const response = await fetch(url.toString(), {
    method: 'GET',
    headers: {
      'x-api-key': 'YOUR_API_KEY'
    }
  });
  
  const data = await response.json();
  console.log(data);
};

searchVectorStore(
  'vs_abc123',
  'How to integrate our product with third-party systems',
  5,
  1,
  1
);

Replace YOUR_API_KEY with your actual Vector Store API key and vs_abc123 with your Vector Store ID.

import requests

def search_vector_store(vector_store_id, query, num_results=5, prev_chunks=1, next_chunks=1):
    headers = {
        "x-api-key": "YOUR_API_KEY"
    }
    
    params = {
        "q": query,
        "n": num_results,
        "prev_chunks": prev_chunks,
        "next_chunks": next_chunks
    }
    
    response = requests.get(
        f"https://api.rememberizer.ai/api/v1/vector-stores/{vector_store_id}/documents/search",
        headers=headers,
        params=params
    )
    
    data = response.json()
    print(data)

search_vector_store(
    'vs_abc123',
    'How to integrate our product with third-party systems',
    5,
    1,
    1
)

Replace YOUR_API_KEY with your actual Vector Store API key and vs_abc123 with your Vector Store ID.

require 'net/http'
require 'uri'
require 'json'

def search_vector_store(vector_store_id, query, num_results=5, prev_chunks=1, next_chunks=1)
  uri = URI("https://api.rememberizer.ai/api/v1/vector-stores/#{vector_store_id}/documents/search")
  params = {
    q: query,
    n: num_results,
    prev_chunks: prev_chunks,
    next_chunks: next_chunks
  }
  
  uri.query = URI.encode_www_form(params)
  
  request = Net::HTTP::Get.new(uri)
  request['x-api-key'] = 'YOUR_API_KEY'
  
  http = Net::HTTP.new(uri.host, uri.port)
  http.use_ssl = true
  
  response = http.request(request)
  data = JSON.parse(response.body)
  puts data
end

search_vector_store(
  'vs_abc123',
  'How to integrate our product with third-party systems',
  5,
  1,
  1
)

Replace YOUR_API_KEY with your actual Vector Store API key and vs_abc123 with your Vector Store ID.

Path Parameters

Parameter
Type
Description

vector-store-id

string

Required. The ID of the vector store to search in.

Query Parameters

Parameter
Type
Description

q

string

Required. The search query text.

n

integer

Number of results to return. Default: 10.

t

number

Matching threshold. Default: 0.7.

prev_chunks

integer

Number of chunks before the matched chunk to include. Default: 0.

next_chunks

integer

Number of chunks after the matched chunk to include. Default: 0.

Response Format

{
  "vector_store": {
    "id": "vs_abc123",
    "name": "Product Documentation"
  },
  "matched_chunks": [
    {
      "document": {
        "id": 1234,
        "name": "Integration Guide.pdf",
        "type": "application/pdf",
        "size": 250000,
        "indexed_on": "2023-06-15T10:30:00Z",
        "vector_store": "vs_abc123",
        "created": "2023-06-15T10:15:00Z",
        "modified": "2023-06-15T10:30:00Z"
      },
      "matched_content": "Our product offers several integration options for third-party systems. The primary method is through our RESTful API, which supports OAuth2 authentication. Additionally, you can use our SDK available in Python, JavaScript, and Java.",
      "distance": 0.123
    },
    // ... more matched chunks
  ]
}

Authentication

This endpoint requires authentication using an API key in the x-api-key header.

Error Responses

Status Code
Description

400

Bad Request - Missing required parameters or invalid format

401

Unauthorized - Invalid or missing API key

404

Not Found - Vector Store not found

500

Internal Server Error

Search Optimization Tips

Context Windows

Use the prev_chunks and next_chunks parameters to control how much context is included with each match:

  • Set both to 0 for precise matches without context

  • Set both to 1-2 for matches with minimal context

  • Set both to 3-5 for matches with substantial context

Matching Threshold

The t parameter controls how strictly matches are filtered:

  • Higher values (e.g., 0.9) return only very close matches

  • Lower values (e.g., 0.5) return more matches with greater variety

  • The default (0.7) provides a balanced approach

Batch Operations

For high-throughput applications, Rememberizer supports efficient batch operations on vector stores. These methods optimize performance when processing multiple search queries.

Batch Search Implementation

import requests
import time
import concurrent.futures

def batch_search_vector_store(vector_store_id, queries, num_results=5, batch_size=10):
    """
    Perform batch searches against a vector store
    
    Args:
        vector_store_id: ID of the vector store to search
        queries: List of search query strings
        num_results: Number of results per query
        batch_size: Number of parallel requests
        
    Returns:
        List of search results
    """
    headers = {
        "x-api-key": "YOUR_API_KEY"
    }
    
    results = []
    
    # Process in batches to avoid overwhelming the API
    for i in range(0, len(queries), batch_size):
        batch_queries = queries[i:i+batch_size]
        
        with concurrent.futures.ThreadPoolExecutor(max_workers=batch_size) as executor:
            futures = []
            
            for query in batch_queries:
                params = {
                    "q": query,
                    "n": num_results,
                    "prev_chunks": 1,
                    "next_chunks": 1
                }
                
                # Submit the request to the thread pool
                future = executor.submit(
                    requests.get,
                    f"https://api.rememberizer.ai/api/v1/vector-stores/{vector_store_id}/documents/search",
                    headers=headers,
                    params=params
                )
                futures.append(future)
            
            # Collect results from all futures
            for future in futures:
                response = future.result()
                if response.status_code == 200:
                    results.append(response.json())
                else:
                    results.append({"error": f"Failed with status code: {response.status_code}"})
        
        # Add a delay between batches to avoid rate limiting
        if i + batch_size < len(queries):
            time.sleep(1)
    
    return results

# Example usage
queries = [
    "Integration with REST APIs",
    "Authentication protocols",
    "How to deploy to production",
    "Performance optimization techniques",
    "Error handling best practices"
]

search_results = batch_search_vector_store("vs_abc123", queries, num_results=3, batch_size=5)
/**
 * Perform batch searches against a vector store
 * 
 * @param {string} vectorStoreId - ID of the vector store
 * @param {string[]} queries - List of search queries
 * @param {Object} options - Configuration options
 * @returns {Promise<Array>} - List of search results
 */
async function batchSearchVectorStore(vectorStoreId, queries, options = {}) {
  const {
    numResults = 5,
    batchSize = 10,
    delayBetweenBatches = 1000,
    prevChunks = 1,
    nextChunks = 1,
    distanceThreshold = 0.7
  } = options;
  
  const results = [];
  const apiKey = 'YOUR_API_KEY';
  
  // Process in batches to manage API load
  for (let i = 0; i < queries.length; i += batchSize) {
    const batchQueries = queries.slice(i, i + batchSize);
    
    // Create promise array for parallel requests
    const batchPromises = batchQueries.map(query => {
      const url = new URL(`https://api.rememberizer.ai/api/v1/vector-stores/${vectorStoreId}/documents/search`);
      url.searchParams.append('q', query);
      url.searchParams.append('n', numResults);
      url.searchParams.append('prev_chunks', prevChunks);
      url.searchParams.append('next_chunks', nextChunks);
      url.searchParams.append('t', distanceThreshold);
      
      return fetch(url.toString(), {
        method: 'GET',
        headers: {
          'x-api-key': apiKey
        }
      })
      .then(response => {
        if (response.ok) {
          return response.json();
        } else {
          return { error: `Failed with status: ${response.status}` };
        }
      })
      .catch(error => {
        return { error: error.message };
      });
    });
    
    // Wait for all requests in batch to complete
    const batchResults = await Promise.all(batchPromises);
    results.push(...batchResults);
    
    // Add delay between batches to avoid rate limiting
    if (i + batchSize < queries.length) {
      await new Promise(resolve => setTimeout(resolve, delayBetweenBatches));
    }
  }
  
  return results;
}

// Example usage
const queries = [
  "Integration with REST APIs",
  "Authentication protocols",
  "How to deploy to production",
  "Performance optimization techniques",
  "Error handling best practices"
];

const options = {
  numResults: 3,
  batchSize: 5,
  delayBetweenBatches: 1000,
  prevChunks: 1,
  nextChunks: 1
};

batchSearchVectorStore("vs_abc123", queries, options)
  .then(results => console.log(results))
  .catch(error => console.error("Batch search failed:", error));
require 'net/http'
require 'uri'
require 'json'
require 'concurrent'

# Perform batch searches against a vector store
#
# @param vector_store_id [String] ID of the vector store
# @param queries [Array<String>] List of search queries
# @param num_results [Integer] Number of results per query
# @param batch_size [Integer] Number of parallel requests
# @param delay_between_batches [Float] Seconds to wait between batches
# @return [Array] Search results for each query
def batch_search_vector_store(vector_store_id, queries, num_results: 5, batch_size: 10, delay_between_batches: 1.0)
  results = []
  api_key = 'YOUR_API_KEY'
  
  # Process in batches
  queries.each_slice(batch_size).with_index do |batch_queries, batch_index|
    # Create a thread pool for concurrent execution
    pool = Concurrent::FixedThreadPool.new(batch_size)
    futures = []
    
    batch_queries.each do |query|
      # Submit each request to thread pool
      futures << Concurrent::Future.execute(executor: pool) do
        uri = URI("https://api.rememberizer.ai/api/v1/vector-stores/#{vector_store_id}/documents/search")
        params = {
          q: query,
          n: num_results,
          prev_chunks: 1,
          next_chunks: 1
        }
        
        uri.query = URI.encode_www_form(params)
        
        request = Net::HTTP::Get.new(uri)
        request['x-api-key'] = api_key
        
        http = Net::HTTP.new(uri.host, uri.port)
        http.use_ssl = true
        
        begin
          response = http.request(request)
          
          if response.code.to_i == 200
            JSON.parse(response.body)
          else
            { "error" => "Failed with status code: #{response.code}" }
          end
        rescue => e
          { "error" => e.message }
        end
      end
    end
    
    # Collect results from all futures
    batch_results = futures.map(&:value)
    results.concat(batch_results)
    
    # Add delay between batches
    if batch_index < (queries.length / batch_size.to_f).ceil - 1
      sleep(delay_between_batches)
    end
  end
  
  pool.shutdown
  results
end

# Example usage
queries = [
  "Integration with REST APIs",
  "Authentication protocols",
  "How to deploy to production", 
  "Performance optimization techniques",
  "Error handling best practices"
]

results = batch_search_vector_store(
  "vs_abc123", 
  queries, 
  num_results: 3, 
  batch_size: 5
)

puts results

Performance Optimization for Batch Operations

When implementing batch operations for vector store searches, consider these best practices:

  1. Optimal Batch Sizing: For most applications, processing 5-10 queries in parallel provides a good balance between throughput and resource usage.

  2. Rate Limiting Awareness: Include delay mechanisms between batches (typically 1-2 seconds) to avoid hitting API rate limits.

  3. Error Handling: Implement robust error handling for individual queries that may fail within a batch.

  4. Connection Management: For high-volume applications, implement connection pooling to reduce overhead.

  5. Timeout Configuration: Set appropriate timeouts for each request to prevent long-running queries from blocking the entire batch.

  6. Result Processing: Consider processing results asynchronously as they become available rather than waiting for all results.

  7. Monitoring: Track performance metrics like average response time and success rates to identify optimization opportunities.

For production applications with very high query volumes, consider implementing a queue system with worker processes to manage large batches efficiently.

This endpoint allows you to search your vector store using semantic similarity. It returns documents that are conceptually related to your query, even if they don't contain the exact keywords. This makes it particularly powerful for natural language queries and question answering.

get

Initiate a search operation with a query text and receive most semantically similar responses from the vector store.

Path parameters
vector-store-idstringRequired

The ID of the vector store.

Query parameters
qstringRequired

The search query text.

nintegerOptional

Number of chunks to return.

tnumberOptional

Matching threshold.

prev_chunksintegerOptional

Number of chunks before the matched chunk to include.

next_chunksintegerOptional

Number of chunks after the matched chunk to include.

Header parameters
x-api-keystringRequired

The API key for authentication.

Responses
200
Search results retrieved successfully.
application/json
get
GET /api/v1/vector-stores/{vector-store-id}/documents/search HTTP/1.1
Host: api.rememberizer.ai
x-api-key: text
Accept: */*
200

Search results retrieved successfully.

{
  "vector_store": {
    "id": "text",
    "name": "text"
  },
  "matched_chunks": [
    {
      "document": {
        "id": 1,
        "name": "text",
        "type": "text",
        "size": 1,
        "indexed_on": "2025-05-24T06:02:44.297Z",
        "vector_store": "text",
        "created": "2025-05-24T06:02:44.297Z",
        "modified": "2025-05-24T06:02:44.297Z"
      },
      "matched_content": "text",
      "distance": 1
    }
  ]
}
  • GET/vector-stores/{vector-store-id}/documents/search
  • Example Requests
  • Path Parameters
  • Query Parameters
  • Response Format
  • Authentication
  • Error Responses
  • Search Optimization Tips
  • Context Windows
  • Matching Threshold
  • Batch Operations
  • Batch Search Implementation
  • Performance Optimization for Batch Operations