forked from phoenix/litellm-mirror
test - team based logging on proxy
This commit is contained in:
parent
464d812fa9
commit
ecc6aa060f
4 changed files with 30 additions and 4 deletions
|
@ -4,6 +4,17 @@ model_list:
|
||||||
model: openai/fake
|
model: openai/fake
|
||||||
api_key: fake-key
|
api_key: fake-key
|
||||||
api_base: https://exampleopenaiendpoint-production.up.railway.app/
|
api_base: https://exampleopenaiendpoint-production.up.railway.app/
|
||||||
|
|
||||||
|
litellm_settings:
|
||||||
|
default_team_settings:
|
||||||
|
- team_id: team-1
|
||||||
|
success_callback: ["langfuse"]
|
||||||
|
langfuse_public_key: os.environ/LANGFUSE_PROJECT1_PUBLIC # Project 1
|
||||||
|
langfuse_secret: os.environ/LANGFUSE_PROJECT1_SECRET # Project 1
|
||||||
|
- team_id: team-2
|
||||||
|
success_callback: ["langfuse"]
|
||||||
|
langfuse_public_key: os.environ/LANGFUSE_PROJECT2_PUBLIC # Project 2
|
||||||
|
langfuse_secret: os.environ/LANGFUSE_PROJECT2_SECRET # Project 2
|
||||||
general_settings:
|
general_settings:
|
||||||
store_model_in_db: true
|
store_model_in_db: true
|
||||||
master_key: sk-1234
|
master_key: sk-1234
|
|
@ -1896,7 +1896,12 @@ class ProxyConfig:
|
||||||
param_name = getattr(response, "param_name", None)
|
param_name = getattr(response, "param_name", None)
|
||||||
param_value = getattr(response, "param_value", None)
|
param_value = getattr(response, "param_value", None)
|
||||||
if param_name is not None and param_value is not None:
|
if param_name is not None and param_value is not None:
|
||||||
config[param_name] = param_value
|
# check if param_name is already in the config
|
||||||
|
if param_name in config:
|
||||||
|
if isinstance(config[param_name], dict):
|
||||||
|
config[param_name].update(param_value)
|
||||||
|
else:
|
||||||
|
config[param_name] = param_value
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
|
@ -66,6 +66,15 @@ litellm_settings:
|
||||||
request_timeout: 600
|
request_timeout: 600
|
||||||
telemetry: False
|
telemetry: False
|
||||||
context_window_fallbacks: [{"gpt-3.5-turbo": ["gpt-3.5-turbo-large"]}]
|
context_window_fallbacks: [{"gpt-3.5-turbo": ["gpt-3.5-turbo-large"]}]
|
||||||
|
default_team_settings:
|
||||||
|
- team_id: team-1
|
||||||
|
success_callback: ["langfuse"]
|
||||||
|
langfuse_public_key: os.environ/LANGFUSE_PROJECT1_PUBLIC # Project 1
|
||||||
|
langfuse_secret: os.environ/LANGFUSE_PROJECT1_SECRET # Project 1
|
||||||
|
- team_id: team-2
|
||||||
|
success_callback: ["langfuse"]
|
||||||
|
langfuse_public_key: os.environ/LANGFUSE_PROJECT2_PUBLIC # Project 2
|
||||||
|
langfuse_secret: os.environ/LANGFUSE_PROJECT2_SECRET # Project 2
|
||||||
|
|
||||||
router_settings:
|
router_settings:
|
||||||
routing_strategy: usage-based-routing-v2
|
routing_strategy: usage-based-routing-v2
|
||||||
|
|
|
@ -7,6 +7,7 @@ import aiohttp
|
||||||
import os
|
import os
|
||||||
import dotenv
|
import dotenv
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
import pytest
|
||||||
|
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
|
@ -103,9 +104,9 @@ async def test_team_logging():
|
||||||
|
|
||||||
generations = langfuse_client.get_generations(trace_id=_trace_id).data
|
generations = langfuse_client.get_generations(trace_id=_trace_id).data
|
||||||
print(generations)
|
print(generations)
|
||||||
assert len(generations) == 2
|
assert len(generations) == 1
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
pytest.fail(f"Unexpected error: {str(e)}")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
|
@ -169,4 +170,4 @@ async def test_team_2logging():
|
||||||
assert len(generations_team_1) == 0
|
assert len(generations_team_1) == 0
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
pytest.fail("Team 2 logging failed: " + str(e))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue