feat(responses): add replay-safe output helper#1806
feat(responses): add replay-safe output helper#1806raashish1601 wants to merge 2 commits intoopenai:masterfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b2810769c3
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| )._thenUnwrap((rsp) => { | ||
| if ('object' in rsp && rsp.object === 'response') { | ||
| addOutputText(rsp as Response); | ||
| addOutputAsInput(rsp as Response); |
There was a problem hiding this comment.
Normalize cancel responses before returning Response
Adding output_as_input to Response makes this helper look universally available on APIPromise<Response> results, but only create/retrieve run hydration; cancel() still returns the raw parsed object (this._client.post(...)) without addOutputAsInput. In practice, code that reads response.output_as_input after client.responses.cancel(...) will get undefined at runtime even though the type is non-optional, so this helper should be applied consistently on cancel as well.
Useful? React with 👍 / 👎.
singhshiva39758-alt
left a comment
There was a problem hiding this comment.
Hii bro
New game
Top level game
Summary
esponse.output_as_input helper for replay-safe manual Responses API turns
Validation
ode ./node_modules/jest/bin/jest.js tests/responsesItems.test.ts --runInBand
n- ode ./node_modules/prettier/bin/prettier.cjs --check src/lib/ResponsesParser.ts src/resources/responses/responses.ts tests/api-resources/responses/responses.test.ts tests/responsesItems.test.tsn-ode ./node_modules/eslint/bin/eslint.js src/lib/ResponsesParser.ts src/resources/responses/responses.ts tests/api-resources/responses/responses.test.ts tests/responsesItems.test.ts`n
Notes
pm exec reporting ECOMPROMISED Lock compromised while installing @stdy/cli@0.19.7.
ode ./node_modules/typescript/bin/tsc --noEmit --pretty false still hits the repo's existing missing example-only deps for @azure/identity, express, and
ext.