redis cache

This commit is contained in:
Jonas Braus
2024-12-12 13:05:21 +01:00
parent ac420df1c7
commit 948210d73c
3 changed files with 27 additions and 2 deletions
+4 -1
View File
@@ -10,6 +10,7 @@ from PIL import Image
from aiohttp.web_response import json_response
import ollama_conn
import redis_conn
def read_files(path, output, filetypes=None):
@@ -91,7 +92,9 @@ def prompt_embedding(prompt):
res = get_data_from_mongo(new_result)
print(ollama_conn.ask_ollama(prompt, res))
ollama_response = ollama_conn.ask_ollama(prompt, res)
print(ollama_response)
redis_conn.cache_prompt_to_redis(prompt.lower().strip(), ollama_response)
conn.close()