mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
Litellm dev 01 30 2025 p2 (#8134)
* feat(lowest_tpm_rpm_v2.py): fix redis cache check to use >= instead of > makes it consistent * test(test_custom_guardrails.py): add more unit testing on default on guardrails ensure it runs if user sent guardrail list is empty * docs(quick_start.md): clarify default on guardrails run even if user guardrails list contains other guardrails * refactor(litellm_logging.py): refactor no-log to helper util allows for more consistent behavior * feat(litellm_logging.py): add event hook to verbose logs * fix(litellm_logging.py): add unit testing to ensure `litellm.disable_no_log_param` is respected * docs(logging.md): document how to disable 'no-log' param * test: fix test to handle feb * test: cleanup old bedrock model * fix: fix router check
This commit is contained in:
parent
41407f7be1
commit
69a6da4727
10 changed files with 103 additions and 30 deletions
|
@ -1683,3 +1683,32 @@ def test_standard_logging_retries():
|
|||
"standard_logging_object"
|
||||
]["trace_id"]
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("disable_no_log_param", [True, False])
|
||||
def test_litellm_logging_no_log_param(monkeypatch, disable_no_log_param):
|
||||
monkeypatch.setattr(litellm, "global_disable_no_log_param", disable_no_log_param)
|
||||
from litellm.litellm_core_utils.litellm_logging import Logging
|
||||
|
||||
litellm.success_callback = ["langfuse"]
|
||||
litellm_call_id = "my-unique-call-id"
|
||||
litellm_logging_obj = Logging(
|
||||
model="gpt-3.5-turbo",
|
||||
messages=[{"role": "user", "content": "hi"}],
|
||||
stream=False,
|
||||
call_type="acompletion",
|
||||
litellm_call_id=litellm_call_id,
|
||||
start_time=datetime.now(),
|
||||
function_id="1234",
|
||||
)
|
||||
|
||||
should_run = litellm_logging_obj.should_run_callback(
|
||||
callback="langfuse",
|
||||
litellm_params={"no-log": True},
|
||||
event_hook="success_handler",
|
||||
)
|
||||
|
||||
if disable_no_log_param:
|
||||
assert should_run is True
|
||||
else:
|
||||
assert should_run is False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue