From 5fc05ee39e285d449416fd312e8e55c497c000aa Mon Sep 17 00:00:00 2001 From: Hemang Date: Mon, 10 Feb 2025 09:57:04 +0100 Subject: [PATCH] Use the chat completions API response to verify the trace in explorer. --- tests/open_ai/test_chat_without_tool_calls.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/open_ai/test_chat_without_tool_calls.py b/tests/open_ai/test_chat_without_tool_calls.py index 5ad439a..c669b61 100644 --- a/tests/open_ai/test_chat_without_tool_calls.py +++ b/tests/open_ai/test_chat_without_tool_calls.py @@ -38,6 +38,10 @@ async def test_chat_completion_without_streaming(context, explorer_api_url, prox # Verify the chat response assert "PARIS" in chat_response.choices[0].message.content.upper() + expect_assistant_message = { + "role": chat_response.choices[0].message.role, + "content": chat_response.choices[0].message.content, + } # Fetch the trace ids for the dataset traces_response = await context.request.get( @@ -59,5 +63,4 @@ async def test_chat_completion_without_streaming(context, explorer_api_url, prox "role": "user", "content": "What is the capital of France?", } - assert trace["messages"][1]["role"] == "assistant" - assert "PARIS" in trace["messages"][1]["content"].upper() + assert trace["messages"][1] == expect_assistant_message