Skip to content

Commit

Permalink
Update cache behaviour in function docstring (#994)
Browse files Browse the repository at this point in the history
* Update the cache behaviour in function documentation

* Add logger.warning for using legacy default cache seed

* Alter cache logger message

* Update cache logger
  • Loading branch information
kumaranvpl authored Feb 17, 2025
1 parent 50f5c2d commit a5fc006
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion autogen/oai/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,8 @@ def create(self, **config: Any) -> ModelClient.ModelClientResponseProtocol:
- cache (AbstractCache | None): A Cache object to use for response cache. Default to None.
Note that the cache argument overrides the legacy cache_seed argument: if this argument is provided,
then the cache_seed argument is ignored. If this argument is not provided or None,
then the cache_seed argument is used.
then the cache_seed argument is used. If both cache and cache_seed are None,
then LEGACY_DEFAULT_CACHE_SEED is used as the cache_seed.
- agent (AbstractAgent | None): The object responsible for creating a completion if an agent.
- (Legacy) cache_seed (int | None) for using the DiskCache. Default to 41.
An integer cache_seed is useful when implementing "controlled randomness" for the completion.
Expand Down Expand Up @@ -969,6 +970,7 @@ def yes_or_no_filter(context, response):
elif cache_seed is not None:
# Legacy cache behavior, if cache_seed is given, use DiskCache.
cache_client = Cache.disk(cache_seed, LEGACY_CACHE_DIR)
logger.info(f"Using cache with seed value: {cache if cache is not None else cache_seed}")

if cache_client is not None:
with cache_client as cache:
Expand Down

0 comments on commit a5fc006

Please sign in to comment.