From 3e55be910bfd371afa5e41317709368091a61d5f Mon Sep 17 00:00:00 2001 From: fadingNA Date: Sat, 12 Oct 2024 10:47:33 -0400 Subject: [PATCH] hashlib helper to gen cachekey --- application/utils.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/application/utils.py b/application/utils.py index f0802c39..1fc9e329 100644 --- a/application/utils.py +++ b/application/utils.py @@ -1,6 +1,8 @@ import tiktoken +import hashlib from flask import jsonify, make_response + _encoding = None @@ -39,3 +41,8 @@ def check_required_fields(data, required_fields): 400, ) return None + + +def get_hash(data): + return hashlib.md5(data.encode()).hexdigest() +