From 77d2ba91a185c5130a666af7f75f9ac14ca8761c Mon Sep 17 00:00:00 2001 From: Aliaksandr Kuzmik <98702584+alexkuzmik@users.noreply.github.com> Date: Tue, 21 Nov 2023 15:04:10 +0100 Subject: [PATCH] [CM-8933] introduce empty flush method for the llm sdk (#98) * Add flush method * Fix lint errors --- src/comet_llm/__init__.py | 3 ++- src/comet_llm/api.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/comet_llm/__init__.py b/src/comet_llm/__init__.py index 9e4bd32108..01aea34d3c 100644 --- a/src/comet_llm/__init__.py +++ b/src/comet_llm/__init__.py @@ -18,7 +18,7 @@ if config.comet_disabled(): from .dummy_api import Span, end_chain, log_prompt, start_chain # type: ignore else: - from .api import log_user_feedback + from .api import flush, log_user_feedback from .chains.api import end_chain, start_chain from .chains.span import Span from .prompts.api import log_prompt @@ -32,6 +32,7 @@ "init", "is_ready", "log_user_feedback", + "flush", ] logging.setup() diff --git a/src/comet_llm/api.py b/src/comet_llm/api.py index 1f98eed5a0..d683c32742 100644 --- a/src/comet_llm/api.py +++ b/src/comet_llm/api.py @@ -50,3 +50,8 @@ def log_user_feedback(id: str, score: float, api_key: Optional[str] = None) -> N ) experiment_api.log_metric("user_feedback", score) + + +def flush() -> None: + """Flush all data to Comet platform.""" + pass