Skip to content

Commit

Permalink
add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
fedor-intercom committed May 8, 2024
1 parent 52ce5c5 commit 1f212f4
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions libs/aws/tests/integration_tests/chat_models/test_bedrock.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test Bedrock chat model."""

from typing import Any, cast

import pytest
Expand Down Expand Up @@ -73,6 +74,22 @@ def test_chat_bedrock_streaming() -> None:
assert isinstance(response, BaseMessage)


@pytest.mark.scheduled
def test_chat_bedrock_streaming_llama3() -> None:
"""Test that streaming correctly invokes on_llm_new_token callback."""
callback_handler = FakeCallbackHandler()
chat = ChatBedrock( # type: ignore[call-arg]
model_id="meta.llama3-8b-instruct-v1:0",
streaming=True,
callbacks=[callback_handler],
verbose=True,
)
message = HumanMessage(content="Hello")
response = chat([message])
assert callback_handler.llm_streams > 0
assert isinstance(response, BaseMessage)


@pytest.mark.scheduled
def test_chat_bedrock_streaming_generation_info() -> None:
"""Test that generation info is preserved when streaming."""
Expand Down

0 comments on commit 1f212f4

Please sign in to comment.