forked from phoenix/litellm-mirror
LiteLLM Minor Fixes & Improvements (10/23/2024) (#6407)
* docs(bedrock.md): clarify bedrock auth in litellm docs * fix(convert_dict_to_response.py): Fixes https://github.com/BerriAI/litellm/issues/6387 * feat(pattern_match_deployments.py): more robust handling for wildcard routes (model_name: custom_route/* -> openai/*) Enables user to expose custom routes to users with dynamic handling * test: add more testing * docs(custom_pricing.md): add debug tutorial for custom pricing * test: skip codestral test - unreachable backend * test: fix test * fix(pattern_matching_deployments.py): fix typing * test: cleanup codestral tests - backend api unavailable * (refactor) prometheus async_log_success_event to be under 100 LOC (#6416) * unit testig for prometheus * unit testing for success metrics * use 1 helper for _increment_token_metrics * use helper for _increment_remaining_budget_metrics * use _increment_remaining_budget_metrics * use _increment_top_level_request_and_spend_metrics * use helper for _set_latency_metrics * remove noqa violation * fix test prometheus * test prometheus * unit testing for all prometheus helper functions * fix prom unit tests * fix unit tests prometheus * fix unit test prom * (refactor) router - use static methods for client init utils (#6420) * use InitalizeOpenAISDKClient * use InitalizeOpenAISDKClient static method * fix # noqa: PLR0915 * (code cleanup) remove unused and undocumented logging integrations - litedebugger, berrispend (#6406) * code cleanup remove unused and undocumented code files * fix unused logging integrations cleanup * bump: version 1.50.3 → 1.50.4 --------- Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
This commit is contained in:
parent
c04c4a82f1
commit
1cd1d23fdf
9 changed files with 235 additions and 38 deletions
|
@ -42,7 +42,7 @@ def test_add_pattern():
|
|||
)
|
||||
router.add_pattern("openai/*", deployment.to_json(exclude_none=True))
|
||||
assert len(router.patterns) == 1
|
||||
assert list(router.patterns.keys())[0] == "^openai/.*$"
|
||||
assert list(router.patterns.keys())[0] == "openai/(.*)"
|
||||
|
||||
# try getting the pattern
|
||||
assert router.route(request="openai/gpt-15") == [
|
||||
|
@ -64,7 +64,7 @@ def test_add_pattern_vertex_ai():
|
|||
)
|
||||
router.add_pattern("vertex_ai/*", deployment.to_json(exclude_none=True))
|
||||
assert len(router.patterns) == 1
|
||||
assert list(router.patterns.keys())[0] == "^vertex_ai/.*$"
|
||||
assert list(router.patterns.keys())[0] == "vertex_ai/(.*)"
|
||||
|
||||
# try getting the pattern
|
||||
assert router.route(request="vertex_ai/gemini-1.5-flash-latest") == [
|
||||
|
@ -99,10 +99,10 @@ def test_pattern_to_regex():
|
|||
Tests that the pattern is converted to a regex
|
||||
"""
|
||||
router = PatternMatchRouter()
|
||||
assert router._pattern_to_regex("openai/*") == "^openai/.*$"
|
||||
assert router._pattern_to_regex("openai/*") == "openai/(.*)"
|
||||
assert (
|
||||
router._pattern_to_regex("openai/fo::*::static::*")
|
||||
== "^openai/fo::.*::static::.*$"
|
||||
== "openai/fo::(.*)::static::(.*)"
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue