mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-17 09:34:48 +00:00
fix(logging): use getattr for prompt_version on custom loggers
This commit is contained in:
parent
73169812a2
commit
ea7e53a4b9
2 changed files with 3 additions and 2 deletions
|
|
@ -1123,7 +1123,7 @@ class Logging(LiteLLMLoggingBaseClass):
|
|||
for logger in prompt_management_loggers:
|
||||
if isinstance(logger, CustomPromptManagement):
|
||||
if prompt_version is not None and getattr(logger, "prompt_version", None) is not None:
|
||||
if logger.prompt_version != prompt_version:
|
||||
if getattr(logger, "prompt_version", None) != prompt_version:
|
||||
continue
|
||||
try:
|
||||
if logger.should_run_prompt_management(
|
||||
|
|
@ -1217,7 +1217,7 @@ class Logging(LiteLLMLoggingBaseClass):
|
|||
):
|
||||
continue
|
||||
if prompt_version is not None and getattr(logger, "prompt_version", None) is not None:
|
||||
if logger.prompt_version != prompt_version:
|
||||
if getattr(logger, "prompt_version", None) != prompt_version:
|
||||
continue
|
||||
self.model_call_details["prompt_integration"] = logger.__class__.__name__
|
||||
return logger
|
||||
|
|
|
|||
|
|
@ -17073,6 +17073,7 @@ def test_router_dispatch_prompt_completion_direct(monkeypatch: pytest.MonkeyPatc
|
|||
kwargs={"model": "direct-model", "messages": [{"role": "user", "content": "hi"}]},
|
||||
)
|
||||
)
|
||||
assert isinstance(response, litellm.ModelResponse)
|
||||
assert response.choices[0].message.content == "dispatched reply"
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue