From 072966b1ab566f78cf8dd646c54fff5e66208964 Mon Sep 17 00:00:00 2001 From: BeatrixCohere <128378696+BeatrixCohere@users.noreply.github.com> Date: Fri, 27 Oct 2023 11:08:44 +0100 Subject: [PATCH 1/3] Add comments --- tests/async/test_async_chat.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/async/test_async_chat.py b/tests/async/test_async_chat.py index 2efd6d50c..c21e35ab7 100644 --- a/tests/async/test_async_chat.py +++ b/tests/async/test_async_chat.py @@ -34,7 +34,7 @@ async def test_async_multi_replies(async_client): async def test_async_chat_stream(async_client): conversation_id = f"test_conv_{conftest.random_word()}" res = await async_client.chat( - message="wagmi", + message="How deep in the Mariana Trench?", max_tokens=5, conversation_id=conversation_id, stream=True, @@ -47,9 +47,11 @@ async def test_async_chat_stream(async_client): assert res.response_id is None expected_index = 0 + saw_stream_start = False expected_text = "" async for token in res: if isinstance(token, cohere.responses.chat.StreamStart): + saw_stream_start = True assert token.generation_id is not None assert not token.is_finished elif isinstance(token, cohere.responses.chat.StreamTextGeneration): @@ -62,7 +64,9 @@ async def test_async_chat_stream(async_client): assert token.index == expected_index expected_index += 1 - assert res.texts == [expected_text] + assert saw_stream_start, "no stream start event" + assert res.texts is not None, "no text generated" + assert res.texts == [expected_text], "final text generated is not the same as the combined text sent" assert res.conversation_id is not None assert res.response_id is not None From 66bc4f20cca16cc609c13b19fe601fca199dae83 Mon Sep 17 00:00:00 2001 From: BeatrixCohere <128378696+BeatrixCohere@users.noreply.github.com> Date: Fri, 27 Oct 2023 11:11:09 +0100 Subject: [PATCH 2/3] Change --- .readthedocs.yml | 6 ++++++ tests/async/test_async_chat.py | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 .readthedocs.yml diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 000000000..16d77e025 --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,6 @@ +version: 2 + +build: + os: ubuntu-22.04 + tools: + python: "3.8" \ No newline at end of file diff --git a/tests/async/test_async_chat.py b/tests/async/test_async_chat.py index c21e35ab7..2dbad3eb5 100644 --- a/tests/async/test_async_chat.py +++ b/tests/async/test_async_chat.py @@ -64,9 +64,11 @@ async def test_async_chat_stream(async_client): assert token.index == expected_index expected_index += 1 - assert saw_stream_start, "no stream start event" - assert res.texts is not None, "no text generated" - assert res.texts == [expected_text], "final text generated is not the same as the combined text sent" + assert saw_stream_start, f"no stream start event conversation id is {conversation_id}" + assert res.texts is not None, f"no text generated conversation id is {conversation_id}" + assert res.texts == [ + expected_text + ], f"final text generated is not the same as the combined text sent conversation id is {conversation_id}" assert res.conversation_id is not None assert res.response_id is not None From 42e4cb3195bcbe1745e6d37535434374d2d7e266 Mon Sep 17 00:00:00 2001 From: BeatrixCohere <128378696+BeatrixCohere@users.noreply.github.com> Date: Fri, 27 Oct 2023 11:32:46 +0100 Subject: [PATCH 3/3] Change --- .readthedocs.yml | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 .readthedocs.yml diff --git a/.readthedocs.yml b/.readthedocs.yml deleted file mode 100644 index 16d77e025..000000000 --- a/.readthedocs.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: 2 - -build: - os: ubuntu-22.04 - tools: - python: "3.8" \ No newline at end of file