mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-21 02:17:12 +00:00
x
This commit is contained in:
parent
d9715ad797
commit
395008456e
@ -9,12 +9,12 @@ from langchain_anthropic import ChatAnthropic, ChatAnthropicMessages
|
|||||||
MODEL_NAME = "claude-3-5-haiku-latest"
|
MODEL_NAME = "claude-3-5-haiku-latest"
|
||||||
|
|
||||||
|
|
||||||
def test_stream() -> None:
|
# def test_stream() -> None:
|
||||||
"""Test streaming tokens from Anthropic."""
|
# """Test streaming tokens from Anthropic."""
|
||||||
llm = ChatAnthropicMessages(model_name=MODEL_NAME) # type: ignore[call-arg, call-arg]
|
# llm = ChatAnthropicMessages(model_name=MODEL_NAME) # type: ignore[call-arg, call-arg]
|
||||||
|
|
||||||
for token in llm.stream("I'm Pickle Rick"):
|
# for token in llm.stream("I'm Pickle Rick"):
|
||||||
pass
|
# pass
|
||||||
|
|
||||||
|
|
||||||
async def test_astream() -> None:
|
async def test_astream() -> None:
|
||||||
@ -37,18 +37,18 @@ async def test_astream() -> None:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
# async def test_stream_usage() -> 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, stream_usage=False) # type: ignore[call-arg]
|
||||||
# async for token in model.astream("hi"):
|
async for token in model.astream("hi"):
|
||||||
# assert isinstance(token, AIMessageChunk)
|
assert isinstance(token, AIMessageChunk)
|
||||||
# assert token.usage_metadata is None
|
assert token.usage_metadata is None
|
||||||
|
|
||||||
# # check we override with kwarg
|
# check we override with kwarg
|
||||||
# model = ChatAnthropic(model_name=MODEL_NAME) # type: ignore[call-arg]
|
model = ChatAnthropic(model_name=MODEL_NAME) # type: ignore[call-arg]
|
||||||
# assert model.stream_usage
|
assert model.stream_usage
|
||||||
# async for token in model.astream("hi", stream_usage=False):
|
async for token in model.astream("hi", stream_usage=False):
|
||||||
# assert isinstance(token, AIMessageChunk)
|
assert isinstance(token, AIMessageChunk)
|
||||||
# assert token.usage_metadata is None
|
assert token.usage_metadata is None
|
||||||
|
|
||||||
|
|
||||||
async def test_async_stream_twice() -> None:
|
async def test_async_stream_twice() -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user