Web search query should not be considered required
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
- 48/100
Hướng nghiên cứu
Bắt đầu với openai-java-core/src/main/kotlin/com/openai/core/RequestOptions.kt và openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputItem.kt, đặc biệt là validate(), sau đó theo dõi cách xử lý AsyncStreamResponse cho response.output_item.added. Tái tạo payload tìm kiếm web với responseValidation=true và so sánh với responseValidation=false. Được xem là hoàn thành khi các sự kiện tìm kiếm web ban đầu được xử lý mà không làm mất việc xác thực đối với dữ liệu phản hồi về sau.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Using com.openai:openai-java:2.19.1
Unclear if this is a bug or if it's working as designed, so bare with me 😅
When settingresponseValidation=true within RequestOptions streaming responses aborts when the server emits an early web search item via response.output_item.added because the payload doesn't have a search query set.
Here's that payload (no query item here yet):
{
"type": "response.output_item.added",
"sequence_number": 2,
"output_index": 0,
"item": {
"id": "ws_68877a8f32148198991d63ef036cf83f0d6f8dff2e2dac1b",
"type": "web_search_call",
"status": "in_progress",
"action": {
"type": "search"
}
}
}
The SDK calls validate() before my handler runs and throws the following:
java.util.concurrent.CompletionException: com.openai.errors.OpenAIInvalidDataException: `query` is not set
at com.openai.core.http.AsyncStreamResponseKt$toAsync$1$subscribe$1$2.invoke(AsyncStreamResponse.kt:125)
…
Caused by: com.openai.errors.OpenAIInvalidDataException: `query` is not set
When responseValidation=false I do get the ResponseOutputItemAddedEvent sent back to me (without the validation failing)
ResponseOutputItemAddedEvent{item=ResponseOutputItem{webSearchCall=ResponseFunctionWebSearch{id=ws_12345, action=Action{search=Search{query=, type=search, additionalProperties={}}}, status=in_progress, type=web_search_call, additionalProperties={}}}, outputIndex=0, sequenceNumber=2, type=response.output_item.added, additionalProperties={}}
And can lean on the ResponseCompletedEvent to gather a response with the appropriate web results added
So to conclude, this is what happens:
- sending in a query: "use web search tool to find what the top 5 sneakers in US are"
- my handler captures ResponseCreatedEvent
- my handler captures ResponseInProgressEvent
ResponseStreamEvent{inProgress=ResponseInProgressEvent{response=Response{id=resp_123, createdAt=1.753712842E9, error=null, incompleteDetails=null, instructions=Instructions{**instructions**}
, additionalProperties={}}}, Tool{webSearch=WebSearchTool{type=web_search_preview, searchContextSize=medium, userLocation=UserLocation{type=approximate, city=null, country=US, region=null, timezone=null, additionalProperties={}}, additionalProperties={}}}], topP=1.0, background=false, maxOutputTokens=null, maxToolCalls=null, previousResponseId=resp_123, prompt=, reasoning=Reasoning{effort=null, generateSummary=, summary=null, additionalProperties={}}, serviceTier=auto, status=in_progress, text=ResponseTextConfig{format=ResponseFormatTextConfig{text=ResponseFormatText{type=text, additionalProperties={}}}, additionalProperties={}}, topLogprobs=0, truncation=disabled, usage=null, user=null, additionalProperties={store=true, safety_identifier=null, prompt_cache_key=null}}, sequenceNumber=1, type=response.in_progress, additionalProperties={}}}
- receives the web search call in ResponseOutputItemAddedEvent
ResponseOutputItemAddedEvent{item=ResponseOutputItem{webSearchCall=ResponseFunctionWebSearch{id=ws_1234, action=Action{search=Search{query=, type=search, additionalProperties={}}}, status=in_progress, type=web_search_call, additionalProperties={}}}, outputIndex=0, sequenceNumber=2, type=response.output_item.added, additionalProperties={}}
and calls this before it gets back to us, but should it be validating at this point? Also I'm unsure when the query actually gets set, but I'm seeing this in the openAi docs mentioning query may / may not be set at all times
ResponseFunctionWebSearch{id=ws_1234, action=Action{search=Search{query=, type=search, additionalProperties={}}}, status=in_progress, type=web_search_call, additionalProperties={}}
- we still like
responseValidation=trueto be enforced
- Ngôn ngữ chính
- Kotlin
- Star
- 1.5k
- Fork
- 264
- Merge trung bình
- 13 giờ 31 phút
- Pull request đã merge (30 ngày)
- 89
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
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
openai/openai-java#890 ·
-
Độ 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 ·
-
Độ 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 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
openai/openai-java#755 · 1 bình luận ·
-
bug sdk
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
openai/openai-java#652 · 2 bình luận ·
Tất cả issue của openai/openai-java
Issue tương tự
-
[Bug] 统计页面无法重置token和汇率 Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
AAswordman/Operit#1265 · 3 bình luận ·
-
The extension stopped working. Đang mởSource is down
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
keiyoushi/extensions-source#19317 ·
-
Tambahkan bahasa Indonesia Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
acristescu/OnlineGo#216 ·
-
Remove custom segment colors Đang mởenhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
libre-tube/LibreTube#8803 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100