Confirm this is a feature request for the Node library and not the underlying OpenAI API.
Describe the feature or improvement you're requesting
ResponseOutputItem returned by the Response API are supposed to be reusable as input ResponseInputItem[] for the next question.
But the types do not completely overlap.
It would be great to have a utility function that take an array of (ResponseInputItem | ResponseOutputItem)[] -- all the user inputs and all the assistant answers -- and convert it to a clean ResponseInputItem[], by removing all the ResponseOutputItem that are not allowed as ResponseInputItem (for example ResponseApplyPatchToolCall, ResponseApplyPatchToolCallOutput, ResponseCompactionItem) and converting those that should be converted (for example ResponseOutputItem.ImageGenerationCall, ResponseOutputItem.LocalShellCall to respectively ResponseInputItem.ImageGenerationCall, ResponseInputItem.LocalShellCall )
Additional context
In my project, we must manage our own database of messages (store = false), so we store the ResponseInputItem made by the user and the ResponseOutputItem returned by the assistant, and we provide them back for the next question.
But perhaps it is a very bad way to do that?
Confirm this is a feature request for the Node library and not the underlying OpenAI API.
Describe the feature or improvement you're requesting
ResponseOutputItemreturned by the Response API are supposed to be reusable as inputResponseInputItem[]for the next question.But the types do not completely overlap.
It would be great to have a utility function that take an array of
(ResponseInputItem | ResponseOutputItem)[]-- all the user inputs and all the assistant answers -- and convert it to a cleanResponseInputItem[], by removing all theResponseOutputItemthat are not allowed asResponseInputItem(for exampleResponseApplyPatchToolCall,ResponseApplyPatchToolCallOutput,ResponseCompactionItem) and converting those that should be converted (for exampleResponseOutputItem.ImageGenerationCall,ResponseOutputItem.LocalShellCallto respectivelyResponseInputItem.ImageGenerationCall,ResponseInputItem.LocalShellCall)Additional context
In my project, we must manage our own database of messages (store = false), so we store the
ResponseInputItemmade by the user and theResponseOutputItemreturned by the assistant, and we provide them back for the next question.But perhaps it is a very bad way to do that?