Skip to content

Added GET and DELETE for OpenAI Responses API #10292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ADIthaker
Copy link
Collaborator

@ADIthaker ADIthaker commented Apr 24, 2025

Implementing GET AND DELETE for OpenAI Responses API

Pre-Submission checklist

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on (make test-unit)[https://docs.litellm.ai/docs/extras/contributing_code]
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

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 the Router to ensure model_id is passed to the request
Added new valid route_types to relevant files.

get_delete_responses

IMPORTANT DOCUMENTATION

Since, we use _decode_responses_api_response_id from ResponseAPIUtils, the function gets the model_id for a given response_id. If the response_id is invalid, or deleted, it throws a validation error, which needs to be handled for ResponsesAPIResponse. I fixed this by raising status errors in litellm/llms/openai/responses/transformation.py before sending the response. This does transfer the error handling to OpenAIError, 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'

@ADIthaker ADIthaker requested a review from ishaan-jaff April 24, 2025 20:23
Copy link

vercel bot commented Apr 24, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 24, 2025 9:12pm

@ADIthaker ADIthaker changed the title DRAFT: Added GET and DELETE for OpenAI Responses API Added GET and DELETE for OpenAI Responses API Apr 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant