Spaces:
Runtime error
Runtime error
File size: 597 Bytes
acc4ffe |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
"""Test Anthropic API wrapper."""
from typing import Generator
from langchain.llms.anthropic import Anthropic
def test_anthropic_call() -> None:
"""Test valid call to anthropic."""
llm = Anthropic(model="bare-nano-0")
output = llm("Say foo:")
assert isinstance(output, str)
def test_anthropic_streaming() -> None:
"""Test streaming tokens from anthropic."""
llm = Anthropic(model="bare-nano-0")
generator = llm.stream("I'm Pickle Rick")
assert isinstance(generator, Generator)
for token in generator:
assert isinstance(token["completion"], str)
|