Commit Graph

3206 Commits

Author SHA1 Message Date
Krish Dholakia f387803655 Merge pull request #14658 from ARajan1084/bedrock-custom-guardrail-fix
fix: check for AWS exceptions despite a 200 response
2025-09-18 18:34:32 -07:00
Alexsander Hamir 60800698f2 feature: generic object pool (#14702)
* add: generic object pool & tests

Introduced a reusable object pool that can be applied across the codebase.
Note: memory growth is managed via eviction settings—using a hard cap could
reduce performance, so eviction is the preferred safeguard.

* fix: simpler tests
2025-09-18 18:32:45 -07:00
Alexsander Hamir 59409429d4 fix: reduced __inits__ overhead in 7% (#14689)
* fix: avoid redundant __init__ calls on hot path

Previously, imports on the request hot path caused __init__ to run
excessively for every request. This change ensures initialization
happens once, reducing cpu overhead.

* fix: remove redundant __init__ import

The current implementation no longer requires an import at the top of the function.

* fix: placed on core utils for future reuse

* test: add coverage & remove inline import

A general import-checking tool across all endpoints would be a large PR.
This commit focuses on a smaller, targeted fix for the discussed case.

* added import check to CI
2025-09-18 17:18:05 -07:00
Ishaan Jaff 4c983f985a [Feat] Add Bedrock Twelve Labs embedding provider support (#14697)
* fix: add 12 labs to bedrock embedding

* fix: get_bedrock_embedding_provider

* test: test_text_embedding

* fix: 12 labs embedding transform

* fix: refactor 12 labs transform logic

* fix: test_e2e_bedrock_embedding

* fix: test_e2e_bedrock_embedding

* feat: add bedrock twelvelabs pricing

* DOCS: docs bedrock embedding

* DOCS: 12 labs bedrock overview

* fix: bedrock embeddings 12 labs
2025-09-18 17:16:45 -07:00
katsuhiro muto ec61a7152a Support for is_streamed_request widh datadog (#14673) 2025-09-18 15:55:16 -07:00
= a3f0a3c05f Update test_bedrock_guardrails.py 2025-09-18 15:51:42 -07:00
= 911918474a removed duplicate code 2025-09-18 15:49:16 -07:00
= 917c8bb43c Update test_bedrock_guardrails.py 2025-09-18 15:42:41 -07:00
= a86b9a1808 check for AWS exceptions despite a 200 response 2025-09-18 15:42:36 -07:00
Mubashir Osmani a7a6381926 fix: flaky passthrough tests (#14692)
* fix: flaky passthrough tests

* Revert "fix: flaky passthrough tests"

This reverts commit ffe692e017600a8853ab7c31f95485958ab74c5f.

* fix: serialize prisma objects
2025-09-18 15:35:14 -07:00
Ishaan Jaffer e733b619db fix: test_user_email_in_all_required_metrics 2025-09-18 11:23:13 -07:00
Sameer Kankute 36bedc69ff Add TwelveLabs marengo model (#14674) 2025-09-18 11:21:35 -07:00
Sameer Kankute d213a2e066 correct the gaurdcontent name (#14684)
* correct the gaurdcontent name

* correct the gaurdcontent name

* fix model required error in test

* Add correct model
2025-09-18 11:00:19 -07:00
Ishaan Jaffer e0bbc3f46b fix: test_cohere_request_body_with_allowed_params 2025-09-18 10:56:45 -07:00
Ishaan Jaffer 8296bfb866 fix: test metrics 2025-09-18 10:25:22 -07:00
Ishaan Jaffer c6afa904bb fix: test_completion_with_no_model 2025-09-18 10:17:09 -07:00
Ishaan Jaffer 1e1d174733 fix: test_completion_with_no_model 2025-09-18 10:13:32 -07:00
Ishaan Jaffer 706b9214c0 fix: test_init_kwargs_for_pass_through_endpoint_basic 2025-09-18 07:59:05 -07:00
Ishaan Jaffer 3018c66867 fix: test_awesome_otel_with_message_logging_off 2025-09-18 07:49:39 -07:00
Krish Dholakia bfaab8ad7e Merge pull request #14557 from timelfrink/fix/issue-14478-bedrock-count-tokens-endpoint
Implement AWS Bedrock CountTokens API support
2025-09-17 23:51:06 -07:00
Krish Dholakia ff36dfdc76 Merge pull request #14637 from akraines/feature/middle-truncate-spend-logs
feat: implement middle-truncation for spend log payloads
2025-09-17 23:47:04 -07:00
Krish Dholakia e7bc700b20 Merge pull request #14640 from Sameerlite/litellm_gardrail_default_latest_message
[Feat]Add last message as default in gaurdrail
2025-09-17 23:42:40 -07:00
Tim Elfrink c234b13275 Apply code formatting and linting fixes
- Apply Black formatting to all Bedrock CountTokens files
- Clean up imports and remove unused variables in tests
- Fix indentation and simplify test structure
- Fix pyright type error with type ignore annotation
- All tests continue to pass after cleanup
2025-09-18 08:28:17 +02:00
Tim Elfrink e74ac35b5d Add comprehensive tests for Bedrock CountTokens functionality
- Add endpoint integration test in test_proxy_token_counter.py
- Add unit tests for transformation logic in bedrock/count_tokens/
- Test model extraction from request body vs endpoint path
- Test input format detection (converse vs invokeModel)
- Test request transformation from Anthropic to Bedrock format
- All tests follow existing codebase patterns and pass successfully
2025-09-18 08:16:56 +02:00
Sameerlite edf95966c9 Handle consecutive user messages 2025-09-18 10:35:25 +05:30
Alexsander Hamir 8d96626044 fix: iscoroutine removed from hot path +50 RPS (#14649)
* fix: iscoroutine removed from hot path

* fix: replace all instances & separate concerns

1. Replaced all instances of iscoroutine with is_async_callable
2. Place the coroutine checker in its own file

* fix: PR comment changes

* fix: missing config setting declaration

* fix: revert non-performance related changes

* fix: revert to initial implementation

* fix: remove dead const
2025-09-17 19:01:43 -07:00
Krrish Dholakia 00d8dedd16 test: update test 2025-09-17 17:44:14 -07:00
Krish Dholakia 44e0c730b9 Merge pull request #14653 from ARajan1084/in-memory-guardrail-fix
fix: In Memory Guardrail fails to update
2025-09-17 17:42:23 -07:00
= 268b984cb6 added test for updating in memory guardrails 2025-09-17 17:16:49 -07:00
Mubashir Osmani 8b804303ed fix: ci/cd tests + lint errors (#14646)
* fix: lint errors + tests

* fixed ci tests

* fixed tests

---------

Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
2025-09-17 17:06:43 -07:00
Krish Dholakia f51003538a Merge pull request #14650 from BerriAI/litellm_dev_09_17_2025_p1
Bedrock Guardrails - support setting bedrock runtime endpoint + Protect `/health/test_connect` to prevent users without model creation permissions from calling it
2025-09-17 16:55:53 -07:00
Krrish Dholakia 1954bbffc0 test: fix test on ci/cd 2025-09-17 16:53:07 -07:00
Krish Dholakia 895c41efa3 Merge pull request #14619 from BerriAI/litellm_dev_09_16_2025_p1
UI - allow team member to view service account keys they create + Anthropic - include cache creation tokens in prompt token total (separate out during cost tracking)
2025-09-17 15:43:04 -07:00
Krrish Dholakia 530662d735 test: add unit testing 2025-09-17 14:54:44 -07:00
Sameer Kankute 69c01488bd remove not needed names (#14641) 2025-09-17 14:26:48 -07:00
Krrish Dholakia 08ba38adeb test: update unit test 2025-09-17 14:23:13 -07:00
Sameerlite 1371abf880 add last message as default in gaurdrail 2025-09-17 21:08:19 +05:30
Carlos Marchal e168161e64 Feat/add posthog observability (#14610)
* feat: add posthog observability

* docs: add posthog logging docs

* docs: posthog integration in proxy mode
2025-09-17 08:24:04 -07:00
Akiva Kraines 115a3e9ded feat: implement middle-truncation for spend log payloads
- Change truncation strategy from head-only to middle-truncation (35% start, 65% end)
- Preserve both beginning and end of long strings for better debugging context
- Apply same sanitization to response payloads when store_prompts_in_spend_logs is enabled
- Increase default MAX_STRING_LENGTH_PROMPT_IN_DB from 1000 to 2048 characters
- Update tests to verify new truncation behavior with 35%-65% split

This provides better diagnostic value by keeping the more important end context
while still maintaining storage limits.
2025-09-17 16:30:25 +03:00
Krish Dholakia bf0dd4a284 Merge pull request #14418 from iabhi4/deep-copy-issue
fix: avoid deepcopy crash with non-pickleables in Gemini/Vertex
2025-09-16 22:55:31 -07:00
Krish Dholakia 2563c0ab2d Merge pull request #14534 from hula-la/fix/response-api-bugfixes
fix: improve response api handling and cold storage configuration
2025-09-16 22:46:03 -07:00
Krish Dholakia fcf84027e8 Merge pull request #14555 from mubashir1osmani/dd_spend_metric
DataDog shows spend metrics
2025-09-16 22:44:47 -07:00
Krish Dholakia 635dc72211 Merge pull request #14604 from Sameerlite/litellm_gemini_api_base_update
Litellm gemini api base update
2025-09-16 22:38:44 -07:00
Krish Dholakia 6bccdcd530 Merge pull request #14620 from BerriAI/litellm_dev_09_16_2025_p2
(feat) Anthropic - document pricing for cache creation tokens above 1hr
2025-09-16 22:33:11 -07:00
Krrish Dholakia 8273630e08 test: update tests 2025-09-16 22:30:40 -07:00
Mubashir Osmani 0fde408e35 added langfuse logging for responses api (#14597)
* added langfuse logging for responses api

* tests added
2025-09-16 21:43:19 -07:00
mubashir1osmani e56b11cb54 added tests 2025-09-17 00:19:03 -04:00
Krrish Dholakia 0e747aaaf1 test: fix test 2025-09-16 19:20:12 -07:00
Ishaan Jaff 93524cf19b [Feat] Batches - Add bedrock retrieve endpoint support (#14618)
* feat: add bedrock retrieve endpoint

* feat: feat: add bedrock retrieve endpoint

* test: batches mocked transform

* ruff fix

* refactor

* fix transform

* fix: parse_timestamp
2025-09-16 19:19:02 -07:00
Krrish Dholakia 22d3e492f9 fix(test_utils.py): fix test 2025-09-16 19:17:44 -07:00