Deserializing ResponseInputItem results in unknown state
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu với đường dẫn giải tuần tự hóa ResponseInputItem.Message và so sánh nó với đường dẫn ResponseOutputMessage, sử dụng bản tái hiện testSerializeInputItem được cung cấp. Xác nhận rằng các giá trị ResponseInputItem.Message đã được tuần tự hóa và giải tuần tự hóa được so sánh là bằng nhau mà không trở thành unknown; bài kiểm thử output-item hiện có cung cấp một trường hợp so sánh hoạt động được.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hey there! 👋
I'm working with the OpenAI Java SDK for a couple of days now and really like it. The general design of the library is fantastic and I'm having quite a lot fun working with it. Thanks! 👍
I stumbled upon an issue which I think is a bug. Let me first clarify about my goals: I'm using the Responses API part of the library to implement Chat-Bot like conversations. My requirement is to use ResponseCreateParams.builder().store(false) and instead serialize conversation state locally by myself.
Here's an example of what I do:
val jsonMapper = jsonMapper()
val inputItems: List<ResponseInputItem> = ...
val jsonData = jsonMapper.writeValueAsString(inputItems)
// store jsonData locally
// later:
val deserializedInputItems = jsonMapper.readValue(nativeData, object : TypeReference<MutableList<ResponseInputItem>>() {})
// attach new user message and continue conversation
This works pretty well. However I've noticed the following behavior:
When a ResponseInputItem from a ResponseInputItem.Message gets serialized and deserialized again, it's in an unknown state. The message field is null but the _json() field still holds the correct structured data from the original message.
Here's are a Kotlin Test to demonstrate the behavior:
❌ This test fails with v3.0.3
@Test
fun testSerializeInputItem() {
// given
val message = ResponseInputItem.Message.builder()
.role(ResponseInputItem.Message.Role.USER)
.addInputTextContent("Test")
.build()
val inputItem1 = ResponseInputItem.ofMessage(message)
// when
val jsonMapper = jsonMapper()
val inputItemJson = jsonMapper.writeValueAsString(inputItem1)
val inputItem2 = jsonMapper.readValue(inputItemJson, ResponseInputItem::class.java)
// then
Assertions.assertEquals(inputItem1, inputItem2)
}
Test fails:
Expected :ResponseInputItem{message=Message{content=[ResponseInputContent{inputText=ResponseInputText{text=Test, type=input_text, additionalProperties={}}}], role=user, status=, type=, additionalProperties={}}}
Actual :ResponseInputItem{_unknown={content=[{text=Test, type=input_text}], role=user}}
I couldn't reproduce this issue with other types of ResponseInputItems, e.g. for ResponseOutputMessage the test succeeds:
🟢 This test succeeds with v3.0.3
@Test
fun testSerializeOutputItem() {
val message = ResponseOutputMessage.builder()
.id("my_id")
.status(ResponseOutputMessage.Status.COMPLETED)
.addContent(
ResponseOutputText.builder()
.text("Test")
.annotations(emptyList())
.build()
)
.build()
val inputItem1 = ResponseInputItem.ofResponseOutputMessage(message)
val jsonMapper = jsonMapper()
val inputItemJson = jsonMapper.writeValueAsString(inputItem1)
val inputItem2 = jsonMapper.readValue(inputItemJson, ResponseInputItem::class.java)
Assertions.assertEquals(inputItem1, inputItem2)
}
Could you please clarify if this a bug? Or am I doing something wrong / unintended here?
- Ngôn ngữ chính
- Kotlin
- Star
- 1.5k
- Fork
- 266
- Merge trung bình
- 11 giờ 31 phút
- Pull request đã merge (30 ngày)
- 150
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của openai/openai-java
-
HttpRequest.url() logs spaces in path segments as literal plus signsCó thể đã có người làm @sylvesterkaczmarek đã nhận 56 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
openai/openai-java#886 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Make diarized transcription duration and task optionalCó thể đã có người làm @wskr00 đã nhận 86 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
openai/openai-java#802 · 2 bình luận · 3 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 42/100
openai/openai-java#1160 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
AsyncStreamResponse can hang when the subscriber executor rejects workCó thể đã có người làm @sylvesterkaczmarek đã nhận 39 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 74/100
openai/openai-java#973 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
openai/openai-java#956 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của openai/openai-java
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
damontecres/Wholphin#2069 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Android (vision-camera-location): HybridLocationManager never quits its HandlerThread on disposeĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
margelo/react-native-vision-camera#4217 ·
Maintainer thường phản hồi trong vòng 4 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
saisaharsh3/Leftovers#13 · 1 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 67/100
navikt/esyfo-narmesteleder#700 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[DEV] Update ktlintĐang mởbackend maintenance
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
digitalfabrik/entitlementcard#3183 ·
Maintainer thường phản hồi trong vòng 7 ngày