mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-16 23:13:31 +00:00
Harrison/athropic (#921)
Co-authored-by: Mike Lambert <mlambert@gmail.com> Co-authored-by: mrbean <sam@you.com> Co-authored-by: mrbean <43734688+sam-h-bean@users.noreply.github.com> Co-authored-by: Ivan Vendrov <ivendrov@gmail.com>
This commit is contained in:
23
tests/integration_tests/llms/test_anthropic.py
Normal file
23
tests/integration_tests/llms/test_anthropic.py
Normal file
@@ -0,0 +1,23 @@
|
||||
"""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)
|
Reference in New Issue
Block a user