Added GET and DELETE for OpenAI Responses API #10292
Open
+118
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implementing GET AND DELETE for OpenAI Responses API
Pre-Submission checklist
tests/litellm/
directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit
)[https://docs.litellm.ai/docs/extras/contributing_code]Type
🆕 New Feature
Changes
Implemented the functions for get and delete routes in
response_api_endpoints/endpoints.py
Added in a new
retrieve_responses_model
in theRouter
to ensuremodel_id
is passed to the requestAdded new valid
route_types
to relevant files.IMPORTANT DOCUMENTATION
Since, we use
_decode_responses_api_response_id
fromResponseAPIUtils
, the function gets themodel_id
for a givenresponse_id
. If the response_id is invalid, or deleted, it throws a validation error, which needs to be handled forResponsesAPIResponse
. I fixed this by raising status errors inlitellm/llms/openai/responses/transformation.py
before sending the response. This does transfer the error handling toOpenAIError
, which is where it should go, but it still does not gracefully handle it, and the proxy prints out a 500 error code instead of the 404.Not adding status code corrections in the PR to keep the scope small for now, but I can work on it in another PR.
Other logging errors trace:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/workspaces/litellm/litellm/integrations/custom_logger.py", line 322, in async_log_event
await callback_func(
File "/workspaces/litellm/litellm/router.py", line 3990, in async_deployment_callback_on_failure
deployment_name = kwargs["litellm_params"]["metadata"].get(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get'