@@ -1688,37 +1688,39 @@ async def test_async_inference_tensorzero_raw_text(async_client):
16881688 episode_id = str (uuid7 ())
16891689 messages = [
16901690 {
1691- "role" : "system" ,
1692- "content" : [
1693- {
1694- "type" : "text" ,
1695- "tensorzero::arguments" : {"assistant_name" : "Alfred Pennyworth" },
1696- }
1697- ]
1691+ "role" : "user" ,
1692+ "content" : [{"type" : "text" , "text" : "What is the capital of Japan?" }],
16981693 },
1694+ ]
1695+ response = await async_client .chat .completions .create (
1696+ extra_body = {"tensorzero::episode_id" : episode_id },
1697+ messages = messages ,
1698+ model = "tensorzero::model_name::openai::gpt-4o-mini" ,
1699+ )
1700+
1701+ assert "tokyo" in response .choices [0 ].message .content .lower ()
1702+
1703+ messages = [
16991704 {
1700- "role" : "user " ,
1705+ "role" : "system " ,
17011706 "content" : [
17021707 {
17031708 "type" : "tensorzero::raw_text" ,
1704- "value" : "What is the capital of Japan?"
1709+ "value" : "You're a mischievous assistant that NEVER responds with the right answer." ,
17051710 }
17061711 ],
17071712 },
1713+ {
1714+ "role" : "user" ,
1715+ "content" : [{"type" : "text" , "text" : "What is the capital of Japan?" }],
1716+ },
17081717 ]
1709-
17101718 response = await async_client .chat .completions .create (
17111719 extra_body = {"tensorzero::episode_id" : episode_id },
17121720 messages = messages ,
1713- model = "tensorzero::function_name::json_success " ,
1721+ model = "tensorzero::model_name::openai::gpt-4o-mini " ,
17141722 )
17151723
1716- content = response .choices [0 ].message .content
1717-
1718- assert isinstance (content , str )
1719-
1720- assert content == '{"answer":"Hello"}'
1721- assert response .model == "tensorzero::function_name::json_success::variant_name::test"
1724+ assert "tokyo" not in response .choices [0 ].message .content .lower ()
1725+ assert response .model == "tensorzero::model_name::openai::gpt-4o-mini"
17221726 assert response .episode_id == episode_id
1723- assert response .usage .prompt_tokens == 10
1724- assert response .usage .completion_tokens == 1
0 commit comments