Skip to content

Conversation

@RushitaThakkar
Copy link
Collaborator

Summary

Adds type definitions and tests for the Responses API (POST /v1/responses). No new public API surface or client/resource code in this PR.

Changes

Request types (src/gradient/types/responses/response_create_params.py): ResponseCreateParams and input item types (ResponseInputUserMessage, ResponseInputFunctionCall, ResponseInputFunctionCallOutput), plus ResponseTool, ResponseToolChoice.
Response types (src/gradient/types/responses/response_create_response.py): ResponseCreateResponse with id, output, status, error, model, usage; output item types (ResponseOutputMessage, ResponseOutputFunctionCall) with a discriminated union; output_text property that aggregates text from message items in output.
Exports (src/gradient/types/responses/init.py): Re-exports the above types.
Tests (tests/types/responses/test_response_create_response.py): 8 tests—parsing minimal response and response with usage, output_text aggregation (multiple messages, prefers output_text over content, skips function_call items, empty content), and parsing of message/function_call output items. All use static payloads (no network).

Testing

pytest tests/types/responses/ — 8 passed
pytest -m 'not smoke' — 460 passed (no regressions)
Ruff check & format, mypy on new code — pass

Follow-ups

PR 2: Responses resource + client.responses.create() (and tests)
PR 3: Model constants (ResponsesModels)
PR 4: Example and docs

rushitat and others added 2 commits February 6, 2026 13:34
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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