fix(promptlayer.py): fixing promptlayer logging integration

This commit is contained in:
Krrish Dholakia 2023-11-13 15:04:05 -08:00
parent e0a4cf4a52
commit 9d8f872f38
2 changed files with 11 additions and 3 deletions

View file

@ -53,8 +53,11 @@ def timeout(timeout_duration: float = 0.0, exception_to_raise=Timeout):
result = future.result(timeout=local_timeout_duration)
except futures.TimeoutError:
thread.stop_loop()
model = args[0] if len(args) > 0 else kwargs["model"]
raise exception_to_raise(
f"A timeout error occurred. The function call took longer than {local_timeout_duration} second(s)."
f"A timeout error occurred. The function call took longer than {local_timeout_duration} second(s).",
model=model, # [TODO]: replace with logic for parsing out llm provider from model name
llm_provider="openai"
)
thread.stop_loop()
return result
@ -72,8 +75,11 @@ def timeout(timeout_duration: float = 0.0, exception_to_raise=Timeout):
)
return value
except asyncio.TimeoutError:
model = args[0] if len(args) > 0 else kwargs["model"]
raise exception_to_raise(
f"A timeout error occurred. The function call took longer than {local_timeout_duration} second(s)."
f"A timeout error occurred. The function call took longer than {local_timeout_duration} second(s).",
model=model, # [TODO]: replace with logic for parsing out llm provider from model name
llm_provider="openai"
)
if iscoroutinefunction(func):