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

adds filter fields to cache key name hash #224

Merged
merged 3 commits into from
Sep 30, 2024

Conversation

justin-cechmanek
Copy link
Collaborator

This PR aims to prevent cache entries being overwritten when the exact same prompt string is used, but other cache entry data - like user id, or some other field - is different.

"""Create a secure hash of some arbitrary input text."""
def hashify(content: str, extras: Optional[Dict[str, Any]] = None) -> str:
"""Create a secure hash of some arbitrary input text and optional dictionary."""
if extras:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Small preference here to keep hashify dumb and move the filter string processing logic for this to within the generate_id method and pass the final string to hashify.

Copy link
Collaborator

@tylerhutcherson tylerhutcherson left a comment

Choose a reason for hiding this comment

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

LGTM! one small note, but good to go when you're ready. Once merged, can you close out that issue and follow up internally too?

@justin-cechmanek justin-cechmanek marked this pull request as ready for review September 30, 2024 20:12
@justin-cechmanek justin-cechmanek merged commit f808b80 into main Sep 30, 2024
20 checks passed
@justin-cechmanek justin-cechmanek deleted the bugfix/RAAE-299/cache-key-name branch September 30, 2024 20:48
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.

SemanticCache with filterable_fields - consider extra metadata for creating the cache entry key
3 participants