mirror of
https://github.com/hwchase17/langchain.git
synced 2026-05-17 04:45:11 +00:00
fix(anthropic): cast MessageFinishData to dict for metadata access in test
The `MessageFinishData` TypedDict doesn't declare the `metadata` key that the compat bridge injects at runtime. Cast to `dict[str, Any]` to satisfy mypy, matching the existing pattern used for content blocks in the same test.
This commit is contained in:
@@ -3206,6 +3206,6 @@ def test_anthropic_stream_v2_lifecycle() -> None:
|
||||
# (protocol 0.0.9 moved the finish reason off the top-level event
|
||||
# and into `metadata`, where the bridge deposits the provider's raw
|
||||
# `stop_reason` alongside other response metadata).
|
||||
message_finish = stream_events[-1]
|
||||
message_finish = cast("dict[str, Any]", stream_events[-1])
|
||||
assert message_finish["event"] == "message-finish"
|
||||
assert message_finish["metadata"]["stop_reason"] == "tool_use"
|
||||
|
||||
Reference in New Issue
Block a user