fix(databricks): read the thinking signature with get to satisfy the type checker

thinking_blocks is a union that includes ChatCompletionRedactedThinkingBlock,
which has no signature key, so subscripting it tripped
reportGeneralTypeIssues and breached the basedpyright budget. The filter
already guarantees the key is present.
This commit is contained in:
pokepoke81 2026-08-21 14:50:51 -04:00
parent 40c09ee27d
commit a48db2e7d7
2 changed files with 3 additions and 1 deletions

View file

@ -502,7 +502,7 @@ class DatabricksConfig(DatabricksBase, OpenAILikeChatConfig, AnthropicConfig):
holds_reasoning: Final = any(isinstance(b, dict) and b.get("type") == "reasoning" for b in existing)
replace: Final = signed is not None and not holds_reasoning and bool(existing)
text: Final = (signed.get("thinking") or "") if signed is not None else ""
signature: Final = signed["signature"] if signed is not None else ""
signature: Final = (signed.get("signature") or "") if signed is not None else ""
entry: Final = {"type": "summary_text", "text": text, "signature": signature} # mutable-ok: provider JSON
block: Final = {"type": "reasoning", "summary": [entry]} # mutable-ok: outbound provider JSON
rebuilt: Final = {**stripped, "content": [block, *existing]} # mutable-ok: outbound provider JSON

View file

@ -496,6 +496,8 @@ def test_chunk_parser_without_usage_still_parses_content():
assert result.id == "chatcmpl-test"
assert result.model == "databricks-claude-sonnet-5"
assert result.choices[0]["delta"]["content"] == "hi"
def _thinking_message(thinking_blocks, content="391"):
return {"role": "assistant", "content": content, "thinking_blocks": thinking_blocks}