Cache
The cache functionality in DataBridge allows you to create and manage specialized caches for efficient querying of your documents.
POST
Create Cache
POST
Create CacheCreate a new cache with specified configuration. The cache can be created using metadata filters, specific document IDs, or both.
Parameters:
name
: Name of the cache to createmodel
: Name of the model to use (e.g. "llama2")gguf_file
: Name of the GGUF file to use for the modelfilters
: Optional metadata filters to determine which documents to includedocs
: Optional list of specific document IDs to include
Returns: Cache configuration object with success status.
Response:
GET
Get Cache
GET
Get CacheGet cache configuration by name.
Parameters:
name
: Name of the cache to retrieve
Returns: Cache existence status.
Response:
POST
Update Cache
POST
Update CacheUpdate cache with new documents matching its filter.
Parameters:
name
: Name of the cache to update
Returns: Success status of the update operation.
Response:
POST
Add Documents to Cache
POST
Add Documents to CacheAdd specific documents to an existing cache.
Parameters:
name
: Name of the cachedocs
: List of document IDs to add
Returns: Success status of the add operation.
Response:
POST
Query Cache
POST
Query CacheQuery the cache with a prompt to generate a completion.
Parameters:
name
: Name of the cachequery
: Query textmax_tokens
: Optional maximum number of tokens to generatetemperature
: Optional temperature parameter for controlling randomness
Returns: Completion response with generated text.
Response:
Best Practices
Cache Naming: Use descriptive names for your caches that reflect their content or purpose
Document Organization: Use consistent metadata when ingesting documents to make filtering easier
Cache Updates: Regularly update your caches if you frequently add new documents
Query Parameters:
Use lower temperature (0.0-0.3) for more focused, deterministic responses
Use higher temperature (0.7-1.0) for more creative responses
Adjust max_tokens based on your needed response length
Error Handling
Always wrap cache operations in try-except blocks in production code:
Last updated