Created
January 19, 2026 20:34
-
-
Save lovemycodesnippets/58763386c2341193e61f44cf4eb45230 to your computer and use it in GitHub Desktop.
How to Build Production-Ready AI Agents with RAG and FastAPI
This file contains hidden or 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
| # cache.py | |
| from hashlib import sha256 | |
| CACHE = {} | |
| def cache_key(query: str, doc_ids: list[str]) -> str: | |
| return sha256(("||".join([query] + doc_ids)).encode()).hexdigest() | |
| def get_cache(key: str): return CACHE.get(key) | |
| def set_cache(key: str, val: dict): CACHE[key] = val |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment