From eb05d57f5fe54cadd16c2e79a0a9410f589cb2ef Mon Sep 17 00:00:00 2001 From: BeatrixCohere <128378696+BeatrixCohere@users.noreply.github.com> Date: Fri, 12 Jul 2024 10:36:07 +0100 Subject: [PATCH] Add logs --- src/backend/model_deployments/cohere_platform.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/backend/model_deployments/cohere_platform.py b/src/backend/model_deployments/cohere_platform.py index 15a0c5e2f9..1787ce84fd 100644 --- a/src/backend/model_deployments/cohere_platform.py +++ b/src/backend/model_deployments/cohere_platform.py @@ -5,6 +5,7 @@ import time from typing import Any, AsyncGenerator, Dict, List +from backend.services.logger import get_logger, send_log_message import cohere import requests from cohere.core.api_error import ApiError @@ -27,6 +28,8 @@ DEFAULT_RERANK_MODEL = "rerank-english-v2.0" +logger = get_logger() + class CohereDeployment(BaseDeployment): """Cohere Platform Deployment.""" @@ -85,6 +88,13 @@ async def invoke_chat_stream( ) for event in stream: + send_log_message( + logger, + f"Chat event: {to_dict(event)}", + level="info", + conversation_id=kwargs.get("conversation_id"), + user_id=kwargs.get("user_id"), + ) yield to_dict(event) @collect_metrics_rerank