From b292e76fae98e4deb437fbae93625550e77cbf64 Mon Sep 17 00:00:00 2001 From: Fraser Date: Sat, 8 Jul 2023 15:36:14 -0400 Subject: [PATCH] fix logging times --- api/chat.py | 2 +- api/get_blocks.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api/chat.py b/api/chat.py index 03a2f53..ff634c9 100644 --- a/api/chat.py +++ b/api/chat.py @@ -154,7 +154,7 @@ def talk_to_robot_internal(index, query: str, history: List[Dict[str, str]], k: t2 = time.time() - print("Time to get response: ", t2 - t1, " s") + print(f'Time to get response: {t2-t1:.2f}s') if DEBUG_PRINT: print('\n' * 10) diff --git a/api/get_blocks.py b/api/get_blocks.py index b1015b8..131f140 100644 --- a/api/get_blocks.py +++ b/api/get_blocks.py @@ -76,7 +76,7 @@ def get_top_k_blocks(index, user_query: str, k: int) -> List[Block]: query_embedding = get_embedding(user_query) t1 = time.time() - print("Time to get embedding: ", t1 - t) + print(f'Time to get embedding: {t1-t:.2f}s') query_response = index.query( namespace="alignment-search", # ugly, sorry @@ -103,7 +103,7 @@ def get_top_k_blocks(index, user_query: str, k: int) -> List[Block]: t2 = time.time() - print("Time to get top-k blocks: ", t2 - t1) + print(f'Time to get top-k blocks: {t2-t1:.2f}s') # for all blocks that are "the same" (same title, author, date, url, tags), # combine their text with "....." in between. Return them in order such