Commit graph

60 commits

Author SHA1 Message Date
yuneng-jiang
5c95017bc1
test: unstale the reasoning-effort grid count and the responses bridge test (#34868)
* test(reasoning-effort-grid): bump cell-count assertion for claude-opus-5

The claude-opus-5 grid entry added in ae81625ee6 raised the Anthropic direct
route to 31 model combos, but test_grid_cell_count still expected 30, so the
suite went red on the tripwire rather than on any behavior change.

* test(openai): swap the retired deep-research model out of the bridge test

OpenAI shut down o3-deep-research and o4-mini-deep-research on 2026-07-23, so
the live call in this test now comes back as a 400 'Model not found'. The test
was never about deep research specifically; the bridge fires on any model whose
cost-map mode is "responses", so it now uses gpt-5.5-pro, the newest
responses-only OpenAI model, and is renamed to say that.

gpt-5.5-pro was confirmed present on the CI account with an authenticated
GET /v1/models before being picked.
2026-07-27 18:07:04 -07:00
Yuneng Jiang
a1aae953d6
test: replace deprecated gpt-5-codex with gpt-5.3-codex 2026-07-24 10:43:45 -07:00
yuneng-jiang
64aad5877a
fix(proxy): restore atomic user upsert when adding team members (#34457)
* fix(proxy): restore atomic user upsert when adding team members

Parallel /team/new calls naming the same not-yet-existing member were
returning 500 "Unique constraint failed on the fields: (`user_id`)".

The upsert in add_new_member passed an empty update branch. Prisma only
compiles an upsert down to a single INSERT ... ON CONFLICT when that branch
writes something; with an empty one it emits SELECT-then-INSERT instead, so
concurrent requests all read "no such user" and all insert. Postgres
statement logs confirm it: the empty form logs BEGIN/SELECT/INSERT/COMMIT,
the non-empty form logs INSERT ... ON CONFLICT ("user_id") DO UPDATE SET.

Re-state user_id in the update branch as a no-op so the native upsert path
comes back. The teams append stays in the filtered update below it, so an
already-existing member still cannot pick up a duplicate team id.

tests/test_team.py::test_team_new failed 9 of 15 runs against a live proxy
before this and 0 of 15 after. The existing unit test asserted only that
upsert had been called on a mock, so it passed either way; it now pins the
shape of both branches and fails when the update branch goes back to empty.

* test: point the live codex tests at gpt-5.3-codex

OpenAI deprecated gpt-5.2-codex, so test_openai_codex and
test_openai_codex_stream started failing against the live API with
model_not_found. gpt-5.3-codex is the current codex model; both tests pass
on it. The remaining gpt-5.2-codex references in the suite are mocked
transformation tests and are unaffected.

* test(e2e): update models page specs for the shared DataTable

The DataTable migration in #34363 changed three things the models page
specs were pinned to, and five tests went red.

Row click no longer opens the detail view; the Model ID cell owns that
now, so both specs click its `model-id-<id>` test id instead of the row.
The search box placeholder switched from an ASCII "..." to a real
ellipsis, so the specs use getByPlaceholder with a substring instead of
an exact attribute match that punctuation can break again. The results
count moved from `models-results-count` ("Showing 1 - 50 of 137 results")
to the shared pagination's `pagination-range` ("Showing 1-50 of 137").

The Team-BYOK test also filtered rows on the team alias, which the Team
ID column has never rendered in either the old or the new table; it
filters on the team id now, which is what the column actually shows and
what the assertion's own comment intends.

Verified against a local proxy serving a fresh build with the seeded
e2e postgres and mock upstream: all five failing tests pass, and the
full suite is 82 passed / 4 skipped at CI parity (workers=1).
2026-07-24 02:22:34 +00:00
Cursor Agent
93300019bd
test(vcr): drop dead 'from respx import MockRouter' imports
These seven test files were on _RESPX_CONFLICTING_FILES, which made the
auto-marker skip them entirely. Inspecting the source shows the only
respx artifact is a top-level 'from respx import MockRouter' that no
test ever uses - no @pytest.mark.respx, no respx_mock fixture, no
respx.mock context manager. The import is dead code left over from a
previous mocking pattern.

Now that apply_vcr_auto_marker_to_items detects respx per-item via the
marker / fixture chain (b637d9f64a), the file-level skip is no longer
needed for these files - they were the reason the OpenAI tests
(test_o3_reasoning_effort, test_streaming_response[o1/o3-mini],
TestOpenAIO1::test_streaming, TestOpenAIChatCompletion::test_web_search,
TestOpenAIO3::test_web_search, etc.) ran live every CI build despite
the cassette cache being healthy.

Co-authored-by: Mateo Wang <mateo-berri@users.noreply.github.com>
2026-05-13 00:32:03 +00:00
Sameer Kankute
a5bec4911f Fix _supports_reasoning_effort_level for responses bridge 2026-03-13 13:29:39 +05:30
Ishaan Jaffer
bab2bcad8c test_openai_codex_stream 2026-02-14 12:28:18 -08:00
Ishaan Jaffer
8d9ae1d2b4 codex test fixes 2026-02-14 09:56:45 -08:00
yuneng-jiang
e49d094606 fix openai tests 2026-02-12 17:53:47 -08:00
Ishaan Jaffer
57e07bddd3 fix remove flaky test 2025-12-22 16:32:13 +05:30
Ishaan Jaffer
7eb2af1959 test bad org fix 2025-12-20 21:43:27 +05:30
Krish Dholakia
270d23939e
(fix) litellm_logging.py: fix mcp tool call response logging + (fix) responses_bridge: remove unmapped param error mid-stream - allows gpt-5 web search to work via responses api in .completion() (#16946)
* fix: fix getting mcp servers

* fix(litellm_logging.py): handle list objects for final response in standard logging payload

Fixes issue where mcp tool call response wouldn't show up

* fix(litellm_responses_transformation/): remove invalid item error for unmapped objects - breaks stream and there's no real value to this as outside of a few of them, not all can be mapped to chat completions

resolves error for web search calls via chat completions to responses api
2025-11-22 15:48:32 -08:00
pnookala-godaddy
44bb18a6ba
fix: forward OpenAI organization for image generation (#16607) 2025-11-13 21:51:27 -08:00
Ishaan Jaffer
7af8acdc22 test_gpt_5_reasoning_streaming fixes 2025-11-06 18:16:18 -08:00
Sameer Kankute
0388e3d393
Stabilize main branch (#16243)
* Fix failing container and azure tests

* fix lint error

---------

Co-authored-by: Ishaan Jaff <ishaanjaffer0324@gmail.com>
2025-11-05 16:07:28 -08:00
Sameer Kankute
396ab80f56
Fix index field not populated in streaming mode with n>1 and tool calls (#15962)
* fix index tool calling in streaming

* moved test to llm translation

---------

Co-authored-by: Ishaan Jaffer <ishaanjaffer0324@gmail.com>
2025-11-02 09:52:31 -08:00
Ishaan Jaffer
6e46824939 test_streaming_response 2025-10-31 19:10:38 -07:00
katsuhiro muto
d5e686b3e8
[Fix] Support service_tier in chat completion (#15693)
* Support service_tier

* fix test
2025-10-18 13:55:54 -07:00
Krrish Dholakia
090a2c0cfe fix: remove unused uuid import 2025-10-11 15:38:28 -07:00
Krrish Dholakia
4ad1b9c9e1 fix(litellm_responses_transformation/transformation.py): several fixes for chat completion to responses api bridge
Fix tool calling, prevent passing invalid stream options, prevent passing invalid user string (>64 char)

Allows gpt-5-codex to work on claude code
2025-10-10 19:52:01 -07:00
Krrish Dholakia
fed1ba2891 feat(openai/): convert chat completion tool calls to responses api
enables gpt-5-codex to work on claude code

 Closes LIT-1088
2025-10-10 19:41:11 -07:00
Krrish Dholakia
144ea09549 docs(openai.md): document how to get reasoning content for gpt-5 models 2025-10-10 18:42:19 -07:00
Krrish Dholakia
bff46da060 test(test_openai.py): add gpt-5 streaming with reasoning content test 2025-10-10 18:36:41 -07:00
Krrish Dholakia
0cb9ef5fb3 fix(openai/responses): fallback to model construct, don't use it by default (causes downstream errors for nested values) 2025-10-10 18:07:18 -07:00
Krrish Dholakia
44566977f1 test: update test 2025-09-09 20:18:03 -07:00
Krish Dholakia
351896cd1d
Merge pull request #12414 from dotmobo/feature/fix-timestamp-granularities
The parameter timestamp_granularities is broken for openai-like transcription
2025-09-08 23:13:13 -07:00
Sameer Kankute
fc9560573b
[BUG] Fix response api for reasoning item in input for litellm proxy (#14200)
* fix response api for litellm proxy

* Add test for checking if status is getting removed

* add test in correct file

* remove hardcoded fields

* Make the handling simpler

* fix lint error:
2025-09-04 10:36:48 -07:00
Sameer Kankute
4adfd18bc6
[Feat]Add support for safety_identifier parameter in chat.completions.create (#14174)
* Add support for safety_identifier parameter in chat.completions.create

* make sure param is getting actually passed to the raw api
2025-09-02 09:37:08 -07:00
Ishaan Jaff
1cd827874f
[Bug Fix] - Allow using reasoning_effort for gpt-5 model family and reasoning for Responses API (#13475)
* test_openai_gpt5_reasoning

* test_openai_gpt5_reasoning_effort_parameter

* add OpenAIGPT5ResponsesAPIConfig

* test_openai_gpt5_reasoning_effort_parameter

* fixes
2025-08-10 09:55:36 -07:00
Krish Dholakia
416da066eb
fix(main.py): handle tool being a pydantic object (#13274)
* fix(main.py): handle tool being a pydantic object

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

* fix(prompt_templates/common_utils.py): fix unpack defs deepcopy issue

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

* fix(utils.py): handle tools is none
2025-08-04 23:44:02 -07:00
Krrish Dholakia
378db1b62d test: remove o1-preview 2025-07-28 17:47:57 -07:00
Krish Dholakia
60c7537cc7
/streamGenerateContent - non-gemini model support (#12647)
* fix(google_genai/adapters/transformation.py): enable calling non-googlegenai models via streaming

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

* test(test_openai.py): add unit test asserting streaming works as expected
2025-07-18 10:56:29 -07:00
Krrish Dholakia
f4131b023e fix: don't fail request if unmapped item in responses list
not every responses item has a 1:1 mapping with chat completions
2025-07-16 09:25:26 -07:00
Krish Dholakia
1ce3558f96
fix(transformation.py): allows passing native responses api tools like web_search_preview, and mcp via .completion() (#12627)
Closes https://github.com/BerriAI/litellm/issues/12105
2025-07-15 22:45:42 -07:00
dotmobo
e69107466f [TECH] fix TU 2025-07-08 16:16:12 +02:00
Krrish Dholakia
f5aa24c3eb test: update unit testing 2025-06-14 08:41:34 -07:00
Krish Dholakia
7f2e188ee2
Add bridge for /chat/completion -> /responses API (#11632)
* refactor(responses/): refactor to move responses_to_completion in separate folder

future work to support completion_to_responses bridge

allow calling codex mini via chat completions (and other endpoints)

* Revert "refactor(responses/): refactor to move responses_to_completion in separate folder"

This reverts commit ff87cb8958.

* feat: initial responses api bridge

write it like a custom llm - requires lesser 'new' components

* style: add __init__'s and bubble up the responses api bridge

* feat(responses/transformation): working sync completion -> responses and back bridge (non-streaming)

* feat(responses/): working async (non-streaming) completion <-> responses bridge

Allows calling codex mini via proxy

* feat(responses/): working sync + async streaming for base model response iterator

* fix: reduce function size

maintain <50 LOC

* fix(main.py): safely handle responses api model check

* fix: fix linting errors
2025-06-11 22:20:18 -07:00
Ishaan Jaff
86cdb8382b
[Feat] Use aiohttp transport by default - 97% lower median latency (#11097)
* fix: add flag for disabling use_aiohttp_transport

* feat: add _create_async_transport

* feat: fixes for transport

* add httpx-aiohttp

* feat: fixes for transport

* refactor: fixes for transport

* build: fix deps

* fixes: test fixes

* fix: ensure aiohttp does not auto set content type

* test: test fixes

* feat: add LiteLLMAiohttpTransport

* fix: fixes for responses API handling

* test: fixes for responses API handling

* test: fixes for responses API handling

* feat: fixes for transport

* fix: base embedding handler

* test: test_async_http_handler_force_ipv4

* test: fix failing deepeval test

* fix: add YARL for bedrock urls

* fix: issues with transport

* fix: comment out linting issues

* test fix

* test: XAI is unstable

* test: fixes for using respx

* test: XAI fixes

* test: XAI fixes

* test: infinity testing fixes

* docs(config_settings.md): document param

* test: test_openai_image_edit_litellm_sdk

* test: remove deprecated test

* bump respx==0.22.0

* test: test_xai_message_name_filtering

* test: fix anthropic test after bumping httpx

* use n 4 for mapped tests (#11109)

* fix: use 1 session per event loop

* test: test_client_session_helper

* fix: linting error

* fix: resolving GET requests on httpx 0.28.1

* test fixes proxy unit tests

* fix: add ssl verify settings

* fix: proxy unit tests

* fix: refactor

* tests: basic unit tests for aiohttp transports

* tests: fixes xai

---------

Co-authored-by: Krrish Dholakia <krrishdholakia@gmail.com>
2025-05-23 22:55:35 -07:00
Krish Dholakia
beae5cfea9
Litellm staging 05 10 2025 - openai pdf url support + sagemaker chat content length error fix (#10724)
* Support pdf url's to openai (#10640)

* fix(gpt_transformation.py): support pdf url input to openai

pass as base64 as openai doesn't support image url's

* fix(openai.py): support async message transformation

allows async get request to convert url to base64

* fix(gpt_transformation.py): fix linting errrors and use common components across sync + async flows

* fix: fix linting errors

* fix(openai.py): pop correct var

* Fix sagemaker chat calls - content length error  (#10607)

* fix(sagemaker_chat/): support passing dynamic aws params

previously being ignored

* refactor(sagemaker/chat): more refactoring

* fix(sagemaker_chat/): make sure streaming is correctly handled post-refactor

* refactor: more refactoring to support using signed json str

* fix(sagemaker/chat): working sync streaming post refactor

* fix(sagemaker/chat): support async streaming post refactor

* fix(llm_http_handler.py): await async function

* fix: remove print statements

* test: update test

* test: update test

* fix(llm_http_handler.py): retain passing in data as json str

* test: update test

* fix(base_model_iterator.py): fix linting error

* test: test auth

* fix: fix linting error

* test: update test

* test: update translation test

* fix(gpt_transformation.py): handle awaitable/non-awaitable object

* fix: handle async flow for message transformation on openai compatible api's

* test: cleanup testing

* test: update test

* test(test_router.py): use model with higher quota

* test: simplify test

* test: update test
2025-05-10 17:41:57 -07:00
Ishaan Jaff
8faa7dbc39 fixes for web search tests 2025-05-03 18:10:30 -07:00
Krish Dholakia
217681eb5e
Litellm dev 04 22 2025 p1 (#10206)
* fix(openai.py): initial commit adding generic event type for openai responses api streaming

Ensures handling for undocumented event types - e.g. "response.reasoning_summary_part.added"

* fix(transformation.py): handle unknown openai response type

* fix(datadog_llm_observability.py): handle dict[str, any] -> dict[str, str] conversion

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

* test: add more unit testing

* test: add unit test

* fix(common_utils.py): fix message with content list

* test: update testing
2025-04-22 23:58:43 -07:00
Krrish Dholakia
b37cb642c1 test: fix b64 str 2025-03-31 17:10:06 -07:00
Krish Dholakia
5ac61a7572
Add bedrock latency optimized inference support (#9623)
* fix(converse_transformation.py): add performanceConfig param support on bedrock

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

* fix(converse_transformation.py): refactor to use more flexible single getter for params which are separate config blocks

* test(test_main.py): add e2e mock test for bedrock performance config

* build(model_prices_and_context_window.json): add versioned multimodal embedding

* refactor(multimodal_embeddings/): migrate to config pattern

* feat(vertex_ai/multimodalembeddings): calculate usage for multimodal embedding calls

Enables cost calculation for multimodal embeddings

* feat(vertex_ai/multimodalembeddings): get usage object for embedding calls

ensures accurate cost tracking for vertexai multimodal embedding calls

* fix(embedding_handler.py): remove unused imports

* fix: fix linting errors

* fix: handle response api usage calculation

* test(test_vertex_ai_multimodal_embedding_transformation.py): update tests

* test: mark flaky test

* feat(vertex_ai/multimodal_embeddings/transformation.py): support text+image+video input

* docs(vertex.md): document sending text + image to vertex multimodal embeddings

* test: remove incorrect file

* fix(multimodal_embeddings/transformation.py): fix linting error

* style: remove unused import
2025-03-29 00:23:09 -07:00
Krish Dholakia
c0845fec1f
Add OpenAI gpt-4o-transcribe support (#9517)
* refactor: introduce new transformation config for gpt-4o-transcribe models

* refactor: expose new transformation configs for audio transcription

* ci: fix config yml

* feat(openai/transcriptions): support provider config transformation on openai audio transcriptions

allows gpt-4o and whisper audio transformation to work as expected

* refactor: migrate fireworks ai + deepgram to new transform request pattern

* feat(openai/): working support for gpt-4o-audio-transcribe

* build(model_prices_and_context_window.json): add gpt-4o-transcribe to model cost map

* build(model_prices_and_context_window.json): specify what endpoints are supported for `/audio/transcriptions`

* fix(get_supported_openai_params.py): fix return

* refactor(deepgram/): migrate unit test to deepgram handler

* refactor: cleanup unused imports

* fix(get_supported_openai_params.py): fix linting error

* test: update test
2025-03-26 23:10:25 -07:00
Ishaan Jaff
5c59a6a58f test_openai_web_search_streaming 2025-03-22 11:36:34 -07:00
Ishaan Jaff
3dbbc89fd2 test_openai_web_search 2025-03-22 10:53:47 -07:00
Ishaan Jaff
3764aa1729 test open ai web search 2025-03-22 10:44:04 -07: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
Krish Dholakia
ab7c4d1a0e
Litellm dev bedrock anthropic 3 7 v2 (#8843)
* feat(bedrock/converse/transformation.py): support claude-3-7-sonnet reasoning_Content transformation

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

* fix(bedrock/): support returning `reasoning_content` on streaming for claude-3-7

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

* feat(bedrock/): unify converse reasoning content blocks for consistency across anthropic and bedrock

* fix(anthropic/chat/transformation.py): handle deepseek-style 'reasoning_content' extraction within transformation.py

simpler logic

* feat(bedrock/): fix streaming to return blocks in consistent format

* fix: fix linting error

* test: fix test

* feat(factory.py): fix bedrock thinking block translation on tool calling

allows passing the thinking blocks back to bedrock for tool calling

* fix(types/utils.py): don't exclude provider_specific_fields on model dump

ensures consistent responses

* fix: fix linting errors

* fix(convert_dict_to_response.py): pass reasoning_content on root

* fix: test

* fix(streaming_handler.py): add helper util for setting model id

* fix(streaming_handler.py): fix setting model id on model response stream chunk

* fix(streaming_handler.py): fix linting error

* fix(streaming_handler.py): fix linting error

* fix(types/utils.py): add provider_specific_fields to model stream response

* fix(streaming_handler.py): copy provider specific fields and add them to the root of the streaming response

* fix(streaming_handler.py): fix check

* fix: fix test

* fix(types/utils.py): ensure messages content is always openai compatible

* fix(types/utils.py): fix delta object to always be openai compatible

only introduce new params if variable exists

* test: fix bedrock nova tests

* test: skip flaky test

* test: skip flaky test in ci/cd
2025-02-26 16:05:33 -08:00
Krish Dholakia
017c482d7b
fix(o_series_transformation.py): fix optional param check for o-serie… (#8787)
* fix(o_series_transformation.py): fix optional param check for o-series models

o3-mini and o-1 do not support parallel tool calling

* fix(utils.py): support 'drop_params' for 'thinking' param across models

allows switching to older claude versions (or non-anthropic models) and param to be safely dropped

* fix: fix passing thinking param in optional params

allows dropping thinking_param where not applicable

* test: update old model

* fix(utils.py): fix linting errors

* fix(main.py): add param to acompletion
2025-02-26 12:26:55 -08:00
Ishaan Jaff
4858417283 test_prompt_caching 2025-02-26 08:57:16 -08:00