mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
Pass router tags in request headers - x-litellm-tags
(#8609)
* feat(litellm_pre_call_utils.py): support `x-litellm-tags` request header allow tag based routing + spend tracking via request headers * docs(request_headers.md): document new `x-litellm-tags` for tag based routing and spend tracking * docs(tag_routing.md): add to docs * fix(utils.py): only pass str values for openai metadata param * fix(utils.py): drop non-str values for metadata param to openai preview-feature, otel span was being sent in
This commit is contained in:
parent
5b84d11597
commit
e6c69c9a6f
9 changed files with 122 additions and 22 deletions
|
@ -1966,3 +1966,22 @@ def test_get_applied_guardrails(test_case):
|
|||
|
||||
# Assert
|
||||
assert sorted(result) == sorted(test_case["expected"])
|
||||
|
||||
|
||||
def test_add_openai_metadata():
|
||||
from litellm.utils import add_openai_metadata
|
||||
|
||||
metadata = {
|
||||
"user_api_key_end_user_id": "123",
|
||||
"hidden_params": {"api_key": "123"},
|
||||
"litellm_parent_otel_span": MagicMock(),
|
||||
"none-val": None,
|
||||
"int-val": 1,
|
||||
"dict-val": {"a": 1, "b": 2},
|
||||
}
|
||||
|
||||
result = add_openai_metadata(metadata)
|
||||
|
||||
assert result == {
|
||||
"user_api_key_end_user_id": "123",
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue