@@ -1685,28 +1685,35 @@ async def test_async_inference_tensorzero_raw_text(async_client):
16851685 """
16861686 Test that chat inference with a tensorzero::raw_text block works correctly
16871687 """
1688- episode_id = str (uuid7 ())
16891688 messages = [
1689+ {
1690+ "role" : "assistant" ,
1691+ "content" : [
1692+ {
1693+ "type" : "text" ,
1694+ "tensorzero::arguments" : {"assistant_name" : "Megumin" },
1695+ }
1696+ ],
1697+ },
16901698 {
16911699 "role" : "user" ,
16921700 "content" : [{"type" : "text" , "text" : "What is the capital of Japan?" }],
16931701 },
16941702 ]
16951703 response = await async_client .chat .completions .create (
1696- extra_body = {"tensorzero::episode_id" : episode_id },
16971704 messages = messages ,
1698- model = "tensorzero::model_name::openai::gpt-4o-mini " ,
1705+ model = "tensorzero::function_name::openai_with_assistant_schema " ,
16991706 )
17001707
17011708 assert "tokyo" in response .choices [0 ].message .content .lower ()
17021709
17031710 messages = [
17041711 {
1705- "role" : "system " ,
1712+ "role" : "assistant " ,
17061713 "content" : [
17071714 {
17081715 "type" : "tensorzero::raw_text" ,
1709- "value" : "You're a mischievous assistant that NEVER responds with the right answer ." ,
1716+ "value" : "You're a mischievous assistant that says fake information. Very concise ." ,
17101717 }
17111718 ],
17121719 },
@@ -1716,11 +1723,12 @@ async def test_async_inference_tensorzero_raw_text(async_client):
17161723 },
17171724 ]
17181725 response = await async_client .chat .completions .create (
1719- extra_body = {"tensorzero::episode_id" : episode_id },
17201726 messages = messages ,
1721- model = "tensorzero::model_name::openai::gpt-4o-mini " ,
1727+ model = "tensorzero::function_name::openai_with_assistant_schema " ,
17221728 )
17231729
17241730 assert "tokyo" not in response .choices [0 ].message .content .lower ()
1725- assert response .model == "tensorzero::model_name::openai::gpt-4o-mini"
1726- assert response .episode_id == episode_id
1731+ assert (
1732+ response .model
1733+ == "tensorzero::function_name::openai_with_assistant_schema::variant_name::openai"
1734+ )
0 commit comments