| title | create_cache |
|---|---|
| description | Create a new cache with specified configuration |
name(str): Name of the cache to createmodel(str): Name of the model to use (e.g. "llama2")gguf_file(str): Name of the GGUF file to use for the modelfilters(Dict[str, Any], optional): Optional metadata filters to determine which documents to include. These filters will be applied in addition to any specific docs provided.docs(List[str], optional): Optional list of specific document IDs to include. These docs will be included in addition to any documents matching the filters.
Dict[str, Any]: Created cache configuration
db = Morphik()
# This will include both:
# 1. Any documents with category="programming"
# 2. The specific documents "doc1" and "doc2" (regardless of their category)
cache = db.create_cache(
name="programming_cache",
model="llama2",
gguf_file="llama-2-7b-chat.Q4_K_M.gguf",
filters={"category": "programming"},
docs=["doc1", "doc2"]
)
```
async with AsyncMorphik() as db:
# This will include both:
# 1. Any documents with category="programming"
# 2. The specific documents "doc1" and "doc2" (regardless of their category)
cache = await db.create_cache(
name="programming_cache",
model="llama2",
gguf_file="llama-2-7b-chat.Q4_K_M.gguf",
filters={"category": "programming"},
docs=["doc1", "doc2"]
)
```
After creating a cache, you can interact with it using the get_cache method, which returns a Cache object that provides methods for querying and updating the cache.