----------------------
I'm sorry for the confusion, but the provided knowledge sources do not contain specific information on how to use caching with Qdrant in LlamaIndex. However, I can provide general information on how caching is used in LlamaIndex based on the available knowledge sources.
In LlamaIndex, each node + transformation combination is hashed and cached. This saves time on subsequent runs that use the same data. Here's an example of how to use caching in LlamaIndex:
# save
pipeline.persist("./pipeline_storage")
# load and restore state
new_pipeline = IngestionPipeline(
transformations=[
SentenceSplitter(chunk_size=25, chunk_overlap=0),
TitleExtractor(),
],
)
new_pipeline.load("./pipeline_storage")
# will run instantly due to the cache
nodes = pipeline.run(documents=[Document.example()])
If the cache becomes too large, you can clear it:
# delete all context of the cache
cache.clear()
LlamaIndex supports multiple remote storage backends for caches, including
RedisCache
,
MongoDBCache
, and
FirestoreCache
. Here's an example of using
RedisCache
:
pipeline = IngestionPipeline(
transformations=[
SentenceSplitter(chunk_size=25, chunk_overlap=0),
TitleExtractor(),
OpenAIEmbedding(),
],
cache=IngestionCache(
cache=RedisCache(
redis_uri="redis://127.0.0.1:6379", collection="test_cache"
)
),
)
# Ingest directly into a vector db
nodes = pipeline.run(documents=[Document.example()])
In this example, no persist step is needed, since everything is cached as you go in the specified remote collection.
For more specific information on how to use caching with Qdrant in LlamaIndex, I recommend checking the official LlamaIndex documentation or the Qdrant documentation.