-
Notifications
You must be signed in to change notification settings - Fork 143
Description
What is the recommended way of storing/serializing instances of ResponseInputItem for use/re-use in conversational context with the responses API?
I'm trying to follow the example presented in ResponsesConversationExample.java, which works great for short lived in memory situations where you can directly feed the output messages back into the call to openAIClient.responses().create(), however I have a use case that requires me to store these inputs for re-use over multiple HTTP requests from a client into a distributed cache, which requires them to be serialized.
Attempting to serialize them directly to JSON using Jackson/ObjectMapper produces JSON strings containing the validation state, i.e. "valid" : true. When deserializing these back into objects and feeding them into the API requests, it fails with the following error:
com.openai.errors.BadRequestException: 400: Unknown parameter: 'input[0].valid'.
at com.openai.errors.BadRequestException$Builder.build(BadRequestException.kt:88)
at com.openai.core.handlers.ErrorHandler$withErrorHandler$1.handle(ErrorHandler.kt:48)
at com.openai.services.blocking.ResponseServiceImpl$WithRawResponseImpl$create$1.invoke(ResponseServiceImpl.kt:106)
at com.openai.services.blocking.ResponseServiceImpl$WithRawResponseImpl$create$1.invoke(ResponseServiceImpl.kt:104)
at com.openai.core.http.HttpResponseForKt$parseable$1$parsed$2.invoke(HttpResponseFor.kt:14)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.openai.core.http.HttpResponseForKt$parseable$1.getParsed(HttpResponseFor.kt:14)
at com.openai.core.http.HttpResponseForKt$parseable$1.parse(HttpResponseFor.kt:16)
at com.openai.services.blocking.ResponseServiceImpl.create(ResponseServiceImpl.kt:51)
at com.openai.services.blocking.ResponseService.create(ResponseService.kt:40)
I assume this is because the validation state is being sent in the input objects of the API request, which is not a valid field in the REST API.