Commit graph

971 commits

Author SHA1 Message Date
stuxf
a6c30b30bf
build: migrate packaging, CI, and Docker from Poetry to uv (#25007)
* build: migrate packaging metadata to uv

* ci: move automation and local tooling to uv

* docker: migrate image builds and runtime setup to uv

* docs: update install and deployment guidance for uv

* chore: align auxiliary scripts and tests with uv

* test: harden test_litellm isolation

* fix: keep release and health check images self-contained

* build: pin uv tooling and health check deps

* test: isolate bedrock image request formatting from suite state

* test: cover sandbox executor requirements flow

* ci: fix circleci no-op command steps

* ci: fix circleci publish workflow parsing

* fix: stabilize remaining uv migration CI checks

* ci: increase matrix test timeout headroom

* fix: restore published docker and license coverage

* fix: restore proxy runtime build parity

* fix: restore proxy extras parity and venv migrations

* ci: persist uv path across circleci steps

* fix: keep psycopg binary in default test env

* docker: preserve prisma cache across stages

* test: run local proxy checks through uv python

* build: restore runtime deps moved into ci

* build: refresh uv lock after upstream merge

* fix: restore module import in test_check_migration after merge

The conflict resolution imported only the function but the test body
references check_migration as a module throughout.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: revert dependency promotions, remove nodejs-wheel-binaries, fix Docker layer caching

- Move google-generativeai, Pillow, tenacity back to ci group (they are
  lazily imported and bloat the base SDK install needlessly)
- Remove nodejs-wheel-binaries from extra_proxy and proxy-dev (redundant
  in Docker where system Node.js is already installed via apk)
- Remove all nodejs-wheel node replacement and venv npm patching blocks
  from Dockerfiles since the wheel is no longer installed
- Add --no-default-groups to CodSpeed benchmark workflow so the benchmark
  environment matches the old minimal pip install footprint
- Apply standard uv two-phase Docker pattern: copy metadata first, install
  deps (cached layer), then copy source and install project
- Replace CircleCI enterprise no-op with proper uv sync command

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: regenerate uv.lock after removing nodejs-wheel-binaries

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(ci): use cache/restore instead of cache to prevent cache poisoning

The old workflow used actions/cache/restore (read-only). The uv migration
changed it to actions/cache (read-write), which zizmor flags as a cache
poisoning risk. Restore the safer read-only variant.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(ci): disable setup-uv built-in cache to silence cache-poisoning alert

The setup-uv action enables caching by default, which zizmor flags as a
cache poisoning risk. Disable it since we already use a read-only
cache/restore step.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(ci): disable setup-uv cache in publish workflow

Silences zizmor cache-poisoning alert. Publishing workflow runs
infrequently on protected branches so caching adds no real benefit.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(test): remove duplicate verbose_logger mock in test_check_migration

The logger was patched twice — first via mocker.patch() then via
mocker.patch.object(autospec=True). The second call fails because
autospec cannot inspect an already-mocked attribute. Remove the
redundant first patch.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(ci): free disk space before Docker build in test-server-root-path

The Dockerfile.non_root build ran out of disk on the CI runner. Remove
Android SDK, .NET, Boost, and GHC toolchains (~12GB) to free space.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 11:46:23 -07:00
Sameer Kankute
ec9102107a
fix(bedrock): custom tool schemas and missing tool names for Converse
Normalize JSON Schema type custom to object for Bedrock invoke and
_bedrock_tools_pt, ensure stable names for tools without name, and
avoid KeyError in the Anthropic messages adapter when translating
tools to OpenAI format for bedrock/converse.

Made-with: Cursor
2026-04-09 10:39:00 +05:30
Sameer Kankute
8f4676a6a9
feat(bedrock): normalize custom tool JSON schema for Invoke and Converse
Anthropic/Claude Code use input_schema.type "custom"; Bedrock rejects it.
- Add normalize_json_schema_custom_types_to_object and use it for Invoke,
  chat invoke, and _bedrock_tools_pt (Anthropic input_schema + OpenAI params).
- Coerce invalid root types to object for Converse toolSpec.
- Tests for invoke transform, converse _bedrock_tools_pt, and unit helper.

Made-with: Cursor
2026-04-09 09:53:59 +05:30
Sameer Kankute
6e6f5be3e4
feat(triton): add embedding usage estimation for self-hosted responses (#25345)
* feat(triton): add embedding usage estimation for self-hosted responses

Populate Triton embedding usage from request input using token counting with a safe fallback so cost/observability flows work even when provider usage is missing.

Made-with: Cursor

* fix(triton): sum per-input embedding token counts for batches

Joining batch strings with newlines before token_counter added spurious
tokens. Count each input separately and sum, matching OpenAI-style usage.

Made-with: Cursor
2026-04-08 21:14:27 -07:00
yuneng-jiang
3604b600d3
[Infra] Merge internal dev branch with main (#25036)
* fix(proxy): enforce key-level model allowlist for custom auth

custom_auth_run_common_checks only runs common_checks (team/user/project model checks).
Custom auth now also enforces key-level model restrictions via can_key_call_model.

Move the custom-auth key-access regression tests to test_user_api_key_auth.py and keep test_custom_auth_end_user_budget.py focused on end-user budget behavior.

Made-with: Cursor

* fix(proxy): gate custom-auth key model checks behind opt-in

Keep key-level model allowlist enforcement in custom auth behind `custom_auth_run_common_checks` to preserve backwards compatibility, and update tests to verify default non-enforcement and opt-in enforcement behavior.

Made-with: Cursor

* test(proxy): isolate custom auth default check from shared settings state

Patch `proxy_server.general_settings` to an empty dict in the default custom-auth key-access test so it remains deterministic under shared module state.

Made-with: Cursor

* test(proxy): strengthen custom auth post-check assertions

Tighten custom auth regression tests by asserting exact can_key_call_model args and remove an unused common_checks mock from the default behavior path.

Made-with: Cursor

* fix(agentcore): parse A2A JSON-RPC responses in AgentCore provider

* fix(prompt-templates): ensure_alternating_roles handles tool-call chains

* feat(auth): add JWT claim routing overrides for OAuth2 validation

Made-with: Cursor

* docs(auth): document JWT-to-OAuth2 routing overrides

Add generic docs for running JWT and OAuth2 together, including routing_overrides YAML examples and list-based selector behavior for iss/client_id/aud.

Made-with: Cursor

---------

Co-authored-by: Milan <milan@berri.ai>
Co-authored-by: michelligabriele <gabriele.michelli@icloud.com>
2026-04-02 16:38:01 -07:00
David Chen
b7ccc5b691
[Test Fix] fix gov pricing tests (#25022)
* fix pricing tests

* fix mypy

* fix cost expectation since us based model is used now.

* fix test get model info
2026-04-02 15:55:55 -07:00
Krrish Dholakia
cae8613660
Announce April Townhall (#25021)
* fix: replace hardcoded url

* docs: announce april townhall
2026-04-02 14:10:49 -07:00
David Chen
d1df4e838b
Litellm fix update bedrock models (#24947)
* update bedrock models in tests

* updated more tests and model_prices_and_context_window

* fix model id and pricing

* replace more sonnet models

* update tests

* git push

* update pricing

* flaky total cost

* monkey patch

* relax the cost change

* fix and revert some changes

* revert the pricing

* chore: move cost/pricing changes to bedrock-cost-fixes branch

* chore: split Bedrock file-api beta stripping to separate branch

Removes strip_unsupported_file_api_betas_for_bedrock_invoke from this branch;
see litellm_bedrock_invoke_strip_file_api_betas for that fix.

Made-with: Cursor
2026-04-01 19:22:54 -07:00
ishaan-berri
e4442a4d98
test fix us.anthropic.claude-haiku-4-5-20251001-v1:0 (#24931)
* test fix us.anthropic.claude-haiku-4-5-20251001-v1:0

* ignore mypy cache files

---------

Co-authored-by: Ishaan Jaffer <ishaanjaffer0324@gmail.com>
Co-authored-by: David Chen <clfhhc@gmail.com>
2026-04-01 11:01:03 -07:00
Ishaan Jaffer
0ea05469bc test_completion_azure 2026-03-30 21:54:27 -07:00
Ishaan Jaffer
823e7b2a9d test_completion_azure 2026-03-30 21:36:35 -07:00
Ishaan Jaffer
9b46d88371 test_completion_azure 2026-03-30 21:07:41 -07:00
Ishaan Jaffer
7954d1a11f test_azure_ai_model_router_streaming_cost_with_stream_options 2026-03-30 19:12:01 -07:00
Ishaan Jaffer
7e93256da4 test_bedrock_document_understanding 2026-03-30 18:39:20 -07:00
Yuneng Jiang
2b374a2abf
Merge main and resolve Snowflake test conflict
Main rewrote the same tests we moved. Resolution: keep the tests only
in the unit test directory, adopting main's improved patterns (AsyncMock,
assert_called_once, stronger content assertions on streaming).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 18:06:37 -07:00
Yuneng Jiang
19f8b58046
[Test] Move mocked Snowflake chat completion tests to unit test directory
Move test_chat_completion_snowflake and test_chat_completion_snowflake_stream
from tests/llm_translation/ to tests/test_litellm/llms/snowflake/chat/ so
they run as part of `make test-unit` without requiring API credentials.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 18:03:00 -07:00
Krrish Dholakia
949a395b01 test: use env var azure model router api base 2026-03-30 18:02:43 -07:00
Krrish Dholakia
ee4ded4c44
Merge pull request #24445 from quora/fix/missing-content-part-added
fix(responses): emit content_part.added event for non-OpenAI models
2026-03-30 17:52:40 -07:00
Ishaan Jaffer
42efaa597e test fix 2026-03-30 16:43:49 -07:00
Ishaan Jaffer
a449e322c0 test_completion_cloudflare 2026-03-30 16:40:37 -07:00
Ishaan Jaffer
3a0ebda867 test snowflake 2026-03-30 16:39:06 -07:00
yuneng-jiang
f2deefe453
Merge pull request #24814 from BerriAI/litellm_/agitated-montalcini
[Fix] WatsonX Tests Failing on CI Due to Missing Env Vars
2026-03-30 14:35:51 -07:00
yuneng-jiang
bcfa5355ac
Merge pull request #24817 from BerriAI/litellm_/strange-jackson
[Fix] Update gemini-2.0-flash to gemini-2.5-flash in test_gemini
2026-03-30 14:05:23 -07:00
Yuneng Jiang
b39748daf2
[Fix] Update gemini-2.0-flash to gemini-2.5-flash in test_gemini integration tests
gemini-2.0-flash is no longer available to new users, causing 404 errors
in llm_translation_testing tests.
2026-03-30 13:53:38 -07:00
Yuneng Jiang
123052ecf8
[Fix] WatsonX tests failing on CI due to missing env vars
Tests are fully mocked but require WATSONX_URL and WATSONX_PROJECT_ID
to pass provider validation before reaching the mocked HTTP client.
Add an autouse fixture with dummy values and clear WATSONX_ZENAPIKEY/
WATSONX_TOKEN to prevent env leakage from dotenv.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 13:27:03 -07:00
Krrish Dholakia
5671baaadf fix: fix setup wizard 2026-03-30 09:06:31 -07:00
Krrish Dholakia
25f2baad71 test: cleanup dead tests 2026-03-28 20:49:02 -07:00
Krrish Dholakia
a92b31a636 test: remove dead tests 2026-03-28 20:36:08 -07:00
Krrish Dholakia
0fef88d67c test: remove dead tests 2026-03-28 20:23:44 -07:00
Krrish Dholakia
cdcab8a243 refactor: cleanup deprecated models 2026-03-28 19:39:11 -07:00
Krrish Dholakia
bc829d51f2 test: test 2026-03-28 19:17:38 -07:00
Krrish Dholakia
5cd8ca2365 refactor: refactor testing 2026-03-28 18:39:32 -07:00
Sameer Kankute
38e8003297
fix(anthropic): strip undocumented keys from metadata before sending to API 2026-03-27 20:42:16 +05:30
Lei Nie
1716956520 test(responses): update expected events and add mock test for content_part.added
- Update test_anthropic_via_responses_api expected_events to include
  CONTENT_PART_ADDED between OUTPUT_ITEM_ADDED and OUTPUT_TEXT_DELTA
- Add TestEnsureOutputItemContentPartAdded with 3 mock tests:
  message item emits content_part.added, reasoning item does not,
  and the event is only emitted once
2026-03-23 22:29:50 +00:00
yuneng-jiang
72fba093c8 Merge remote-tracking branch 'origin/main' into litellm_dev_sameer_16_march_week 2026-03-21 15:11:29 -07:00
yuneng-jiang
10b0139bf8
Merge branch 'main' into litellm_oss_staging_03_05_2026 2026-03-21 14:58:11 -07:00
Sameer Kankute
0673c57fef
Merge pull request #23939 from Sameerlite/Sameerlite/azure-ai-annotations
fix(azure-ai-agents): preserve annotations in Bing Search grounding responses
2026-03-20 23:33:08 +05:30
Sameer Kankute
ecfcf241c6
Merge pull request #24119 from BerriAI/main
merge main
2026-03-19 15:53:32 +05:30
Sameer Kankute
f29b4981a0 fix(prompting): preserve separator for assistant(tc)->assistant edge case
When scanning backward over counted messages, preserve old behavior for
adjacent assistant turns by inserting user_continue if the immediate
previous raw message is assistant. This handles malformed
assistant(tool_calls)->assistant(no-tool-calls) inputs without splitting
valid assistant(tool_calls)->tool chains.

Made-with: Cursor
2026-03-18 17:13:42 +05:30
Sameer Kankute
22fc08d602 fix(prompting): revert _insert_assistant_continue_message to adjacent-check logic
Restore backward-compatible behavior: only insert assistant_continue
between directly adjacent user messages, not across tool-call chains.
The _counts_for_alternation skip logic was a silent behavioral change
for [user, assistant(tc), tool, user] sequences.

Made-with: Cursor
2026-03-18 16:59:16 +05:30
Sameer Kankute
67f5ce9c7c address greptile review feedback (greploop iteration 1)
- Restore backward compat for leading assistant(tool_calls) — always prepend user_continue
- Replace partial assertions with full list assertion in trailing tool-call test

Made-with: Cursor
2026-03-18 16:41:26 +05:30
Sameer Kankute
0941e40363 fix(prompting): address greptile review - fix SyntaxError, restore backward compat, add trailing tool-call test
- Remove stray ): on line 303 (P0 SyntaxError)
- Restore backward-compatible trailing-assistant behavior (P1)
- Add test_ensure_alternating_roles_trailing_tool_call_assistant
- Keep role check alongside _counts_for_alternation (P2 is false positive)

Made-with: Cursor
2026-03-18 16:30:42 +05:30
Sameer Kankute
ae350ed370 Fix greptile comments 2026-03-18 16:10:33 +05:30
Sameer Kankute
f1421d1082 fix(prompting): preserve tool chains in alternation insertion
Avoid inserting assistant continue messages in the middle of assistant tool_call->tool chains by inserting before the next counted user turn, and add regression coverage for this edge case.

Made-with: Cursor
2026-03-18 15:55:51 +05:30
Sameer Kankute
3cdabff323 Fix greptile review 2026-03-18 15:45:09 +05:30
Sameer Kankute
b9266bb3b9 Fix ensure_alternating_roles for correct order 2026-03-18 15:25:57 +05:30
Sameer Kankute
6fe3188af0 fix(azure-ai-agents): accumulate annotations from multiple text items in streaming
- Fix bug where only last text item's annotations were preserved when
  thread.message.completed contained multiple text content items
- Accumulate annotations via extend() instead of overwriting
- Add test_azure_ai_agents_streaming_annotations_from_completed_message
- Add test_azure_ai_agents_streaming_accumulates_annotations_from_multiple_text_items

Addresses Greptile review on PR #23849

Made-with: Cursor
2026-03-18 09:04:00 +05:30
Sameer Kankute
8eb8756e84 fix: Preserve annotations in Azure AI Foundry Agents responses
Azure AI Agents with Grounding (e.g., Bing Search) include annotations
(citation URLs) in responses, but the handler was dropping them during
transformation. This fix:

- Extracts annotations from text content in agent responses
- Transforms them to OpenAI-compatible ChatCompletionAnnotation format
- Passes annotations through all completion paths (sync, async, streaming)
- Handles both polling and SSE streaming responses

Fixes #19126

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-03-17 15:55:41 +05:30
Awais Qureshi
84b4af40fa
fix(fireworks): skip #transform=inline for base64 data URLs (#23729)
* fix(fireworks): skip #transform=inline for base64 data URLs

Closes #23583

Appending #transform=inline to a data: URL corrupted the base64 payload,
causing binascii.Error (Incorrect padding) when Fireworks AI attempted to
decode the image. Data URLs are already inlined so the fragment is a no-op
anyway — guard both the str and dict image_url branches to skip the suffix
when the URL starts with "data:".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(fireworks): skip #transform=inline for base64 data URLs

  Closes #23583

* fix(fireworks): skip #transform=inline for base64 data URLs

  Closes #23583

* fix(fireworks): skip #transform=inline for base64 data URLs

  Closes #23583

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
2026-03-16 22:30:18 -07:00
yuneng-jiang
8f56ddb9c6 Merge remote main into litellm_ci_optimize
Resolved conflict in test_claude_agent_sdk.py by keeping main's additions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-16 00:50:22 -07:00