mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
* fix(caching.py): set ttl for async_increment cache fixes issue where ttl for redis client was not being set on increment_cache Fixes https://github.com/BerriAI/litellm/issues/5609 * fix(caching.py): fix increment cache w/ ttl for sync increment cache on redis Fixes https://github.com/BerriAI/litellm/issues/5609 * fix(router.py): support adding retry policy + allowed fails policy via config.yaml * fix(router.py): don't cooldown single deployments No point, as there's no other deployment to loadbalance with. * fix(user_api_key_auth.py): support setting allowed email domains on jwt tokens Closes https://github.com/BerriAI/litellm/issues/5605 * docs(token_auth.md): add user upsert + allowed email domain to jwt auth docs * fix(litellm_pre_call_utils.py): fix dynamic key logging when team id is set Fixes issue where key logging would not be set if team metadata was not none * fix(secret_managers/main.py): load environment variables correctly Fixes issue where os.environ/ was not being loaded correctly * test(test_router.py): fix test * feat(spend_tracking_utils.py): support logging additional usage params - e.g. prompt caching values for deepseek * test: fix tests * test: fix test * test: fix test * test: fix test * test: fix test
38 lines
860 B
Python
38 lines
860 B
Python
import os
|
|
import sys
|
|
import time
|
|
|
|
import pytest
|
|
from opentelemetry.sdk.trace.export.in_memory_span_exporter import InMemorySpanExporter
|
|
|
|
import litellm
|
|
|
|
sys.path.insert(0, os.path.abspath("../.."))
|
|
|
|
|
|
@pytest.fixture()
|
|
def exporter():
|
|
from traceloop.sdk import Traceloop
|
|
|
|
exporter = InMemorySpanExporter()
|
|
Traceloop.init(
|
|
app_name="test_litellm",
|
|
disable_batch=True,
|
|
exporter=exporter,
|
|
)
|
|
litellm.success_callback = ["traceloop"]
|
|
litellm.set_verbose = True
|
|
|
|
return exporter
|
|
|
|
|
|
@pytest.mark.parametrize("model", ["claude-instant-1.2", "gpt-3.5-turbo"])
|
|
def test_traceloop_logging(exporter, model):
|
|
litellm.completion(
|
|
model=model,
|
|
messages=[{"role": "user", "content": "This is a test"}],
|
|
max_tokens=1000,
|
|
temperature=0.7,
|
|
timeout=5,
|
|
mock_response="hi",
|
|
)
|