forked from langchain-ai/langchain
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CassandraCache and CassandraSemanticCache can handle any "Generation" (…
…langchain-ai#10563) Hello, this PR improves coverage for caching by the two Cassandra-related caches (i.e. exact-match and semantic alike) by switching to the more general `dumps`/`loads` serdes utilities. This enables cache usage within e.g. `ChatOpenAI` contexts (which need to store lists of `ChatGeneration` instead of `Generation`s), which was not possible as long as the cache classes were relying on the legacy `_dump_generations_to_json` and `_load_generations_from_json`). Additionally, a slightly different init signature is introduced for the cache objects: - named parameters required for init, to pave the way for easier changes in the future connect-to-db flow (and tests adjusted accordingly) - added a `skip_provisioning` optional passthrough parameter for use cases where the user knows the underlying DB table, etc already exist. Thank you for a review!
- Loading branch information
1 parent
e1e01d6
commit 49b65a1
Showing
2 changed files
with
96 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters