Commit Graph

11 Commits

Author SHA1 Message Date
Sameer Kankute cd65a84abd Merge pull request #16844 from Chesars/fix/response-format-to-text-format-bridge-conversion
fix: Support response_format parameter in completion -> responses bridge
2025-11-26 08:51:09 +05:30
Alex Huang 3b6f3e48cb Fix optional param mapping (#16852)
* Direct string check instead of tuple string inclusion check

* Add test
2025-11-19 19:10:04 -08:00
Nigel Kukard c5c563c302 fix: fixed openai conversion from responses to completions (#16864)
- Fix blank function name in completions response when using native function calling
- Fix Enum name being used instead of Enum value for comparison in chunk conversion
- Added additional tests to cover changes

Thanks to @mcowger for the invaluable assitance with figuring this issue out!

Fixed #16863
2025-11-19 19:02:52 -08:00
Chesars 3e58fe42b7 fix: Support response_format parameter in completion -> responses bridge
Fixes #16810

## Problem

When using completion() with models that have mode: "responses" (like o3-pro,
gpt-5-codex), the response_format parameter with JSON schemas was being ignored
or incorrectly handled, causing:
- Large schemas (>512 chars) to fail with "metadata.schema_dict_json: string too long" error
- Structured outputs to be silently dropped
- Users' code to break unexpectedly

## Root Cause

The completion -> responses bridge in
litellm/completion_extras/litellm_responses_transformation/transformation.py
was missing the conversion of response_format (Chat Completion format) to
text.format (Responses API format).

The inverse bridge (responses -> completion) already had this conversion
implemented in commit 29f0ed223a, but the completion -> responses direction
was incomplete.

## Solution

Added _transform_response_format_to_text_format() method that converts:
- response_format with json_schema → text.format with json_schema
- response_format with json_object → text.format with json_object
- response_format with text → text.format with text

Updated transform_request() to detect and convert response_format parameter
before sending to litellm.responses().

## Changes

- Added _transform_response_format_to_text_format() method (lines 592-647)
- Modified transform_request() to handle response_format (lines 199-203)
- Added comprehensive tests to validate the conversion

## Testing

- 5 new unit tests covering all conversion scenarios
- Real API test with OpenAI confirming large schemas (>512 chars) work
- No more metadata.schema_dict_json errors

## Impact

Users can now use completion() with models that have mode: "responses" and:
- Use large JSON schemas without hitting metadata 512 char limit
- Get proper structured outputs
- Have their existing code continue working
2025-11-19 17:07:46 -03:00
Sameer Kankute 9e93d65ee2 Add extra_body support for response api params from chat completion (#16765) 2025-11-18 20:05:47 -08: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 f49f540b6d feat(litellm_responses_transformation/transformation.py): parse thinking content in response<-> chat completion bridge
allows gpt-5 to return thinking content when called via responses api
2025-10-10 18:29:37 -07:00
Ishaan Jaff 7ff93cd1b1 Revert "Merge pull request #12865 from aholmberg/holmberg/default-reasoning"
This reverts commit 68f4847659, reversing
changes made to df39320889.
2025-08-30 13:07:33 -07:00
Adam Holmberg 2ce03d9735 fix: make gemini and openai responses return reasoning by default
This aligns the proxy experience with other models that think
automatically (e.g. Deepseek R1 and grok3). It does so by setting
the necessary request input to return thinking, but not specifying
a budget or effort (thus defaulting to the internal automatic level).
2025-07-22 10:41:29 -05:00
Adam Holmberg 6ff06bb96f fix: handle reasoning parameters and response in responses bridge (#12433)
* fix: handle reasoning parameters and response in responses bridge

Updates the OpenAI completions/responses bridge to map
reasoning_effort to reasoning parameters, and the chunk parser
to return reasoning_content.

ref: 12432

* fix: using type checked objects in responses bridge transform

ref: 12432
2025-07-10 18:06:45 -07:00
Krish Dholakia e5fd313a48 Completion-To-Responses Bridge: Support passing image url's (#11833)
* fix(completion_to_responses_bridge_transformation.py): support passing image urls' to responses api models

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

* fix(base_aws_llm.py): if boto3 present, try and get the configured region name

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

* fix: fix imports

* fix: fix linting error s
2025-06-18 12:48:17 -07:00