Commit graph

26247 commits

Author SHA1 Message Date
Mritunjay Kumar Sharma
8b0e3c14ff
chore(docker): remove redundant Admin UI build step
The Admin UI is already built before packaging, so the second invocation of docker/build_admin_ui.sh after PyJWT adjustments was unnecessary. Removing it speeds up the builder stage, reduces cache invalidation, and doesn’t change the resulting wheel or runtime image.
2025-09-18 11:09:20 -05: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
Ishaan Jaffer
09d63a00e2 fix: cohere generate api is deprecated 2025-09-18 07:40:28 -07:00
Ishaan Jaffer
da95e208da fix: BedrockCountTokensHandler 2025-09-18 07:32:33 -07:00
Ishaan Jaffer
7b5dd5c7d1 fix: cohere generate api is deprecated 2025-09-18 07:29:11 -07:00
Ishaan Jaff
759bb6cff5
fix: cohere generate api is deprecated (#14676) 2025-09-18 07:27:51 -07:00
Tim Elfrink
c9daf3bc8e update tests 2025-09-18 15:52:59 +02:00
Fabrício Ceschin
cb3bed1d96
Merge branch 'BerriAI:main' into LangfuseUsageDetails 2025-09-18 09:38:52 -04:00
Adam Tao
9b0eaf0989 test: add a testcase for cached_tokens
Signed-off-by: Adam Tao <tcx4c70@gmail.com>
2025-09-18 18:40:11 +08:00
Adam Tao
f11083e992 fix: Fix cost calculation for responses
Signed-off-by: Adam Tao <tcx4c70@gmail.com>
2025-09-18 18:31:41 +08:00
Tim Elfrink
cb573f61c8 Document model_id parameter for Bedrock inference profiles with image generation
Add documentation for using AWS Bedrock Application Inference Profiles
with image generation APIs, specifically for Nova Canvas models.

The documentation includes:
- SDK examples showing model_id parameter usage
- Proxy configuration examples
- Follows the same pattern as chat completions inference profiles
2025-09-18 10:57:12 +02:00
Tim Elfrink
c30c775e63 Fix Nova Canvas model_id parameter handling for consistency
Follow the same pattern as chat completions and embeddings by extracting
model_id from optional_params into a variable, even though it's not used
in image generation. This maintains code consistency across Bedrock services.
2025-09-18 10:32:18 +02:00
Michael Tan
6721189b7c
feat: add Asia/Bangkok timezone support for budget resets
- Add Asia/Bangkok (UTC+7) to timezone_map in duration_parser.py
- Update documentation to include Bangkok in common timezone values
- Add test case to verify Bangkok timezone functionality
2025-09-18 14:56:12 +07:00
Tim Elfrink
27a37ce57e Use requestMetadata parameter name for consistency with other Bedrock params
- Change parameter from request_metadata to requestMetadata to match camelCase convention
- Consistent with guardrailConfig and performanceConfig naming pattern
- Update all references in transformation code and error messages
- Update tests and documentation to use correct parameter name
- Fix type checking for parameter validation
2025-09-18 09:21:45 +02:00
Tim Elfrink
352a0eedb5 refactor: Extract helper methods to fix linting issues
- Split _transform_request_helper into smaller focused methods
- Extract _prepare_request_params for parameter preparation logic
- Extract _process_tools_and_beta for tool processing logic
- Resolve PLR0915 (too many statements) linting issue
- Maintain all existing functionality and test compatibility
2025-09-18 09:21:45 +02:00
Tim Elfrink
a34bb6f6d3 Implement requestMetadata support for Bedrock Converse API
- Add requestMetadata field to CommonRequestObject type definition
- Support request_metadata parameter in get_supported_openai_params
- Add comprehensive validation for AWS Bedrock constraints:
  * Maximum 16 key-value pairs
  * Key length 1-256 characters
  * Value length 0-256 characters
  * Character set validation [a-zA-Z0-9\s:_@0=/+,.-]
- Transform request_metadata to top-level requestMetadata field in API request
- Maintain backward compatibility with existing functionality
- Enable metadata logging and traceability for multi-cloud environments
2025-09-18 09:21:45 +02:00
Tim Elfrink
1d85623b66 Add comprehensive tests for Bedrock Converse requestMetadata support
- Test requestMetadata parameter support in get_supported_openai_params
- Test transformation to top-level field in Bedrock API request
- Test validation of AWS constraints: max 16 items, key/value length limits
- Test character set validation for keys and values
- Cover edge cases including empty values and special characters
- Ensure compatibility with existing test patterns
2025-09-18 09:21:45 +02: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
7538fc0def Fix mypy type annotations in transformation.py
- Add explicit type annotation for transformed_message dict
- Resolves mypy errors while maintaining functionality
- All tests continue to pass
2025-09-18 08:34:05 +02: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
c620d76fe4 fix(team_callback_endpoints.py): fix adding callbacks to teams
Resolves error caused by the migration to a standard 'logging' field in metadata
2025-09-17 19:01:34 -07:00
Krrish Dholakia
83522016f2 feat(langsmith.py): add per request sampling_rate support
allows setting langsmith sampling rate per team/per key

Closes LIT-879
2025-09-17 18:39:34 -07:00
Krrish Dholakia
e5c1d09937 feat(langsmith.py): add langsmith sampling rate
Closes LIT-879
2025-09-17 18:02:33 -07:00
Krrish Dholakia
7a1f723751 test: update test 2025-09-17 18:00:59 -07:00
=
40fa415c89 added test for updating in memory guardrails 2025-09-17 18:00:59 -07:00
=
36e01b7881 updates in memory custom guardrail liteLLM params 2025-09-17 18:00:59 -07:00
Mubashir Osmani
dc267e9032 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 18:00:59 -07:00
Ishaan Jaffer
d8d33853d5 docs fix posthog 2025-09-17 18:00:59 -07:00
Krrish Dholakia
32c6019ecc fix(_health_endpoints.py): protect /health/test_connection - only allow users who are allowed to create models, to call this endpoint
Closes LIT-989
2025-09-17 18:00:59 -07:00
Krrish Dholakia
fc18f4decf test: add unit testing 2025-09-17 18:00:59 -07:00
Krrish Dholakia
1598d3e955 fix(bedrock_guardrails.py): respect bedrock runtime endpoint when using guardrails
Closes LIT-983
2025-09-17 18:00:58 -07:00
Krrish Dholakia
4276d78169 test: fix test on ci/cd 2025-09-17 18:00:58 -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
Krrish Dholakia
adc71ad2e7 fix(langsmith.py): add langsmith_sampling_rate as a dynamic param
Closes LIT-879
2025-09-17 17:32:26 -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
Ishaan Jaffer
e2be7e0b1f docs fix posthog 2025-09-17 17:02:23 -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
=
66202d0ab7 updates in memory custom guardrail liteLLM params 2025-09-17 16:28:05 -07:00
Krrish Dholakia
2f45c7ffd3 feat(anthropic/chat/transformation.py): account for 1h vs. 5m cache creation token cost difference
Closes LIT-907
2025-09-17 16:16:20 -07:00
Krrish Dholakia
e32ce6b053 feat(anthropic/chat/transformation.py): separate 5m vs. 1h cache creation token details for anthropic cost tracking 2025-09-17 15:51: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