File size: 353 Bytes
06696b5
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from utils.cache import get_cached_response

def check_cache(state):
    query = state.query
    top_k = getattr(state, "top_k", 5)
    cached = get_cached_response(query, top_k)

    if cached:
        return state.copy(update={
            "cached_response": cached,
            "final_response": cached
        })
    
    return state