@@ -107,7 +107,12 @@ public void GetService_SuccessfullyReturnsUnderlyingClient()
107107 public async Task BasicRequestResponse_NonStreaming ( bool multiContent )
108108 {
109109 const string Input = """
110- {"messages":[{"content":"hello","role":"user"}],"max_tokens":10,"temperature":0.5,"model":"gpt-4o-mini"}
110+ {
111+ "messages": [{"role":"user", "content":"hello"}],
112+ "max_tokens":10,
113+ "temperature":0.5,
114+ "model":"gpt-4o-mini"
115+ }
111116 """ ;
112117
113118 const string Output = """
@@ -178,7 +183,12 @@ [new ChatMessage(ChatRole.User, "hello".Select(c => (AIContent)new TextContent(c
178183 public async Task BasicRequestResponse_Streaming ( bool multiContent )
179184 {
180185 const string Input = """
181- {"messages":[{"content":"hello","role":"user"}],"max_tokens":20,"temperature":0.5,"stream":true,"model":"gpt-4o-mini"}
186+ {
187+ "messages": [{"role":"user", "content":"hello"}],
188+ "max_tokens":20,
189+ "temperature":0.5,
190+ "stream":true,
191+ "model":"gpt-4o-mini"}
182192 """ ;
183193
184194 const string Output = """
@@ -248,7 +258,7 @@ public async Task AdditionalOptions_NonStreaming()
248258 {
249259 const string Input = """
250260 {
251- "messages":[{"content ":"hello","role ":"user "}],
261+ "messages":[{"role ":"user", "content ":"hello "}],
252262 "max_tokens":10,
253263 "temperature":0.5,
254264 "top_p":0.5,
@@ -305,7 +315,7 @@ public async Task ResponseFormat_Text_NonStreaming()
305315 {
306316 const string Input = """
307317 {
308- "messages":[{"content ":"hello","role ":"user "}],
318+ "messages":[{"role ":"user", "content ":"hello "}],
309319 "model":"gpt-4o-mini",
310320 "response_format":{"type":"text"}
311321 }
@@ -341,7 +351,7 @@ public async Task ResponseFormat_Json_NonStreaming()
341351 {
342352 const string Input = """
343353 {
344- "messages":[{"content ":"hello","role ":"user "}],
354+ "messages":[{"role ":"user", "content ":"hello "}],
345355 "model":"gpt-4o-mini",
346356 "response_format":{"type":"json_object"}
347357 }
@@ -375,14 +385,32 @@ public async Task ResponseFormat_Json_NonStreaming()
375385 [ Fact ]
376386 public async Task ResponseFormat_JsonSchema_NonStreaming ( )
377387 {
378- // NOTE: Azure.AI.Inference doesn't yet expose JSON schema support, so it's currently
379- // mapped to "json_object" for the time being.
380-
381388 const string Input = """
382389 {
383- "messages":[{"content ":"hello","role ":"user "}],
390+ "messages":[{"role ":"user", "content ":"hello "}],
384391 "model":"gpt-4o-mini",
385- "response_format":{"type":"json_object"}
392+ "response_format":
393+ {
394+ "type":"json_schema",
395+ "json_schema":
396+ {
397+ "name": "DescribedObject",
398+ "schema":
399+ {
400+ "type":"object",
401+ "properties":
402+ {
403+ "description":
404+ {
405+ "type":"string"
406+ }
407+ },
408+ "required":["description"],
409+ "additionalProperties":false
410+ },
411+ "description":"An object with a description"
412+ }
413+ }
386414 }
387415 """ ;
388416
@@ -428,30 +456,30 @@ public async Task MultipleMessages_NonStreaming()
428456 {
429457 "messages": [
430458 {
431- "content ": "You are a really nice friend. ",
432- "role ": "system "
459+ "role ": "system ",
460+ "content ": "You are a really nice friend. "
433461 },
434462 {
435- "content ": "hello! ",
436- "role ": "user "
463+ "role ": "user ",
464+ "content ": "hello! "
437465 },
438466 {
439- "content ": "hi, how are you? ",
440- "role ": "assistant "
467+ "role ": "assistant ",
468+ "content ": "hi, how are you? "
441469 },
442470 {
443- "content ": "i\u0027m good. how are you? ",
444- "role ": "user "
471+ "role ": "user ",
472+ "content ": "i\u0027m good. how are you? "
445473 },
446474 {
475+ "role": "assistant",
447476 "content": "",
448- "tool_calls": [{"id":"abcd123","type":"function","function":{"name":"GetMood","arguments":"null"}}],
449- "role": "assistant"
477+ "tool_calls": [{"id":"abcd123","type":"function","function":{"name":"GetMood","arguments":"null"}}]
450478 },
451479 {
480+ "role": "tool",
452481 "content": "happy",
453- "tool_call_id": "abcd123",
454- "role": "tool"
482+ "tool_call_id": "abcd123"
455483 }
456484 ],
457485 "temperature": 0.25,
@@ -544,21 +572,21 @@ public async Task MultipleContent_NonStreaming()
544572 "messages":
545573 [
546574 {
575+ "role": "user",
547576 "content":
548577 [
549578 {
550- "text ": "Describe this picture. ",
551- "type ": "text "
579+ "type ": "text ",
580+ "text ": "Describe this picture. "
552581 },
553582 {
583+ "type": "image_url",
554584 "image_url":
555585 {
556586 "url": "http://dot.net/someimage.png"
557- },
558- "type": "image_url"
587+ }
559588 }
560- ],
561- "role":"user"
589+ ]
562590 }
563591 ],
564592 "model": "gpt-4o-mini"
@@ -598,12 +626,12 @@ public async Task NullAssistantText_ContentEmpty_NonStreaming()
598626 {
599627 "messages": [
600628 {
601- "content ": "",
602- "role ": "assistant "
629+ "role ": "assistant ",
630+ "content ": ""
603631 },
604632 {
605- "content ": "hello! ",
606- "role ": "user "
633+ "role ": "user ",
634+ "content ": "hello! "
607635 }
608636 ],
609637 "model": "gpt-4o-mini"
@@ -686,8 +714,8 @@ public async Task FunctionCallContent_NonStreaming(ChatToolMode mode)
686714 {
687715 "messages": [
688716 {
689- "content ": "How old is Alice? ",
690- "role ": "user "
717+ "role ": "user ",
718+ "content ": "How old is Alice? "
691719 }
692720 ],
693721 "model": "gpt-4o-mini",
@@ -797,8 +825,8 @@ public async Task FunctionCallContent_Streaming()
797825 {
798826 "messages": [
799827 {
800- "content ": "How old is Alice? ",
801- "role ": "user "
828+ "role ": "user ",
829+ "content ": "How old is Alice? "
802830 }
803831 ],
804832 "stream": true,
0 commit comments