From 24bdde58aacfed7fa1f3cb9e473353d040ee2c59 Mon Sep 17 00:00:00 2001 From: shankar_ws3 Date: Mon, 13 May 2024 16:35:32 -0700 Subject: [PATCH] adding test case --- tests/test_llm.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_llm.py b/tests/test_llm.py index b10ba7fc..8f065530 100644 --- a/tests/test_llm.py +++ b/tests/test_llm.py @@ -36,6 +36,19 @@ def test_chat_with_mock(openai_llm_mock): # noqa: F811 ) +@pytest.mark.parametrize( + "openai_llm_mock", ["mocked response"], indirect=["openai_llm_mock"] +) +def test_chat_with_mock(openai_llm_mock): # noqa: F811 + llm = OpenAILLM() + response = llm.chat([{"role": "user", "content": "test prompt"}]) + assert response == "mocked response" + openai_llm_mock.chat.completions.create.assert_called_once_with( + model="gpt-4-turbo", + messages=[{"role": "user", "content": "test prompt"}], + ) + + @pytest.mark.parametrize( "openai_llm_mock", ["mocked response"], indirect=["openai_llm_mock"] )