From 52eb020256c587ccea546a7d4c2ab3600707ec54 Mon Sep 17 00:00:00 2001 From: ivan-ontruck Date: Sun, 11 Jun 2023 21:16:17 +0200 Subject: [PATCH] Add inference time to output --- privateGPT.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/privateGPT.py b/privateGPT.py index 4c98d83..bd03d07 100755 --- a/privateGPT.py +++ b/privateGPT.py @@ -7,6 +7,7 @@ from langchain.vectorstores import Chroma from langchain.llms import GPT4All, LlamaCpp import os import argparse +import time load_dotenv() @@ -47,13 +48,15 @@ def main(): continue # Get the answer from the chain + start = time.time() res = qa(query) answer, docs = res['result'], [] if args.hide_source else res['source_documents'] + end = time.time() # Print the result print("\n\n> Question:") print(query) - print("\n> Answer:") + print(f"\n> Answer (took {round(end - start, 2)} s.):") print(answer) # Print the relevant sources used for the answer