This commit is contained in:
Chester Curme 2025-05-08 13:01:28 -04:00
parent e01c52d2d0
commit 3516c2c394

View File

@ -38,17 +38,12 @@ async def test_astream() -> None:
async def test_stream_usage() -> None:
model = ChatAnthropic(model_name=MODEL_NAME, stream_usage=False) # type: ignore[call-arg]
model = ChatAnthropic(model_name=MODEL_NAME) # type: ignore[call-arg]
async for token in model.astream("hi"):
assert isinstance(token, AIMessageChunk)
assert token.usage_metadata is None
# check we override with kwarg
model = ChatAnthropic(model_name=MODEL_NAME) # type: ignore[call-arg]
assert model.stream_usage
async for token in model.astream("hi", stream_usage=False):
async for token in model.astream("hi"):
assert isinstance(token, AIMessageChunk)
assert token.usage_metadata is None
async def test_async_stream_twice() -> None: