Commit Graph

118 Commits

Author SHA1 Message Date
Krrish Dholakia 0cf4b05991 test: remove bad e2e tests - e2e failing due to low rate limits on ci/cd 2026-03-30 19:18:10 -07:00
Krrish Dholakia bc829d51f2 test: test 2026-03-28 19:17:38 -07:00
Krrish Dholakia 08f0cbc2e9 fix: address greptile feedback 2026-03-18 21:36:39 -07:00
Sameer Kankute 631400cb17 Fix anthropic responses 2026-02-20 17:30:42 -08:00
Ishaan Jaff d11832bfad fix(responses): eliminate per-chunk thread spawning in async streaming path (#21709)
* fix(responses): fix O(n²) CPU overhead in reasoning streaming path

stream_chunk_builder was called on every reasoning chunk, rebuilding the
entire response from all collected chunks each time. Replace with
incremental accumulation of reasoning_content parts, only joining at
reasoning end.

* fix(responses): eliminate per-chunk thread spawning in async streaming path

_process_chunk() called run_async_function() on every SSE chunk, which
when invoked from an async context spawns a thread + event loop per call.

Move the hook call out of _process_chunk into the callers: async __anext__
directly awaits it, sync __next__ uses run_async_function.

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

* perf: reduce responses streaming CPU for text-only streams

* fix(test): replace deprecated claude-3-7-sonnet-latest in responses API test

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

* fix(test): replace deprecated claude-3-7-sonnet-latest in tool result fix test

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

* fix(test): replace deprecated claude-3-7-sonnet-latest in tool result empty call_id test

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 16:26:23 -08:00
yuneng-jiang 45e6440b0a fixing test_basic_openai_responses_api 2026-02-16 20:14:06 -08:00
Ishaan Jaffer b8f572fc39 test_responses_api_shell_tool_streaming_sees_shell_output 2026-02-14 12:55:44 -08:00
Ishaan Jaffer 6a4b531057 def get_advanced_model_for_shell_tool(self) -> Optional[str]:
AZURE
2026-02-14 12:29:42 -08:00
Ishaan Jaffer 77dd3cb2b2 test_responses_api_shell_tool_streaming_sees_shell_output 2026-02-14 11:32:52 -08:00
Ishaan Jaffer ad910de1e3 test_o1_parallel_tool_calls 2026-02-14 10:47:38 -08:00
Ishaan Jaff 736daf0a7d [Feat] Adds Shell tool support for the OpenAI Responses API (#21063)
* test_responses_api_context_management_server_side_compaction

* Server-side compaction

* docs fix

* test_responses_api_shell_tool

* add SHELL tool

* test_responses_api_shell_tool

* add SHELL_CALL_IN_PROGRESS

* add SHELL_CALL_IN_PROGRESS events

* TestOpenAIResponsesAPITest

* transform_streaming_response

* test_responses_api_shell_tool_streaming_sees_shell_output

* test_responses_api_shell_tool_streaming_sees_shell_output

* test_responses_api_shell_tool

* docs fix
2026-02-12 13:04:29 -08:00
Ishaan Jaff 3d9b145b04 [Feat] Adds support for server-side compaction on the OpenAI Responses API context_management (#21058)
* test_responses_api_context_management_server_side_compaction

* Server-side compaction

* docs fix

* test_responses_api_shell_tool
2026-02-12 10:00:30 -08:00
Sameer Kankute 8357d05615 Fix: Responses API logging error for StopIteration 2026-01-23 18:42:33 +05:30
Sameer Kankute ff7bb59824 Merge branch 'main' into litellm_fix_streaming_test 2026-01-19 19:43:16 +05:30
Sameer Kankute c9de4776bc Fix test_process_chunk_exception_calls_handle_failure_once 2026-01-19 19:39:12 +05:30
Cesar Garcia b49f0a91e4 fix(responses): resolve deepcopy error with tool_choice ValidatorIterator (#17192) (#17205)
Replace copy.deepcopy with model_dump + model_validate in streaming
iterator logging to handle Pydantic ValidatorIterator objects that
cannot be pickled when tool_choice uses allowed_tools mode.

Co-authored-by: Krish Dholakia <krrishdholakia@gmail.com>
2026-01-19 05:44:20 -08:00
Sameer Kankute fbf2d83375 Fix: _handle_failure method getting called 2 times 2026-01-19 10:19:31 +05:30
Ishaan Jaffer 1ebe979eee test_manus_responses_api_with_file_upload 2026-01-10 15:12:00 -08:00
Ishaan Jaff c0cf8bc27d [Feat] Manus FILES API - Add File upload, get, delete, list (#18904)
* add MANUS get response

* init TwoStepFileUploadRequest

* init TwoStepFileUploadConfig

* add async_create_file to handle 2 step uploads

* init ManusFilesConfig

* add add get_provider_files_config MANUS

* fix validate_environment

* test_manus_files_api_e2e_all_methods

* aws fix base

* init files API MANUS

* test_manus_responses_api_with_file_upload

* mypy lint fixes

* fix BedrockFilesConfig

* manus docs

* docs manus

* mypy lint

* add add fix resposne api utils MANUS
2026-01-10 13:27:54 -08:00
Ishaan Jaff f19cce950c add MANUS get response (#18900) 2026-01-10 12:21:45 -08:00
Ishaan Jaffer 10ec499369 responses API fixes 2026-01-08 19:16:23 +05:30
Ishaan Jaffer ebf09218d5 TestManusResponsesAPITest 2026-01-08 18:59:46 +05:30
Ishaan Jaff b482d336b3 [Feat] New provider - Manus API on /responses, GET /responses (#18804)
* init ManusResponsesAPIConfig

* init MANUS ApI

* init MANUS create responses

* init MANUS

* test_extract_agent_profile

* transform_get_response_api_request

* test fix

* fixes non stream

* fix streaming

* add MANUSConfig

* test_multiturn_responses_api

* code QA check

* add manus

* Potential fix for code scanning alert no. 3961: Clear-text logging of sensitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-01-08 18:37:42 +05:30
Ishaan Jaff 76eda472be [Feat] New API Endpoint - Responses API (v1/responses/compact) (#18697)
* init transform_compact_response_api_request

* init acompact_responses

* init async_compact_response_api_handler in llm http handler

* init transform_compact_response_api_request for openai

* init acompact_responses

* fix acompact_responses

* add OAI Compact API

* docs responses API Compact

* code qa checks

* test_openai_compact_responses_api

* fix mypy linting
2026-01-06 16:24:04 +05:30
LingXuanYin 499fc9f48a Align responses API streaming hooks with chat pipeline 2026-01-06 10:54:19 +08:00
Alexsander Hamir 5a76aada3c [Fix] CI/CD - responses_api_testing (#18295) 2025-12-20 10:27:58 -08:00
Alexsander Hamir 0c48826cdc Revert "[Fix] CI/CD - local_testing & mapped tests (#18222)" (#18223)
This reverts commit dc7f500c47.
2025-12-18 14:46:09 -08:00
Alexsander Hamir dc7f500c47 [Fix] CI/CD - local_testing & mapped tests (#18222) 2025-12-18 14:34:48 -08:00
Alexsander Hamir 5230e97448 [Fix] CI/CD - Add missing documentation for ENVs & Clean Functionality (#18211) 2025-12-18 13:16:15 -08:00
Sameer Kankute 85907cebb5 Add custom headers in responses API 2025-12-16 11:31:15 +05:30
Ishaan Jaffer 50328d15d4 test_process_chunk_with_response_completed_event 2025-11-26 11:52:05 -08:00
Sameer Kankute 82dc0354ce Litellm sameer nov 3 stable branch (#16963)
* Add openai metadata filed in the request

* Add docs related to openai metadata

* Add utils

* test_completion_openai_metadata[True]

* Added support for though signature for gemini 3 in responses api (#16872)

* Added support for though signature for gemini 3

* Update docs with all supported endpoints and cost tracking

* Added config based routing support for batches and files

* fix lint errors

* Litellm anthropic image url support (#16868)

* Add image as url support to anthropic

* fix mypy errors

* fix tests

* Fix: Populate spend_logs_metadata in batch and files endpoints (#16921)

* Add spend-logs-metadata to the metadata

* Add tests for spend logs metadata in batches

* use better names

* Remove support for penalty param for gemini 3 (#16907)

* Remove support for penalty param

* remove halucinated model names

* fix mypy/test errors

* fix tests

* fix too many lines error

* fix too many lines error

* Add config for cicd test case

* Fix final tests

* fix batch tests

* fix batch tests
2025-11-22 09:35:05 -08:00
Ishaan Jaffer 1d2bdaebb6 test_openai_streaming_logging 2025-11-08 11:49:36 -08:00
Ishaan Jaffer 4fb521c251 test_basic_openai_responses_api_non_streaming_with_logging 2025-11-08 11:12:35 -08:00
Ishaan Jaffer bbcdf6f996 test_basic_openai_responses_api_non_streaming_with_logging 2025-11-08 10:47:48 -08:00
Ishaan Jaffer 0148b8d2f7 test_basic_openai_responses_api_non_streaming_with_logging 2025-11-08 10:36:47 -08:00
Ishaan Jaffer 89157f4b5c test_basic_openai_responses_api_streaming_with_logging 2025-11-08 10:30:41 -08:00
Ishaan Jaffer 6bb963dca2 test_basic_openai_responses_api_non_streaming_with_logging 2025-11-08 10:13:27 -08:00
Ishaan Jaffer f9d95b71bb fix _get_assembled_streaming_response 2025-11-08 10:08:03 -08:00
Ishaan Jaffer 61cf169926 test_basic_openai_responses_api_streaming 2025-11-06 16:18:30 -08:00
Cesar Garcia 1fec48499f fix: Pass extra_body to provider in Responses API requests (#16320)
## Problem
The `extra_body` parameter in `litellm.responses()` and `litellm.aresponses()`
was being accepted but never passed to the HTTP request sent to the LLM provider.
This prevented users from sending custom/experimental parameters to provider APIs.

## Changes
- Added `data.update(extra_body)` in `async_response_api_handler` (line 2138)
- Added `data.update(extra_body)` in `response_api_handler` (line 2012)
- Added tests to `test_openai_responses_api.py` for extra_body functionality

## Testing
- Tests verify extra_body params are passed in both sync and async modes
- Existing Responses API tests continue to pass
- Manually verified with OpenAI API that custom params are sent correctly

## Impact
Users can now pass custom/experimental parameters via extra_body:
```python
litellm.aresponses(
    model="gpt-4o",
    input="hello",
    extra_body={"custom_param": "value"}  # Now works!
)
```

This aligns with the OpenAI SDK pattern and matches behavior in other
LiteLLM endpoints (completion, embedding, etc.) that already support extra_body.
2025-11-06 14:54:40 -08:00
Ishaan Jaffer 4a83ae0695 test_aresponses_service_tier_and_safety_identifier 2025-11-04 18:05:30 -08:00
Cesar Garcia 78ed5126a5 fix: Fix Responses API streaming tests usage field names and cost (#16236)
This commit fixes two bugs in Responses API streaming tests:

1. **Usage field naming bug**: Tests were using `input_tokens` and
   `output_tokens` but the Usage object uses `prompt_tokens` and
   `completion_tokens`.

2. **Missing cost in streaming usage**: When `include_cost_in_streaming_usage`
   was enabled, the cost was calculated and added to ResponseAPIUsage, but was
   lost during the transformation to the Usage object.

Changes:
- Updated test assertions to use correct field names (prompt_tokens, completion_tokens)
- Added cost preservation logic in FakeStreamerResponsesAPIIterator
- Modified _transform_response_api_usage_to_chat_usage() to preserve cost attribute

All streaming tests now pass successfully.
2025-11-04 15:57:59 -08:00
Krish Dholakia 74ae7aed44 build: Squashed commit of the following: (#16176)
commit bb0b050fb01633d83c1c2932f8e9c11432911847
Author: Krrish Dholakia <krrishdholakia@gmail.com>
Date:   Sat Nov 1 20:00:01 2025 -0700

    test: update tests

commit b2da4bdac23868e69a9452805b231f8830e49912
Author: Krrish Dholakia <krrishdholakia@gmail.com>
Date:   Wed Oct 22 14:58:01 2025 -0700

    fix(langfuse_otel_attributes.py): log tools and other optional params

commit 75bee1f2748f32b230467de0b085c55bf1d687a9
Author: Krrish Dholakia <krrishdholakia@gmail.com>
Date:   Wed Oct 22 14:42:05 2025 -0700

    feat(langfuse_otel/): working request/response logging on spans

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

commit a3e4fa5b81e82f71c74fb9e7dc859c6cb40495f5
Author: Krrish Dholakia <krrishdholakia@gmail.com>
Date:   Wed Oct 22 14:20:39 2025 -0700

    fix: initial commit fixing langfuse request/response logging with OTEL

commit 09fc9deac844004104822810e42975cd9c68f0e3
Author: Krrish Dholakia <krrishdholakia@gmail.com>
Date:   Wed Oct 22 13:33:52 2025 -0700

    fix(litellm_logging.py): for responses api - return a unified usage object for logging

    ensures logging integrations all pull the right usage information
2025-11-02 09:46:40 -08:00
Sameer Kankute f804ab6de5 Add LLM provider response headers to Responses API (#16091)
* Add llm headers to responses api

* fix mock test
2025-11-01 13:25:56 -07:00
Ishaan Jaffer 33371d18f4 test fix claude-sonnet-4-5-20250929 2025-10-28 19:05:13 -07:00
Ishaan Jaffer 1b49dba1dd fix claude-sonnet-4-5 2025-10-28 17:37:08 -07:00
Ishaan Jaffer a1d3790198 TestAzureResponsesAPITest 2025-10-25 16:22:52 -07:00
Ishaan Jaffer f0ae2bef4f TestAzureResponsesAPITest 2025-10-25 16:09:04 -07:00
Ishaan Jaffer 667f2613de TestAzureOpenAIVectorStore 2025-10-25 14:06:28 -07:00