Skip to content

Commit

Permalink
Independent operator level cache + doc update
Browse files Browse the repository at this point in the history
  • Loading branch information
StanChan03 committed Jan 10, 2025
1 parent 9761855 commit ab85361
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion docs/configurations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,18 @@ Configurable Parameters
1. enable_message_cache:
* Description: Enables or Disables cahcing mechanisms
* Default: False
* Parameters:
- cache_type: Type of caching (SQLITE or In_MEMORY)
- max_size: maximum size of cache
- cache_dir: Directory for where DB file is stored. Default: "~/.lotus/cache"
* Note: It is recommended to enable operator level caching
.. code-block:: python
lotus.settings.configure(enable_message_cache=True)
cache_config = CacheConfig(cache_type=CacheType.SQLITE, max_size=1000)
cache = CacheFactory.create_cache(cache_config)
lm = LM(model='gpt-4o-mini', cache=cache)
lotus.settings.configure(lm=lm, enable_operator_cache=True)
2. setting RM:
* Description: Configures the retrieval model
Expand Down
2 changes: 1 addition & 1 deletion lotus/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def require_cache_enabled(func: Callable) -> Callable:

@wraps(func)
def wrapper(self, *args, **kwargs):
if not lotus.settings.enable_message_cache:
if not lotus.settings.enable_message_cache and not lotus.settings.enable_operator_cache:
return None
return func(self, *args, **kwargs)

Expand Down

0 comments on commit ab85361

Please sign in to comment.