From 2de9ae3ca0632990e8bee6c2619c9d189c1b5209 Mon Sep 17 00:00:00 2001 From: Scott Mountenay Date: Thu, 12 Sep 2024 14:05:44 -0600 Subject: [PATCH] [GDrive] Update README to document caching option --- gdrive/README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/gdrive/README.md b/gdrive/README.md index 167f88478..5a55efffb 100644 --- a/gdrive/README.md +++ b/gdrive/README.md @@ -81,6 +81,25 @@ This connector also supports a few optional environment variables to configure t 1. `GDRIVE_SEARCH_LIMIT` - Number of results to return. Default is 10. 2. `GDRIVE_FOLDER_ID` - ID of the folder to search in. If not provided, the search will be performed in the whole drive. +## Caching + +This connector has an optional caching feature, which will cache the documents it downloads from Google Drive. This +will prevent the same documents from being downloaded repeatedly when a user continues a conversation on the same +topic, or multiple users are asking questions related to the same documents. + +By default, the caching feature is not enabled. To enable it, set the env var `GDRIVE_CACHE_TYPE` to either: + +* `memory` - to cache the documents in the Python process itself using TTLCache from cachetools. +* `redis` - to cache the documents in Redis. + +When using caching, the following env vars are also available: + +* `GDRIVE_REDIS_HOST` - Redis host to connect to +* `GDRIVE_REDIS_PORT` - Redis port to connect to +* `GDRIVE_REDIS_DB` - Redis database number to connect to +* `GDRIVE_CACHE_MAXSIZE` - Maximum number of documents to store in the TTL cache when using TTL cache +* `GDRIVE_CACHE_EXPIRE_TIME` - The number of seconds to cache documents for, with either Redis or TTL cache + ## Development Create a virtual environment and install dependencies with poetry. We recommend using in-project virtual environments: