unsloth/studio/backend
Daniel Han c45fa95c20 Make /v1/responses endpoint match OpenAI Responses API format
The existing /v1/responses shim returned Chat Completions format, which
broke OpenAI SDK clients using openai.responses.create(). This commit
replaces the endpoint with a proper implementation that:

- Returns `output` array with `output_text` content parts instead of
  `choices` with `message`
- Uses `input_tokens`/`output_tokens` instead of `prompt_tokens`/
  `completion_tokens` in usage
- Sets `object: "response"` and `id: "resp_..."`
- Emits named SSE events for streaming (response.created,
  response.output_text.delta, response.completed, etc.)
- Accepts all OpenAI Responses API fields (tools, store, metadata,
  previous_response_id) without erroring -- silently ignored
- Maps `developer` role to `system` and `input_text`/`input_image`
  content parts to the internal Chat format

Adds Pydantic schemas for request/response models and 23 unit tests
covering schema validation, input normalisation, and response format.
2026-04-10 15:06:51 +00:00
..
assets Add Gemma 4 model sampling defaults (#4838) 2026-04-03 13:57:15 -07:00
auth [pre-commit.ci] auto fixes from pre-commit.com hooks 2026-04-10 13:33:51 +00:00
core Add /v1/completions, /v1/embeddings, /v1/responses endpoints and --parallel support 2026-04-10 14:44:22 +00:00
loggers Final cleanup 2026-03-12 18:28:04 +00:00
models Make /v1/responses endpoint match OpenAI Responses API format 2026-04-10 15:06:51 +00:00
plugins Bump Data Designer to 0.5.4 (removes litellm dependency) (#4569) 2026-03-25 02:01:43 -07:00
requirements Pin transformers and huggingface-hub in main Studio venv (#4788) 2026-04-02 09:21:30 -07:00
routes Make /v1/responses endpoint match OpenAI Responses API format 2026-04-10 15:06:51 +00:00
state Final cleanup 2026-03-12 18:28:04 +00:00
storage feat: custom scan folders for GGUF model discovery (#4723) 2026-03-31 06:40:31 -07:00
tests Make /v1/responses endpoint match OpenAI Responses API format 2026-04-10 15:06:51 +00:00
utils Add AMD ROCm/HIP support across installer and hardware detection (#4720) 2026-04-10 01:56:12 -07:00
__init__.py Final cleanup 2026-03-12 18:28:04 +00:00
_platform_compat.py Fix Studio crash on Anaconda/conda-forge Python (#4484) 2026-03-22 05:36:55 -07:00
colab.py Fix/studio colab button message: Add fallback message for Colab Studio button when proxy URL fails (#4866) 2026-04-05 21:57:45 -07:00
main.py Add AMD ROCm/HIP support across installer and hardware detection (#4720) 2026-04-10 01:56:12 -07:00
run.py Add /v1/completions, /v1/embeddings, /v1/responses endpoints and --parallel support 2026-04-10 14:44:22 +00:00
startup_banner.py studio: unify Windows installer/setup logging style, verbosity controls, and startup messaging (#4651) 2026-03-30 00:53:23 -07:00