add llm stream log

This commit is contained in:
shenchucheng 2023-12-23 22:45:20 +08:00
parent 7671935741
commit 0eef8a8607
5 changed files with 21 additions and 8 deletions

View file

@ -8,6 +8,7 @@
import sys
from datetime import datetime
from functools import partial
from loguru import logger as _logger
@ -26,3 +27,15 @@ def define_log_level(print_level="INFO", logfile_level="DEBUG"):
logger = define_log_level()
def log_llm_stream(msg):
_llm_stream_log(msg)
def set_llm_stream_logfunc(func):
global _llm_stream_log
_llm_stream_log = func
_llm_stream_log = partial(print, end="")