Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow clearing cache and fix gptcache #3493

Merged
merged 4 commits into from
Apr 27, 2023
Merged

Allow clearing cache and fix gptcache #3493

merged 4 commits into from
Apr 27, 2023

Conversation

ehsanmok
Copy link
Contributor

This PR

  • Adds clear method for BaseCache and implements it for various caches
  • Adds the default init_func=None and fixes gptcache integtest
  • Since right now integtest is not running in CI, I've verified the changes by running docs/modules/models/llms/examples/llm_caching.ipynb (until proper e2e integtest is done in CI)

@@ -235,4 +235,5 @@ def save_context(self, inputs: Dict[str, Any], outputs: Dict[str, str]) -> None:
def clear(self) -> None:
"""Clear memory contents."""
self.chat_memory.clear()
self.entity_cache.clear()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

entity_cache is a List[str] right? this shouldnt work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I misunderstanding anything? clear is a valid method on list in python.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mind blown i didnt actually know that

Copy link
Contributor

@hwchase17 hwchase17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@hwchase17 hwchase17 merged commit 4a246e2 into langchain-ai:master Apr 27, 2023
@ehsanmok ehsanmok deleted the fix-cache branch April 27, 2023 12:55
vowelparrot pushed a commit that referenced this pull request Apr 28, 2023
This PR

* Adds `clear` method for `BaseCache` and implements it for various
caches
* Adds the default `init_func=None` and fixes gptcache integtest
* Since right now integtest is not running in CI, I've verified the
changes by running `docs/modules/models/llms/examples/llm_caching.ipynb`
(until proper e2e integtest is done in CI)
samching pushed a commit to samching/langchain that referenced this pull request May 1, 2023
This PR

* Adds `clear` method for `BaseCache` and implements it for various
caches
* Adds the default `init_func=None` and fixes gptcache integtest
* Since right now integtest is not running in CI, I've verified the
changes by running `docs/modules/models/llms/examples/llm_caching.ipynb`
(until proper e2e integtest is done in CI)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants