Commit graph

120 commits

Author SHA1 Message Date
Krish Dholakia
859b47f08b
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
2024-12-01 05:24:11 -08:00
Ishaan Jaff
4d1b4beb3d
(refactor) caching use LLMCachingHandler for async_get_cache and set_cache (#6208)
* use folder for caching

* fix importing caching

* fix clickhouse pyright

* fix linting

* fix correctly pass kwargs and args

* fix test case for embedding

* fix linting

* fix embedding caching logic

* fix refactor handle utils.py

* fix test_embedding_caching_azure_individual_items_reordered
2024-10-14 16:34:01 +05:30
Krish Dholakia
fac3b2ee42
Add pyright to ci/cd + Fix remaining type-checking errors (#6082)
* fix: fix type-checking errors

* fix: fix additional type-checking errors

* fix: additional type-checking error fixes

* fix: fix additional type-checking errors

* fix: additional type-check fixes

* fix: fix all type-checking errors + add pyright to ci/cd

* fix: fix incorrect import

* ci(config.yml): use mypy on ci/cd

* fix: fix type-checking errors in utils.py

* fix: fix all type-checking errors on main.py

* fix: fix mypy linting errors

* fix(anthropic/cost_calculator.py): fix linting errors

* fix: fix mypy linting errors

* fix: fix linting errors
2024-10-05 17:04:00 -04:00
Krish Dholakia
d57be47b0f
Litellm ruff linting enforcement (#5992)
* ci(config.yml): add a 'check_code_quality' step

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

* ci(config.yml): check why circle ci doesn't pick up this test

* ci(config.yml): fix to run 'check_code_quality' tests

* fix(__init__.py): fix unprotected import

* fix(__init__.py): don't remove unused imports

* build(ruff.toml): update ruff.toml to ignore unused imports

* fix: fix: ruff + pyright - fix linting + type-checking errors

* fix: fix linting errors

* fix(lago.py): fix module init error

* fix: fix linting errors

* ci(config.yml): cd into correct dir for checks

* fix(proxy_server.py): fix linting error

* fix(utils.py): fix bare except

causes ruff linting errors

* fix: ruff - fix remaining linting errors

* fix(clickhouse.py): use standard logging object

* fix(__init__.py): fix unprotected import

* fix: ruff - fix linting errors

* fix: fix linting errors

* ci(config.yml): cleanup code qa step (formatting handled in local_testing)

* fix(_health_endpoints.py): fix ruff linting errors

* ci(config.yml): just use ruff in check_code_quality pipeline for now

* build(custom_guardrail.py): include missing file

* style(embedding_handler.py): fix ruff check
2024-10-01 19:44:20 -04:00
Krish Dholakia
98c335acd0
LiteLLM Minor Fixes & Improvements (09/17/2024) (#5742)
* fix(proxy_server.py): use default azure credentials to support azure non-client secret kms

* fix(langsmith.py): raise error if credentials missing

* feat(langsmith.py): support error logging for langsmith + standard logging payload

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

* Fix hardcoding of schema in view check (#5749)

* fix - deal with case when check view exists returns None (#5740)

* Revert "fix - deal with case when check view exists returns None (#5740)" (#5741)

This reverts commit 535228159b.

* test(test_router_debug_logs.py): move to mock response

* Fix hardcoding of schema

---------

Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
Co-authored-by: Krrish Dholakia <krrishdholakia@gmail.com>

* fix(proxy_server.py): allow admin to disable ui via `DISABLE_ADMIN_UI` flag

* fix(router.py): fix default model name value

Fixes 55db19a1e4 (r1763712148)

* fix(utils.py): fix unbound variable error

* feat(rerank/main.py): add azure ai rerank endpoints

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

* feat(secret_detection.py): Allow configuring secret detection params

Allows admin to control what plugins to run for secret detection. Prevents overzealous secret detection.

* docs(secret_detection.md): add secret detection guardrail docs

* fix: fix linting errors

* fix - deal with case when check view exists returns None (#5740)

* Revert "fix - deal with case when check view exists returns None (#5740)" (#5741)

This reverts commit 535228159b.

* Litellm fix router testing (#5748)

* test: fix testing - azure changed content policy error logic

* test: fix tests to use mock responses

* test(test_image_generation.py): handle api instability

* test(test_image_generation.py): handle azure api instability

* fix(utils.py): fix unbounded variable error

* fix(utils.py): fix unbounded variable error

* test: refactor test to use mock response

* test: mark flaky azure tests

* Bump next from 14.1.1 to 14.2.10 in /ui/litellm-dashboard (#5753)

Bumps [next](https://github.com/vercel/next.js) from 14.1.1 to 14.2.10.
- [Release notes](https://github.com/vercel/next.js/releases)
- [Changelog](https://github.com/vercel/next.js/blob/canary/release.js)
- [Commits](https://github.com/vercel/next.js/compare/v14.1.1...v14.2.10)

---
updated-dependencies:
- dependency-name: next
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [Fix] o1-mini causes pydantic warnings on `reasoning_tokens`  (#5754)

* add requester_metadata in standard logging payload

* log requester_metadata in metadata

* use StandardLoggingPayload for logging

* docs StandardLoggingPayload

* fix import

* include standard logging object in failure

* add test for requester metadata

* handle completion_tokens_details

* add test for completion_tokens_details

* [Feat-Proxy-DataDog] Log Redis, Postgres Failure events on DataDog  (#5750)

* dd - start tracking redis status on dd

* add async_service_succes_hook / failure hook in custom logger

* add async_service_failure_hook

* log service failures on dd

* fix import error

* add test for redis errors / warning

* [Fix] Router/ Proxy - Tag Based routing, raise correct error when no deployments found and tag filtering is on  (#5745)

* fix tag routing - raise correct error when no model with tag based routing

* fix error string from tag based routing

* test router tag based routing

* raise 401 error when no tags avialable for deploymen

* linting fix

* [Feat] Log Request metadata on gcs bucket logging (#5743)

* add requester_metadata in standard logging payload

* log requester_metadata in metadata

* use StandardLoggingPayload for logging

* docs StandardLoggingPayload

* fix import

* include standard logging object in failure

* add test for requester metadata

* fix(litellm_logging.py): fix logging message

* fix(rerank_api/main.py): fix linting errors

* fix(custom_guardrails.py): maintain backwards compatibility for older guardrails

* fix(rerank_api/main.py): fix cost tracking for rerank endpoints

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: steffen-sbt <148480574+steffen-sbt@users.noreply.github.com>
Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-17 23:00:04 -07:00
Ishaan Jaff
b6ae2204a8
[Feat-Proxy] Slack Alerting - allow using os.environ/ vars for alert to webhook url (#5726)
* allow using os.environ for slack urls

* use env vars for webhook urls

* fix types for get_secret

* fix linting

* fix linting

* fix linting

* linting fixes

* linting fix

* docs alerting slack

* fix get data
2024-09-16 18:03:37 -07:00
Ishaan Jaff
0f154abf9e use get_async_httpx_client for logging httpx 2024-09-10 13:03:55 -07:00
Ishaan Jaff
43acf6d08f use view for getting tag usage on ui 2024-09-06 16:28:05 -07:00
Ishaan Jaff
1a142053e5 fix make lakera ai free guardrail 2024-08-20 14:03:22 -07:00
Ishaan Jaff
cad0352f76 rename lakera ai 2024-08-20 13:44:39 -07:00
Ishaan Jaff
042350bd74 rename Aporia Guardrail 2024-08-20 13:42:55 -07:00
Ishaan Jaff
0431600f7b add testing for aporia guardrails 2024-08-19 18:50:14 -07:00
Ishaan Jaff
ca9c81470b fix aporia typo 2024-08-19 18:34:45 -07:00
Ishaan Jaff
8cd1963c11 feat - guardrails v2 2024-08-19 18:24:20 -07:00
Ishaan Jaff
613bd1babd feat - return applied guardrails in response headers 2024-08-19 11:56:20 -07:00
Ishaan Jaff
4685b9909a feat - allow accessing data post success call 2024-08-19 11:35:33 -07:00
Ishaan Jaff
8cb62213e1 feat run aporia as post call success hook 2024-08-19 11:25:31 -07:00
Krrish Dholakia
61f4b71ef7 refactor: replace .error() with .exception() logging for better debugging on sentry 2024-08-16 09:22:47 -07:00
Krish Dholakia
c82fc0cac2
Merge branch 'main' into litellm_support_lakera_config_thresholds 2024-08-06 22:47:13 -07:00
Krrish Dholakia
907d83e5d9 fix(lakera_ai.py): fix hardcoded prompt_injection string in lakera integration 2024-08-06 16:12:54 -07:00
Krrish Dholakia
0e222cf76b feat(lakera_ai.py): support lakera custom thresholds + custom api base
Allows user to configure thresholds to trigger prompt injection rejections
2024-08-06 15:21:45 -07:00
Krrish Dholakia
80e7310c5c feat(lakera_ai.py): support running prompt injection detection lakera check pre-api call 2024-07-22 20:16:05 -07:00
Krrish Dholakia
99a5436ed5 feat(lakera_ai.py): control running prompt injection between pre-call and in_parallel 2024-07-22 20:04:42 -07:00
Ishaan Jaff
e66a735304 fix lakera ai tests 2024-07-19 07:49:57 -07:00
Ishaan Jaff
75ca53fab5 fix linting errors on main 2024-07-18 13:32:48 -07:00
Ishaan Jaff
eedacf5193
Merge branch 'main' into litellm_run_moderation_check_on_embedding 2024-07-18 12:44:30 -07:00
Krish Dholakia
57f6923ab6
Merge pull request #4729 from vingiarrusso/vgiarrusso/guardrails
Add enabled_roles to Guardrails configuration, Update Lakera guardrail moderation hook
2024-07-17 22:24:35 -07:00
Ishaan Jaff
b2bf5ad3d0 lakera run on /embeddings 2024-07-17 18:27:05 -07:00
Krrish Dholakia
07d90f6739 feat(aporio_ai.py): support aporio ai prompt injection for chat completion requests
Closes https://github.com/BerriAI/litellm/issues/2950
2024-07-17 16:38:47 -07:00
Vinnie Giarrusso
a4b41e28a8 remove more unused imports 2024-07-16 12:25:06 -07:00
Vinnie Giarrusso
6ff863ee00 Add enabled_roles to Guardrails configuration, Update Lakera guardrail moderation hook 2024-07-16 01:52:08 -07:00
Krrish Dholakia
6b78e39600 feat(guardrails.py): allow setting logging_only in guardrails_config for presidio pii masking integration 2024-07-13 12:22:17 -07:00
Ishaan Jaff
1028be6308 feat- control lakera ai per llm call 2024-07-03 16:34:23 -07:00
Ishaan Jaff
2dcf06ce7d
Merge pull request #4525 from BerriAI/litellm_control_lakera_per_llm_call
[Feat] Control Lakera AI per Request
2024-07-02 18:02:43 -07:00
Ishaan Jaff
23f8d23acb correct guardrail name 2024-07-02 17:50:23 -07:00
Ishaan Jaff
b6af67344c feat - control lakera per call 2024-07-02 17:34:05 -07:00
Ishaan Jaff
9f8572e427 check if key does not want secret detection to run 2024-07-02 17:05:53 -07:00
Ishaan Jaff
e2046bd59c feat - laker return orig response from lakera api 2024-06-28 16:13:44 -07:00
Ishaan Jaff
eaa6441030 test fix secret detection 2024-06-27 17:42:44 -07:00
Ishaan Jaff
baf55a86c9 fix secret scanner 2024-06-27 15:20:30 -07:00
Ishaan Jaff
84ee37086c add stricter secret detection 2024-06-27 15:12:13 -07:00
Ishaan Jaff
552bac586f feat - improve secret detection 2024-06-27 15:07:38 -07:00
Ishaan Jaff
304e84f87c clean up secret detection 2024-06-25 17:25:53 -07:00
Ishaan Jaff
e4653e6032 fix async_pre_call_hook 2024-06-25 16:38:47 -07:00
Ishaan Jaff
4aa686bb05 feat - add secret detection 2024-06-25 16:23:56 -07:00
Ishaan Jaff
2f9aa308f1 fix - remove deprecated clickhouse utils 2024-06-15 15:33:26 -07:00
Krrish Dholakia
3b913443fe feat(vertex_httpx.py): Moving to call vertex ai via httpx (instead of their sdk). Allows us to support all their api updates. 2024-06-12 16:47:00 -07:00
Krrish Dholakia
6cca5612d2 refactor: replace 'traceback.print_exc()' with logging library
allows error logs to be in json format for otel logging
2024-06-06 13:47:43 -07:00
Ishaan Jaff
45cb899687 fix - working filter by tag query 2024-06-03 15:12:09 -07:00
Ishaan Jaff
03ec8219a4 fix - lakera ai integration 2024-05-23 15:25:26 -07:00