Commit graph

57 commits

Author SHA1 Message Date
zishaansunderji
9717d89e69 Resolve Anthropic Overloaded error during stream 2025-04-07 18:04:50 -04:00
Krrish Dholakia
5f87dc229a feat(openai.py): bubble all error information back to client 2025-03-10 15:27:43 -07:00
Krish Dholakia
a9276f27f9
fix(main.py): fix key leak error when unknown provider given (#8556)
* fix(main.py): fix key leak error when unknown provider given

don't return passed in args if unknown route on embedding

* fix(main.py): remove instances of {args} being passed in exception

prevent potential key leaks

* test(code_coverage/prevent_key_leaks_in_codebase.py): ban usage of {args} in codebase

* fix: fix linting errors

* fix: remove unused variable
2025-02-15 14:02:55 -08:00
Krish Dholakia
67b39bacf7
LiteLLM Minor Fixes & Improvements (12/27/2024) - p1 (#7448)
* feat(main.py): mock_response() - support 'litellm.ContextWindowExceededError' in mock response

enabled quicker router/fallback/proxy debug on context window errors

* feat(exception_mapping_utils.py): extract special litellm errors from error str if calling `litellm_proxy/` as provider

Closes https://github.com/BerriAI/litellm/issues/7259

* fix(user_api_key_auth.py): specify 'Received Proxy Server Request' is span kind server

Closes https://github.com/BerriAI/litellm/issues/7298
2024-12-27 19:04:39 -08:00
Krish Dholakia
89fcd7b0e1
Litellm 12 02 2024 (#6994)
* add the logprobs param for fireworks ai (#6915)

* add the logprobs param for fireworks ai

* (feat) pass through llm endpoints - add `PATCH` support (vertex context caching requires for update ops)  (#6924)

* add PATCH for pass through endpoints

* test_pass_through_routes_support_all_methods

* sonnet supports pdf, haiku does not (#6928)

* (feat) DataDog Logger - Add Failure logging + use Standard Logging payload (#6929)

* add async_log_failure_event for dd

* use standard logging payload for DD logging

* use standard logging payload for DD

* fix use SLP status

* allow opting into _create_v0_logging_payload

* add unit tests for DD logging payload

* fix dd logging tests

* (feat) log proxy auth errors on datadog  (#6931)

* add new dd type for auth errors

* add async_log_proxy_authentication_errors

* fix comment

* use async_log_proxy_authentication_errors

* test_datadog_post_call_failure_hook

* test_async_log_proxy_authentication_errors

* (feat) Allow using include to include external YAML files in a config.yaml (#6922)

* add helper to process inlcudes directive on yaml

* add doc on config management

* unit tests for `include` on config.yaml

* bump: version 1.52.16 → 1.53.

* (feat) dd logger - set tags according to the values set by those env vars  (#6933)

* dd logger, inherit from .envs

* test_datadog_payload_environment_variables

* fix _get_datadog_service

* build(ui/): update ui build

* bump: version 1.53.0 → 1.53.1

* Revert "(feat) Allow using include to include external YAML files in a config.yaml (#6922)"

This reverts commit 68e59824a3.

* LiteLLM Minor Fixes & Improvements (11/26/2024)  (#6913)

* docs(config_settings.md): document all router_settings

* ci(config.yml): add router_settings doc test to ci/cd

* test: debug test on ci/cd

* test: debug ci/cd test

* test: fix test

* fix(team_endpoints.py): skip invalid team object. don't fail `/team/list` call

Causes downstream errors if ui just fails to load team list

* test(base_llm_unit_tests.py): add 'response_format={"type": "text"}' test to base_llm_unit_tests

adds complete coverage for all 'response_format' values to ci/cd

* feat(router.py): support wildcard routes in `get_router_model_info()`

Addresses https://github.com/BerriAI/litellm/issues/6914

* build(model_prices_and_context_window.json): add tpm/rpm limits for all gemini models

Allows for ratelimit tracking for gemini models even with wildcard routing enabled

Addresses https://github.com/BerriAI/litellm/issues/6914

* feat(router.py): add tpm/rpm tracking on success/failure to global_router

Addresses https://github.com/BerriAI/litellm/issues/6914

* feat(router.py): support wildcard routes on router.get_model_group_usage()

* fix(router.py): fix linting error

* fix(router.py): implement get_remaining_tokens_and_requests

Addresses https://github.com/BerriAI/litellm/issues/6914

* fix(router.py): fix linting errors

* test: fix test

* test: fix tests

* docs(config_settings.md): add missing dd env vars to docs

* fix(router.py): check if hidden params is dict

* LiteLLM Minor Fixes & Improvements (11/27/2024) (#6943)

* fix(http_parsing_utils.py): remove `ast.literal_eval()` from http utils

Security fix - https://huntr.com/bounties/96a32812-213c-4819-ba4e-36143d35e95b?token=bf414bbd77f8b346556e
64ab2dd9301ea44339910877ea50401c76f977e36cdd78272f5fb4ca852a88a7e832828aae1192df98680544ee24aa98f3cf6980d8
bab641a66b7ccbc02c0e7d4ddba2db4dbe7318889dc0098d8db2d639f345f574159814627bb084563bad472e2f990f825bff0878a9
e281e72c88b4bc5884d637d186c0d67c9987c57c3f0caf395aff07b89ad2b7220d1dd7d1b427fd2260b5f01090efce5250f8b56ea2
c0ec19916c24b23825d85ce119911275944c840a1340d69e23ca6a462da610

* fix(converse/transformation.py): support bedrock apac cross region inference

Fixes https://github.com/BerriAI/litellm/issues/6905

* fix(user_api_key_auth.py): add auth check for websocket endpoint

Fixes https://github.com/BerriAI/litellm/issues/6926

* fix(user_api_key_auth.py): use `model` from query param

* fix: fix linting error

* test: run flaky tests first

* docs: update the docs (#6923)

* (bug fix) /key/update was not storing `budget_duration` in the DB  (#6941)

* fix - store budget_duration for keys

* test_generate_and_update_key

* test_update_user_unit_test

* fix user update

* (fix) handle json decode errors for DD exception logging (#6934)

* fix JSONDecodeError

* handle async_log_proxy_authentication_errors

* fix test_async_log_proxy_authentication_errors_get_request

* Revert "Revert "(feat) Allow using include to include external YAML files in a config.yaml (#6922)""

This reverts commit 5d13302e6b.

* (docs + fix) Add docs on Moderations endpoint, Text Completion  (#6947)

* fix _pass_through_moderation_endpoint_factory

* fix route_llm_request

* doc moderations api

* docs on /moderations

* add e2e tests for moderations api

* docs moderations api

* test_pass_through_moderation_endpoint_factory

* docs text completion

* (feat) add enforcement for unique key aliases on /key/update and /key/generate  (#6944)

* add enforcement for unique key aliases

* fix _enforce_unique_key_alias

* fix _enforce_unique_key_alias

* fix _enforce_unique_key_alias

* test_enforce_unique_key_alias

* (fix) tag merging / aggregation logic   (#6932)

* use 1 helper to merge tags + ensure unique ness

* test_add_litellm_data_to_request_duplicate_tags

* fix _merge_tags

* fix proxy utils test

* fix doc string

* (feat) Allow disabling ErrorLogs written to the DB  (#6940)

* fix - allow disabling logging error logs

* docs on disabling error logs

* doc string for _PROXY_failure_handler

* test_disable_error_logs

* rename file

* fix rename file

* increase test coverage for test_enable_error_logs

* fix(key_management_endpoints.py): support 'tags' param on `/key/update` (#6945)

* LiteLLM Minor Fixes & Improvements (11/29/2024)  (#6965)

* fix(factory.py): ensure tool call converts image url

Fixes https://github.com/BerriAI/litellm/issues/6953

* fix(transformation.py): support mp4 + pdf url's for vertex ai

Fixes https://github.com/BerriAI/litellm/issues/6936

* fix(http_handler.py): mask gemini api key in error logs

Fixes https://github.com/BerriAI/litellm/issues/6963

* docs(prometheus.md): update prometheus FAQs

* feat(auth_checks.py): ensure specific model access > wildcard model access

if wildcard model is in access group, but specific model is not - deny access

* fix(auth_checks.py): handle auth checks for team based model access groups

handles scenario where model access group used for wildcard models

* fix(internal_user_endpoints.py): support adding guardrails on `/user/update`

Fixes https://github.com/BerriAI/litellm/issues/6942

* fix(key_management_endpoints.py): fix prepare_metadata_fields helper

* fix: fix tests

* build(requirements.txt): bump openai dep version

fixes proxies argument

* test: fix tests

* fix(http_handler.py): fix error message masking

* fix(bedrock_guardrails.py): pass in prepped data

* test: fix test

* test: fix nvidia nim test

* fix(http_handler.py): return original response headers

* fix: revert maskedhttpstatuserror

* test: update tests

* test: cleanup test

* fix(key_management_endpoints.py): fix metadata field update logic

* fix(key_management_endpoints.py): maintain initial order of guardrails in key update

* fix(key_management_endpoints.py): handle prepare metadata

* fix: fix linting errors

* fix: fix linting errors

* fix: fix linting errors

* fix: fix key management errors

* fix(key_management_endpoints.py): update metadata

* test: update test

* refactor: add more debug statements

* test: skip flaky test

* test: fix test

* fix: fix test

* fix: fix update metadata logic

* fix: fix test

* ci(config.yml): change db url for e2e ui testing

* bump: version 1.53.1 → 1.53.2

* Updated config.yml

---------

Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
Co-authored-by: paul-gauthier <69695708+paul-gauthier@users.noreply.github.com>
Co-authored-by: Krrish Dholakia <krrishdholakia@gmail.com>
Co-authored-by: Sara Han <127759186+sdiazlor@users.noreply.github.com>

* fix(exceptions.py): ensure ratelimit error code == 429, type == "throttling_error"

Fixes https://github.com/BerriAI/litellm/pull/6973

* fix(utils.py): add jina ai dimensions embedding param support

Fixes https://github.com/BerriAI/litellm/issues/6591

* fix(exception_mapping_utils.py): add bedrock 'prompt is too long' exception to context window exceeded error exception mapping

Fixes https://github.com/BerriAI/litellm/issues/6629

Closes https://github.com/BerriAI/litellm/pull/6975

* fix(litellm_logging.py): strip trailing slash for api base

Closes https://github.com/BerriAI/litellm/pull/6859

* test: skip timeout issue

---------

Co-authored-by: ershang-dou <erlie.shang@gmail.com>
Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
Co-authored-by: paul-gauthier <69695708+paul-gauthier@users.noreply.github.com>
Co-authored-by: Sara Han <127759186+sdiazlor@users.noreply.github.com>
2024-12-02 22:00:01 -08:00
Krish Dholakia
70111a7abd
Litellm dev 10 26 2024 (#6472)
* docs(exception_mapping.md): add missing exception types

Fixes https://github.com/Aider-AI/aider/issues/2120#issuecomment-2438971183

* fix(main.py): register custom model pricing with specific key

Ensure custom model pricing is registered to the specific model+provider key combination

* test: make testing more robust for custom pricing

* fix(redis_cache.py): instrument otel logging for sync redis calls

ensures complete coverage for all redis cache calls
2024-10-28 15:05:43 -07:00
Krish Dholakia
8039b95aaf
LiteLLM Minor Fixes & Improvements (09/21/2024) (#5819)
* fix(router.py): fix error message

* Litellm disable keys (#5814)

* build(schema.prisma): allow blocking/unblocking keys

Fixes https://github.com/BerriAI/litellm/issues/5328

* fix(key_management_endpoints.py): fix pop

* feat(auth_checks.py): allow admin to enable/disable virtual keys

Closes https://github.com/BerriAI/litellm/issues/5328

* docs(vertex.md): add auth section for vertex ai

Addresses - https://github.com/BerriAI/litellm/issues/5768#issuecomment-2365284223

* build(model_prices_and_context_window.json): show which models support prompt_caching

Closes https://github.com/BerriAI/litellm/issues/5776

* fix(router.py): allow setting default priority for requests

* fix(router.py): add 'retry-after' header for concurrent request limit errors

Fixes https://github.com/BerriAI/litellm/issues/5783

* fix(router.py): correctly raise and use retry-after header from azure+openai

Fixes https://github.com/BerriAI/litellm/issues/5783

* fix(user_api_key_auth.py): fix valid token being none

* fix(auth_checks.py): fix model dump for cache management object

* fix(user_api_key_auth.py): pass prisma_client to obj

* test(test_otel.py): update test for new key check

* test: fix test
2024-09-21 18:51:53 -07:00
Krrish Dholakia
ff373663a3 fix: fix tests 2024-08-07 15:02:04 -07:00
Krrish Dholakia
1affd4e2ca fix: add type hints for APIError and AnthropicError status codes
Fixes https://github.com/BerriAI/litellm/issues/5000
2024-08-01 15:08:54 -07:00
Krrish Dholakia
6202f9bbb0 fix(http_handler.py): correctly re-raise timeout exception 2024-07-31 14:51:28 -07:00
Krrish Dholakia
59384c84a5 fix(utils.py): correctly re-raise azure api connection error
'
2024-07-29 12:28:25 -07:00
Krrish Dholakia
66dbd938e8 fix(exceptions.py): use correct status code for content policy exceptions
Fixes https://github.com/BerriAI/litellm/issues/4941#issuecomment-2256578732
2024-07-29 12:01:54 -07:00
Ishaan Jaff
11512c057d feat use UnsupportedParamsError as litellm error type 2024-07-24 12:19:10 -07:00
Ishaan Jaff
bcc89a2c3a fix testing exception mapping 2024-07-13 11:10:13 -07:00
Krrish Dholakia
b699d9a8b9 fix(utils.py): support json schema validation 2024-06-29 15:05:52 -07:00
Krrish Dholakia
123477b55a fix(utils.py): fix exception_mapping check for errors
If exception already mapped - don't attach traceback to it
2024-06-24 16:55:19 -07:00
Krrish Dholakia
6f715b4782 feat(router.py): support content policy fallbacks
Closes https://github.com/BerriAI/litellm/issues/2632
2024-06-14 17:15:44 -07:00
Krrish Dholakia
46d57526c4 fix(http_handler.py): add retry logic on httpx.remoteprotocolerror 2024-06-13 14:05:29 -07:00
Ishaan Jaff
b4db464604 fix - show model group in exceptions 2024-06-10 20:30:31 -07:00
Krrish Dholakia
1dafb1b3b7 fix(utils.py): improved predibase exception mapping
adds unit testing + better coverage for predibase errors
2024-06-08 14:32:43 -07:00
Krrish Dholakia
6e9bca59b0 fix(utils.py): fix exception mapping for azure internal server error 2024-06-06 17:12:30 -07:00
Ishaan Jaff
be06413004 feat add InternalServerError 2024-06-04 08:15:06 -07:00
Ishaan Jaff
286d42a881 feat - add num retries and max retries in exception 2024-06-01 16:53:00 -07:00
Ishaan Jaff
40622f5f27 feat - include LiteLLM Retried and max retries in exception 2024-06-01 16:40:14 -07:00
Krrish Dholakia
cfcf5969c8 fix(proxy_server.py): fix end user object check when master key used
check if end user max budget exceeded for master key
2024-05-29 17:20:59 -07:00
Krrish Dholakia
f11f207ae6 feat(proxy_server.py): refactor returning rejected message, to work with error logging
log the rejected request as a failed call to langfuse/slack alerting
2024-05-20 11:14:36 -07:00
Ishaan Jaff
59e18f23e0 fix - show litellm_debug_info 2024-05-15 13:07:04 -07:00
Ishaan Jaff
91a6a0eef4 (Fix) - linting errors 2024-05-11 15:57:06 -07:00
jinno
ff8d1bc68c fix(exceptions.py): import openai Exceptions 2024-05-02 21:43:50 +09:00
Ishaan Jaff
7a5c07de22 fix - show api_base, model in exceptions 2024-04-24 14:03:48 -07:00
Krrish Dholakia
944afcb5d1 fix(main.py): map list input to ollama prompt input format 2024-02-16 09:57:51 -08:00
Krrish Dholakia
8e9dc09955 fix(bedrock.py): add support for sts based boto3 initialization
https://github.com/BerriAI/litellm/issues/1476
2024-01-17 12:08:59 -08:00
ishaan-jaff
09874cc83f (v0) add ContentPolicyViolationError 2024-01-09 16:33:03 +05:30
Krrish Dholakia
4905929de3 refactor: add black formatting 2023-12-25 14:11:20 +05:30
ishaan-jaff
353433e5ce (feat) add openai.NotFoundError 2023-12-15 10:18:02 +05:30
Krrish Dholakia
e678009695 fix(vertex_ai.py): add exception mapping for acompletion calls 2023-12-13 16:35:50 -08:00
Krrish Dholakia
846a824c47 fix(proxy_server.py): run ollama serve when ollama in config.yaml 2023-11-21 08:35:04 -08:00
Krrish Dholakia
1306addfe8 fix(openai.py-+-azure.py): fix linting issues 2023-11-20 19:29:23 -08:00
Krrish Dholakia
855964ed45 fix(utils.py): adding support for rules + mythomax/alpaca prompt template 2023-11-20 18:58:15 -08:00
Krrish Dholakia
8c104e9c6a fix(azure.py-+-proxy_server.py): fix function calling response object + support router on proxy 2023-11-15 13:15:16 -08:00
Krrish Dholakia
a7222f257c fix(main.py): keep client consistent across calls + exponential backoff retry on ratelimit errors 2023-11-14 16:26:05 -08:00
ishaan-jaff
df156c7392 (fix) linting error 2023-11-14 15:07:43 -08:00
ishaan-jaff
30d52a26db (fix) APIError set body=None 2023-11-14 14:50:22 -08:00
Jack Collins
f499e8bb1d Add response and body to APIStatus init call 2023-11-13 21:17:47 -08:00
Krrish Dholakia
4340749ea3 fix(timeout.py): fix timeout issue 2023-11-13 11:07:17 -08:00
Krrish Dholakia
45b6f8b853 refactor: fixing linting issues 2023-11-11 18:52:28 -08:00
Krrish Dholakia
d3323ba637 refactor(openai.py): making it compatible for openai v1
BREAKING CHANGE:
2023-11-11 15:33:02 -08:00
Krrish Dholakia
bdc6ef1df8 add contributor message to code 2023-09-25 10:00:10 -07:00
Krrish Dholakia
73a084c19c exposing a litellm.max budget 2023-09-14 14:20:06 -07:00
Krrish Dholakia
d236d68fa4 fix linting issues 2023-09-06 10:41:52 -07:00