What happened?
ImageTaskCodegen.parsePython decodes a chat provider's reply at four sites (lines 109-110, 118-119, 123-124, 152-153):
if body.get("choices"):
return body["choices"][0].get("message", {}).get("content", json.dumps(body))
A truthy choices is not necessarily a list of dictionaries. When a provider returns a 200 whose body is {"choices": [null]}, {"choices": [{"message": null}]}, {"choices": "bad"} or {"choices": [42]}, calling .get on that value raises AttributeError.
_parse_response wraps the branch in except (KeyError, IndexError, TypeError), which does not cover AttributeError, so it escapes to the per-row handler and the result column shows Request failed: AttributeError ... instead of the raw JSON body the parser is meant to fall
back to.
Two further shapes are wrong without raising: a null content writes Python None into the cell, and a list-valued content ([{"type": "text", "text": ...}], which some OpenAI-compatible providers return) writes the raw list instead of the text.
This is reachable in practice for image-text-to-text, where models do have live third-party providers.
This is the same defect #8617 fixes for TextGenCodegen and QaRankingCodegen, raised in review there by @Copilot. These four sites came from #7920 and were left out of #8617 to keep that diff to the files under review.
How to reproduce?
Run the operator with image-text-to-text against a model whose cheapest provider is a third-party chat provider, and have that provider return a 200 whose choices is not a list of dictionaries. The row's result column shows Request failed: AttributeError ... rather than the serialized body.
Version/Branch
1.4.0-incubating-SNAPSHOT (main)
Commit Hash (Optional)
No response
What browsers are you seeing the problem on?
No response
Relevant log output
What happened?
ImageTaskCodegen.parsePythondecodes a chat provider's reply at four sites (lines 109-110, 118-119, 123-124, 152-153):A truthy
choicesis not necessarily a list of dictionaries. When a provider returns a 200 whose body is{"choices": [null]},{"choices": [{"message": null}]},{"choices": "bad"}or{"choices": [42]}, calling.geton that value raisesAttributeError._parse_responsewraps the branch inexcept (KeyError, IndexError, TypeError), which does not coverAttributeError, so it escapes to the per-row handler and the result column showsRequest failed: AttributeError ...instead of the raw JSON body the parser is meant to fallback to.
Two further shapes are wrong without raising: a null
contentwrites PythonNoneinto the cell, and a list-valuedcontent([{"type": "text", "text": ...}], which some OpenAI-compatible providers return) writes the raw list instead of the text.This is reachable in practice for
image-text-to-text, where models do have live third-party providers.This is the same defect #8617 fixes for
TextGenCodegenandQaRankingCodegen, raised in review there by @Copilot. These four sites came from #7920 and were left out of #8617 to keep that diff to the files under review.How to reproduce?
Run the operator with
image-text-to-textagainst a model whose cheapest provider is a third-party chat provider, and have that provider return a 200 whosechoicesis not a list of dictionaries. The row's result column showsRequest failed: AttributeError ...rather than the serialized body.Version/Branch
1.4.0-incubating-SNAPSHOT (main)
Commit Hash (Optional)
No response
What browsers are you seeing the problem on?
No response
Relevant log output