Commit graph

3565 commits

Author SHA1 Message Date
Krish Dholakia
ca37bb9de5
fix(pass_through_endpoints): support bedrock agents via pass through (#5527) 2024-09-04 22:22:22 -07:00
Krish Dholakia
1e7e538261
LiteLLM Minor fixes + improvements (08/04/2024) (#5505)
* Minor IAM AWS OIDC Improvements (#5246)

* AWS IAM: Temporary tokens are valid across all regions after being issued, so it is wasteful to request one for each region.

* AWS IAM: Include an inline policy, to help reduce misuse of overly permissive IAM roles.

* (test_bedrock_completion.py): Ensure we are testing cross AWS region OIDC flow.

* fix(router.py): log rejected requests

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

* refactor: don't use verbose_logger.exception, if exception is raised

User might already have handling for this. But alerting systems in prod will raise this as an unhandled error.

* fix(datadog.py): support setting datadog source as an env var

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

* docs(logging.md): add dd_source to datadog docs

* fix(proxy_server.py): expose `/customer/list` endpoint for showing all customers

* (bedrock): Fix usage with Cloudflare AI Gateway, and proxies in general. (#5509)

* feat(anthropic.py): support 'cache_control' param for content when it is a string

* Revert "(bedrock): Fix usage with Cloudflare AI Gateway, and proxies in gener…" (#5519)

This reverts commit 3fac0349c2.

* refactor: ci/cd run again

---------

Co-authored-by: David Manouchehri <david.manouchehri@ai.moda>
2024-09-04 22:16:55 -07:00
Ishaan Jaff
20a5bbe6a6 fix allow general guardrails on free tier 2024-09-04 19:59:32 -07:00
Ishaan Jaff
7d0ea3d028
Merge pull request #5518 from BerriAI/litellm_log_request_response
[Feat] log request / response on pass through endpoints
2024-09-04 17:57:47 -07:00
Ishaan Jaff
172eb9b9bc return error from /global/spend endpoint 2024-09-04 17:26:34 -07:00
Ishaan Jaff
3eb0325063 return error client side from spend endpoints 2024-09-04 17:20:47 -07:00
Ishaan Jaff
21a89f15de show error from /spend/tags 2024-09-04 17:14:49 -07:00
Ishaan Jaff
c364d311b9 rename type 2024-09-04 16:33:36 -07:00
Ishaan Jaff
b8811d5165 add doc on PassthroughStandardLoggingObject 2024-09-04 16:30:47 -07:00
Ishaan Jaff
8eda374d79 feat log request / response on pass through endpoints 2024-09-04 16:26:32 -07:00
Ishaan Jaff
4b9163c7dc
Merge pull request #5514 from BerriAI/litellm_add_presidio
[Fix-Refactor] support presidio on new guardrails config
2024-09-04 16:09:54 -07:00
Krish Dholakia
fa2d9002b5
security - Prevent sql injection in /team/update query (#5513)
* fix(team_endpoints.py): replace `.get_data()` usage with prisma interface

Prevent sql injection in `/team/update` query

Fixes https://huntr.com/bounties/a4f6d357-5b44-4e00-9cac-f1cc351211d2

* fix(vertex_ai_non_gemini.py): handle message being a pydantic model
2024-09-04 16:03:02 -07:00
Ishaan Jaff
7712aa652a fix init presidio guardrail 2024-09-04 15:22:37 -07:00
Ishaan Jaff
4ab8e52bfa allow init guardrails with output parsing logic 2024-09-04 14:40:35 -07:00
Ishaan Jaff
6c30f18f8c docs new presidio language controls 2024-09-04 13:04:19 -07:00
Ishaan Jaff
9b5164b38d fix allow setting language per call to presidio 2024-09-04 12:46:59 -07:00
Ishaan Jaff
4e392ebdb2
Merge pull request #5484 from BerriAI/litellm_fix_redis
fix proxy server - always read redis for rate limiting logic
2024-09-04 12:39:15 -07:00
Ishaan Jaff
d954413b14 fix presidio calling logic 2024-09-04 12:14:30 -07:00
Ishaan Jaff
1276c10338 migrate presidio to new guardrails 2024-09-04 10:12:23 -07:00
Krish Dholakia
be3c7b401e
LiteLLM Minor fixes + improvements (08/03/2024) (#5488)
* fix(internal_user_endpoints.py): set budget_reset_at for /user/update

* fix(vertex_and_google_ai_studio_gemini.py): handle accumulated json

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

* fix(vertex_ai_and_gemini.py): fix assistant message function call when content is not None

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

* fix(proxy_server.py): generic state uuid for okta sso

* fix(lago.py): improve debug logs

Debugging for https://github.com/BerriAI/litellm/issues/5477

* docs(bedrock.md): add bedrock cross-region inferencing to docs

* fix(azure.py): return azure response headers on aembedding call

* feat(azure.py): return azure response headers for `/audio/transcription`

* fix(types/utils.py): standardize deepseek / anthropic prompt caching usage information

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

* docs(usage.md): add docs on litellm usage object

* test(test_completion.py): mark flaky test
2024-09-03 21:21:34 -07:00
Ishaan Jaff
115de195f1
Merge branch 'main' into litellm_allow_setting_route_controls 2024-09-03 17:00:22 -07:00
Ishaan Jaff
45e89f977a add test for admin only routes 2024-09-03 15:26:42 -07:00
Ishaan Jaff
0b63625673 add check for admin only routes 2024-09-03 15:03:32 -07:00
Ishaan Jaff
19dbfff620
Merge pull request #5489 from BerriAI/litellm_Add_secret_managers
[Feat] Add Google Secret Manager Support
2024-09-03 14:51:32 -07:00
Ishaan Jaff
253ef5f995 allow setting allowed routes on proxy 2024-09-03 13:59:31 -07:00
Ishaan Jaff
3c898e23ea refactor secret managers 2024-09-03 10:58:02 -07:00
Ishaan Jaff
150f3c2cfa read from .env for secret manager 2024-09-03 10:53:52 -07:00
Ishaan Jaff
b0178a85cf refactor get_secret 2024-09-03 10:42:12 -07:00
Krrish Dholakia
27090c97dd fix(proxy/_types.py): add lago 'charge_by' env var to proxy ui 2024-09-03 08:19:40 -07:00
Krish Dholakia
9f3fa29624
feat(router.py): Support Loadbalancing batch azure api endpoints (#5469)
* feat(router.py): initial commit for loadbalancing azure batch api endpoints

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

* fix(router.py): working `router.acreate_file()`

* feat(router.py): working router.acreate_batch endpoint

* feat(router.py): expose router.aretrieve_batch function

Make it easy for user to retrieve the batch information

* feat(router.py): support 'router.alist_batches' endpoint

Adds support for getting all batches across all endpoints

* feat(router.py): working loadbalancing on `/v1/files`

* feat(proxy_server.py): working loadbalancing on `/v1/batches`

* feat(proxy_server.py): working loadbalancing on Retrieve + List batch
2024-09-02 21:32:55 -07:00
Ishaan Jaff
c1adb0b7f2
Merge branch 'main' into litellm_track_imagen_spend_logs 2024-09-02 21:21:15 -07:00
Ishaan Jaff
fd122cb759 fix always read redis 2024-09-02 21:08:32 -07:00
Ishaan Jaff
35c0c07b24 fix success handler typing 2024-09-02 19:42:36 -07:00
Ishaan Jaff
bfb39eb0cd fix linting errors 2024-09-02 19:39:10 -07:00
Ishaan Jaff
a64f9f4bc0
Merge pull request #5480 from BerriAI/litellm_track_streaming_spendLogs
[Feat] Track Usage for `/streamGenerateContent` endpoint
2024-09-02 19:25:52 -07:00
Ishaan Jaff
ad10dcd3c3 fix linting error 2024-09-02 18:14:15 -07:00
Ishaan Jaff
fa6b09f147 fix linting error 2024-09-02 18:13:32 -07:00
Ishaan Jaff
4a0fdc40f1 add cost tracking for pass through imagen 2024-09-02 18:10:46 -07:00
Ishaan Jaff
811aa34a36 track image gen in spend logs 2024-09-02 17:36:25 -07:00
Ishaan Jaff
aa13977136 refactor vtx image gen 2024-09-02 17:35:51 -07:00
Ishaan Jaff
296dba8923 fix lining 2024-09-02 17:08:30 -07:00
Ishaan Jaff
f89487a496 fix linting error 2024-09-02 17:08:03 -07:00
Ishaan Jaff
eb9e4f1787 track /embedding in spendLogs 2024-09-02 17:05:53 -07:00
Ishaan Jaff
42b95c5979 code cleanup 2024-09-02 16:36:19 -07:00
Ishaan Jaff
a6d4a27207 pass through track usage for streaming endpoints 2024-09-02 16:11:20 -07:00
Ishaan Jaff
73d0a78444 use chunk_processort 2024-09-02 15:51:52 -07:00
Ishaan Jaff
fdecafd347 new streaming handler fn 2024-09-02 15:51:21 -07:00
Krish Dholakia
f9e6507cd1
LiteLLM Minor Fixes + Improvements (#5474)
* feat(proxy/_types.py): add lago billing to callbacks ui

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

* fix(anthropic.py): return anthropic prompt caching information

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

* feat(bedrock/chat.py): support 'json_schema' for bedrock models

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

* fix(bedrock/embed/embeddings.py): support async embeddings for amazon titan models

* fix: linting fixes

* fix: handle key errors

* fix(bedrock/chat.py): fix bedrock ai21 streaming object

* feat(bedrock/embed): support bedrock embedding optional params

* fix(databricks.py): fix usage chunk

* fix(internal_user_endpoints.py): apply internal user defaults, if user role updated

Fixes issue where user update wouldn't apply defaults

* feat(slack_alerting.py): provide multiple slack channels for a given alert type

multiple channels might be interested in receiving an alert for a given type

* docs(alerting.md): add multiple channel alerting to docs
2024-09-02 14:29:57 -07:00
Krish Dholakia
02f288a8a3
Azure Service Principal with Secret authentication workflow. (#5131) (#5437)
* Azure Service Principal with Secret authentication workflow. (#5131)

* Implement Azure Service Principal with Secret authentication workflow.

* Use `ClientSecretCredential` instead of `DefaultAzureCredential`.

* Move imports into the function.

* Add type hint for `azure_ad_token_provider`.

* Add unit test for router initialization and sample completion using Azure Service Principal with Secret authentication workflow.

* Add unit test for router initialization with neither API key nor using Azure Service Principal with Secret authentication workflow.

* fix(client_initializtion_utils.py): fix typing + overrides

* test: fix linting errors

* fix(client_initialization_utils.py): fix client init azure ad token logic

* fix(router_client_initialization.py): add flag check for reading azure ad token from environment

* test(test_streaming.py): skip end of life bedrock model

* test(test_router_client_init.py): add correct flag to test

---------

Co-authored-by: kzych-inpost <142029278+kzych-inpost@users.noreply.github.com>
2024-09-02 14:29:00 -07:00
Ishaan Jaff
c8fc453b75 fix pass through construct_target_url when vertex_proj is None 2024-09-02 12:51:30 -07:00