fix(utils.py): fix logging for text completion streaming

This commit is contained in:
Krrish Dholakia 2024-01-08 12:05:20 +05:30
parent b4d624f332
commit 9b46412279
2 changed files with 42 additions and 1 deletions

View file

@ -710,7 +710,7 @@ class CallTypes(Enum):
aimage_generation = "aimage_generation"
# Logging function -> log the exact model details + what's being sent | Non-Blocking
# Logging function -> log the exact model details + what's being sent | Non-BlockingP
class Logging:
global supabaseClient, liteDebuggerClient, promptLayerLogger, weightsBiasesLogger, langsmithLogger, capture_exception, add_breadcrumb, llmonitorLogger
@ -729,6 +729,8 @@ class Logging:
raise ValueError(
f"Invalid call_type {call_type}. Allowed values: {allowed_values}"
)
if messages is not None and isinstance(messages, str):
messages = [{"role": "user", "content": messages}] # convert text completion input to the chat completion format
self.model = model
self.messages = messages
self.stream = stream