Commit Graph

19731 Commits

Author SHA1 Message Date
Ishaan Jaff 29dc67a2aa test fix anthopic completion 2025-03-06 06:42:26 -08:00
Ishaan Jaff 1de33f3443 bump: version 1.63.1 → 1.63.2 2025-03-06 00:44:05 -08:00
Ishaan Jaff f47987e673 (Refactor) /v1/messages to follow simpler logic for Anthropic API spec (#9013)
* anthropic_messages_handler v0

* fix /messages

* working messages with router methods

* test_anthropic_messages_handler_litellm_router_non_streaming

* test_anthropic_messages_litellm_router_non_streaming_with_logging

* AnthropicMessagesConfig

* _handle_anthropic_messages_response_logging

* working with /v1/messages endpoint

* working /v1/messages endpoint

* refactor to use router factory function

* use aanthropic_messages

* use BaseConfig for Anthropic /v1/messages

* track api key, team on /v1/messages endpoint

* fix get_logging_payload

* BaseAnthropicMessagesTest

* align test config

* test_anthropic_messages_with_thinking

* test_anthropic_streaming_with_thinking

* fix - display anthropic url for debugging

* test_bad_request_error_handling

* test_anthropic_messages_router_streaming_with_bad_request

* fix ProxyException

* test_bad_request_error_handling_streaming

* use provider_specific_header

* test_anthropic_messages_with_extra_headers

* test_anthropic_messages_to_wildcard_model

* fix gcs pub sub test

* standard_logging_payload

* fix unit testing for anthopic /v1/messages support

* fix pass through anthropic messages api

* delete dead code

* fix anthropic pass through response

* revert change to spend tracking utils

* fix get_litellm_metadata_from_kwargs

* fix spend logs payload json

* proxy_pass_through_endpoint_tests

* TestAnthropicPassthroughBasic

* fix pass through tests

* test_async_vertex_proxy_route_api_key_auth

* _handle_anthropic_messages_response_logging

* vertex_credentials

* test_set_default_vertex_config

* test_anthropic_messages_litellm_router_non_streaming_with_logging

* test_ageneric_api_call_with_fallbacks_basic

* test__aadapter_completion
2025-03-06 00:43:08 -08:00
Krrish Dholakia 31c5ea74ab docs: cleanup 2025-03-06 00:22:57 -08:00
Krrish Dholakia d030fb668a docs: cleanup docs 2025-03-06 00:16:32 -08:00
Krrish Dholakia 5e71dbbf8b docs: cleanup doc 2025-03-06 00:16:15 -08:00
Krrish Dholakia 320cb1d51a docs: cleanup 'signature_delta' from docs 2025-03-05 23:53:38 -08:00
Krrish Dholakia 823f4dcd9d docs(index.md): add release note for anthropic update 2025-03-05 23:50:26 -08:00
Krrish Dholakia 4b80bf0f14 bump: version 1.63.0 → 1.63.1 2025-03-05 23:41:40 -08:00
Krish Dholakia 744e10b0f0 Litellm dev 03 05 2025 p3 (#9023)
* fix(invoke_handler.py): fix converse streaming - return signature + ensure consistency with anthropic api response

* build(model_prices_and_context_window.json): fix anthropic api claude-3-7 max output tokens

with beta header this is 128k

Resolves https://github.com/BerriAI/litellm/issues/8964

* feat(handler.py): handle new anthropic 'thinking_delta' block on streaming

Fixes https://github.com/BerriAI/litellm/issues/8825
2025-03-05 22:31:39 -08:00
Krish Dholakia f6535ae6ad Support format param for specifying image type (#9019)
* fix(transformation.py): support a 'format' parameter for image's

allow user to specify mime type

* fix: pass mimetype via 'format' param

* feat(gemini/chat/transformation.py): support 'format' param for gemini

* fix(factory.py): support 'format' param on sync bedrock converse calls

* feat(bedrock/converse_transformation.py): support 'format' param for bedrock async calls

* refactor(factory.py): move to supporting 'format' param in base helper

ensures consistency in param support

* feat(gpt_transformation.py): filter out 'format' param

don't send invalid param to openai

* fix(gpt_transformation.py): fix translation

* fix: fix translation error
v1.63.0-nightly
2025-03-05 19:52:53 -08:00
Krrish Dholakia a27129798c bump: version 1.62.4 → 1.63.0 2025-03-05 19:34:53 -08:00
Krish Dholakia ec4f665e29 Return signature on anthropic streaming + migrate to signature field instead of signature_delta [MINOR bump] (#9021)
* Fix missing signature_delta in thinking blocks when streaming from Claude 3.7 (#8797)

Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>

* test: update test to enforce signature found

* feat(refactor-signature-param-to-be-'signature'-instead-of-'signature_delta'): keeps it in sync with anthropic

* fix: fix linting error

---------

Co-authored-by: Martin Krasser <krasserm@googlemail.com>
2025-03-05 19:33:54 -08:00
Krish Dholakia 17efbf0ee9 Fix #7629 - Add tzdata package to Dockerfile (#8915) (#9009)
* Add tzdata package to Dockerfile

* Move tzdata to python requirement.txt

Co-authored-by: subnet.dev <50828879+subnet-dev@users.noreply.github.com>
2025-03-05 14:45:19 -08:00
Krrish Dholakia 4578e5e620 bump: version 1.62.4 → 1.62.5 v1.62.4-nightly 2025-03-05 10:12:28 -08:00
Krrish Dholakia 3be3b802c8 fix: fix linting error 2025-03-05 10:10:53 -08:00
Ishaan Jaff 8d6815ce98 Revert "(UI) - Security Improvement, move to JWT Auth for Admin UI Sessions (#8995)"
This reverts commit 01a44a4e47.
2025-03-05 08:49:20 -08:00
Ishaan Jaff 207f41cbea docs fix router default settings 2025-03-05 08:29:21 -08:00
Krrish Dholakia 313b315791 fix: fix linting error 2025-03-05 08:26:26 -08:00
Krish Dholakia c69ec66dc5 fix(base_aws_llm.py): remove region name before sending in args (#8998)
* fix(base_aws_llm.py): remove region name before sending in args

* fix(base_aws_llm.py): fix optional param pop position

* fix: fix linting error
2025-03-04 23:05:28 -08:00
Krrish Dholakia e715c376b9 fix: fix linting error 2025-03-04 22:34:07 -08:00
Krrish Dholakia f89f50463c bump: version 1.62.3 → 1.62.4 2025-03-04 22:10:07 -08:00
Krish Dholakia 5e386c28b2 Litellm dev 03 04 2025 p3 (#8997)
* fix(core_helpers.py): handle litellm_metadata instead of 'metadata'

* feat(batches/): ensure batches logs are written to db

makes batches response dict compatible

* fix(cost_calculator.py): handle batch response being a dictionary

* fix(batches/main.py): modify retrieve endpoints to use @client decorator

enables logging to work on retrieve call

* fix(batches/main.py): fix retrieve batch response type to be 'dict' compatible

* fix(spend_tracking_utils.py): send unique uuid for retrieve batch call type

create batch and retrieve batch share the same id

* fix(spend_tracking_utils.py): prevent duplicate retrieve batch calls from being double counted

* refactor(batches/): refactor cost tracking for batches - do it on retrieve, and within the established litellm_logging pipeline

ensures cost is always logged to db

* fix: fix linting errors

* fix: fix linting error
2025-03-04 21:58:03 -08:00
Ishaan Jaff 01a44a4e47 (UI) - Security Improvement, move to JWT Auth for Admin UI Sessions (#8995)
* (UI) - Improvements to session handling logic  (#8970)

* add cookieUtils

* use utils for clearing cookies

* on logout use clearTokenCookies

* ui use correct clearTokenCookies

* navbar show userEmail on UserID page

* add timestamp on token cookie

* update generate_authenticated_redirect_response

* use common getAuthToken

* fix clearTokenCookies

* fixes for get auth token

* fix invitation link sign in logic

* Revert "fix invitation link sign in logic"

This reverts commit 30e5308cb3223981c715e723cdd3a6d2ee3aaa4b.

* fix getAuthToken

* update setAuthToken

* fix ui session handling

* fix ui session handler

* bug fix stop generating LiteLLM Virtual keys for access

* working JWT insert into cookies

* use central place to build UI JWT token

* add _validate_ui_token

* fix ui session handler

* fix fetchWithCredentials

* check allowed routes for ui session tokens

* expose validate_session endpoint

* validate session endpoint

* call sso/session/validate

* getUISessionDetails

* ui move to getUISessionDetails

* /sso/session/validate

* fix cookie utils

* use getUISessionDetails

* use ui_session_id

* "/spend/logs/ui" in spend_tracking_routes

* working sign in JWT flow for proxy admin

* allow proxy admin to access ui routes

* use check_route_access

* update types

* update login method

* fixes to ui session handler

* working flow for admin and internal users

* fixes for invite links

* use JWTs for SSO sign in

* fix /invitation/new flow

* fix code quality checks

* fix _get_ui_session_token_from_cookies

* /organization/list

* ui sso sign in

* TestUISessionHandler

* TestUISessionHandler
2025-03-04 21:48:23 -08:00
Ishaan Jaff 42931638df (bug fix) - Fix Cache Health Check for Redis when redis_version is float (#8979)
* fix allow flexible types for redis version

* test_cache_ping_with_redis_version_float

* test_cache_ping_with_redis_version_float
2025-03-04 21:26:18 -08:00
Krish Dholakia f1a44d1fdc fix(common_utils.py): handle $id in response schema when calling vert… (#8991)
* fix(common_utils.py): handle $id in response schema when calling vertex ai

Fixes issue where `$id` present in response_schema was not accepted by vertex ai

* test(test_vertex.py): add unit test to ensure $id stripped out of vertex schema
2025-03-04 21:19:50 -08:00
Krish Dholakia 662c59adcf Support caching on reasoning content + other fixes (#8973)
* fix(factory.py): pass on anthropic thinking content from assistant call

* fix(factory.py): fix anthropic messages to handle thinking blocks

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

* fix(factory.py): fix bedrock handling for assistant content in messages

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

* feat(convert_dict_to_response.py): handle reasoning content + thinking blocks in chat completion block

ensures caching works for anthropic thinking block

* fix(convert_dict_to_response.py): pass all message params to delta block

ensures streaming delta also contains the reasoning content / thinking block

* test(test_prompt_factory.py): remove redundant test

anthropic now supports assistant as the first message

* fix(factory.py): fix linting errors

* fix: fix code qa

* test: remove falsy test

* fix(litellm_logging.py): fix str conversion
2025-03-04 21:12:16 -08:00
Ishaan Jaff 4c8b4fefc9 Revert "(UI) - Improvements to session handling logic (#8970)"
This reverts commit c015fb34f1.
2025-03-04 13:29:08 -08:00
Ishaan Jaff 772c2b1fff Revert "ui new build"
This reverts commit 94563ab1e7.
2025-03-04 13:28:54 -08:00
Krrish Dholakia e40218513b docs(data_security.md): cleanup docs 2025-03-04 06:15:15 -08:00
Krrish Dholakia 5f1cac8930 docs(data_security.md): update docs 2025-03-04 06:14:54 -08:00
Krrish Dholakia 9baf4f7e56 fix: fix linting errors 2025-03-04 06:13:53 -08:00
Krish Dholakia b5beed5812 Litellm dev 03 01 2025 p2 (#8944)
* test(test_router_tag_routing.py): add unit test for tag-based routing on embeddings

* fix(router.py): pass request kwargs on async embeddings to async_get_available_deployment function

* fix(router.py): require request kwargs to always be passed in

ensures tag-based routing always works, across endpoints

* feat(langfuse_prompt_management.py): support using prompt management per langfuse project with key/team based logging

* fix: fix linting error

* fix: fix test

* fix: fix test

* fix: fix test

* fix: fix linting error
2025-03-03 23:06:11 -08:00
Krrish Dholakia 8ea3d4c046 build: merge litellm_dev_03_01_2025_p2 2025-03-03 23:05:41 -08:00
Krrish Dholakia 87dd195b51 bump: version 1.62.2 → 1.62.3 2025-03-03 23:00:24 -08:00
Krish Dholakia 2fc6262675 fix(route_llm_request.py): move to using common router, even for clie… (#8966)
* fix(route_llm_request.py): move to using common router, even for client-side credentials

ensures fallbacks / cooldown logic still works

* test(test_route_llm_request.py): add unit test for route request

* feat(router.py): generate unique model id when clientside credential passed in

Prevents cooldowns for api key 1 from impacting api key 2

* test(test_router.py): update testing to ensure original litellm params not mutated

* fix(router.py): upsert clientside call into llm router model list

enables cooldown logic to work accurately

* fix: fix linting error

* test(test_router_utils.py): add direct test for new util on router
2025-03-03 22:57:08 -08:00
Ishaan Jaff 94563ab1e7 ui new build 2025-03-03 22:21:31 -08:00
Ishaan Jaff c015fb34f1 (UI) - Improvements to session handling logic (#8970)
* add cookieUtils

* use utils for clearing cookies

* on logout use clearTokenCookies

* ui use correct clearTokenCookies

* navbar show userEmail on UserID page

* add timestamp on token cookie

* update generate_authenticated_redirect_response

* use common getAuthToken

* fix clearTokenCookies

* fixes for get auth token

* fix invitation link sign in logic

* Revert "fix invitation link sign in logic"

This reverts commit 30e5308cb3223981c715e723cdd3a6d2ee3aaa4b.

* fix getAuthToken

* update setAuthToken

* fix ui session handling

* fix ui session handler
2025-03-03 22:17:21 -08:00
Ishaan Jaff 79ed4b626e (UI) Fix session handling with cookies (#8969)
* add cookieUtils

* use utils for clearing cookies

* on logout use clearTokenCookies

* ui use correct clearTokenCookies

* navbar show userEmail on UserID page
2025-03-03 21:20:59 -08:00
Krrish Dholakia 19411fbcc7 bump: version 1.62.1 → 1.62.2 2025-03-03 14:34:48 -08:00
Krish Dholakia 94d28d59e4 Fix deepseek 'reasoning_content' error (#8963)
* fix(streaming_handler.py): fix deepseek reasoning content streaming

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

* test(test_streaming_handler.py): add unit test to streaming handle 'is_chunk_non_empty' function

ensures 'reasoning_content' is handled correctly
2025-03-03 14:34:10 -08:00
Krrish Dholakia b9bddac776 test: fix test v1.62.1-nightly 2025-03-03 13:33:39 -08:00
Krrish Dholakia db83cbe5c0 build(model_prices_and_context_window.json): add new tracking for anthropic via invoke - clarify it does not support pdf input unlike converse 2025-03-02 22:31:31 -08:00
Michael Schmid 842d8dec09 quote DailyTagSpend in order to look for the right View (#8947)
PostgreSQL treats unquoted identifiers as lowercase by default. In our query, we're using "DailyTagSpend" (with capital letters), but PostgreSQL will be looking for "dailytagspend" (all lowercase).
2025-03-02 21:36:55 -08:00
Krish Dholakia 54b7f17ca6 fix(proxy_server.py): fix setting router redis cache, if cache enable… (#8859)
* fix(proxy_server.py): fix setting router redis cache, if cache enabled on litellm_settings

enables configurations like namespace to just work

* fix(redis_cache.py): fix key for async increment, to use the set namespace

prevents collisions if redis instance shared across environments

* fix load tests on litellm release notes

* fix caching on main branch (#8858)

* fix(streaming_handler.py): fix is delta empty check to handle empty str

* fix(streaming_handler.py): fix delta chunk on final response

* [Bug]: Deepseek error on proxy after upgrading to 1.61.13-stable (#8860)

* fix deepseek error

* test_deepseek_provider_async_completion

* fix get_complete_url

* bump: version 1.61.17 → 1.61.18

* bump: version 1.61.18 → 1.61.19

* vertex ai anthropic thinking param support (#8853)

* fix(vertex_llm_base.py): handle credentials passed in as dictionary

* fix(router.py): support vertex credentials as json dict

* test(test_vertex.py): allows easier testing

mock anthropic thinking response for vertex ai

* test(vertex_ai_partner_models/): don't remove "@" from model

breaks anthropic cost calculation

* test: move testing

* fix: fix linting error

* fix: fix linting error

* fix(vertex_ai_partner_models/main.py): split @ for codestral model

* test: fix test

* fix: fix stripping "@" on mistral models

* fix: fix test

* test: fix test

---------

Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
2025-03-02 08:39:06 -08:00
Krrish Dholakia a63eb58f1b fix(anthropic/chat/transformation.py): fix headers to be a set
avoid duplicates
2025-03-02 08:36:43 -08:00
Krish Dholakia bea30f550f Fix prometheus metrics w/ custom metrics + Handle sending image_url as str to openai (#8935)
* fix(prometheus.py): fix prometheus team metric to handle custom metrics

* fix(prometheus.py): fix prometheus metrics to handle custom metadata + team id

* fix(gpt_transformation.py): handle image url being sent as str to openai

* fix: fix unit testing

* fix(o_series_transformation.py): support passing image url as string for o models as well

* (UI) Error Logs improvements - Store Raw proxy server request for success and failure (#8917)

* ui render error logs

* add proxy_server_request to spend logs metadata

* _add_proxy_server_request_to_metadata

* proxy track cost callback fixes

* _add_proxy_server_request_to_metadata

* test spend logs

* test_async_post_call_failure_hook

* (UI) - Allow Internal Users to View their own logs (#8933)

* ui fix leftnav, allow internal users to view their own logs

* pass user_id in uiSpendLogs call

* ui filter logs for internal user

* fix internal users page

* ui show correct message when store prompts is disabled

* fix internal user logs

* test_ui_view_spend_logs_with_user_id

* test spend management endpoint

* ui new build

* Add `supports_pdf_input: true` for specific Bedrock Claude models (#8655)

---------

Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
Co-authored-by: Takashi Iwamoto <takashi.iwamoto@enechange.co.jp>
2025-03-02 08:32:21 -08:00
Krrish Dholakia 4418e6dd14 build: merge branch 2025-03-02 08:31:57 -08:00
Takashi Iwamoto f63cf00306 Add supports_pdf_input: true for specific Bedrock Claude models (#8655) 2025-03-02 08:14:05 -08:00
Ishaan Jaff 88b1e315c8 ui new build 2025-03-01 17:52:14 -08:00