Web search query should not be considered required
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
openai-java-core/src/main/kotlin/com/openai/core/RequestOptions.kt と openai-java-core/src/main/kotlin/com/openai/models/responses/ResponseOutputItem.kt から始め、特に validate() を確認してから、response.output_item.added に対する AsyncStreamResponse の処理を追跡します。responseValidation=true の Web 検索ペイロードを再現し、responseValidation=false の場合と比較します。後続のレスポンスデータに対する検証を失うことなく、初期の Web 検索イベントが処理されれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Kotlin
- スター
- 1.5k
- フォーク
- 266
- 平均マージ
- 9時間 50分
- マージ済み PR(30日)
- 146
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
openai/openai-java のほかの issue
-
HttpRequest.url() logs spaces in path segments as literal plus signs対応中かも @sylvesterkaczmarek が 53 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
openai/openai-java#886 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Make diarized transcription duration and task optional対応中かも @wskr00 が 83 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
openai/openai-java#802 · コメント 2 件 · リアクション 3 件 ·
メンテナーはふだん 1 日以内に返信
-
AsyncStreamResponse can hang when the subscriber executor rejects work対応中かも @sylvesterkaczmarek が 36 日前に担当しました。 オープン
難易度 3/5 1〜2日 初心者へのやさしさ 74/100
openai/openai-java#973 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
openai/openai-java#956 ·
メンテナーはふだん 1 日以内に返信
-
Async internal plumbing bypasses both `dispatcherExecutorService` and `streamHandlerExecutor`, forcing a hop through `ForkJoinPool.commonPool()`対応中かも @sylvesterkaczmarek が 30 日前に担当しました。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
openai/openai-java#952 ·
メンテナーはふだん 1 日以内に返信
openai/openai-java の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1時間未満 初心者へのやさしさ 72/100
afarber/OpenMapView#22 ·
-
Feature:Resolution
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
intellij-elixir/intellij-elixir#4396 ·
メンテナーはふだん 1 日以内に返信
-
ExprQuerySet.getChildren() omits WITH clause対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
partiql/partiql-lang-kotlin#1972 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
navikt/soknadsarkiverer#293 ·
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
FoedusProgramme/Gramophone#1048 ·