@@ -2036,15 +2036,15 @@ def test_convert_simple_request_response(self):
20362036 raw_data = [
20372037 {
20382038 "format" : "observability" ,
2039- "request" : [
2039+ "request" : json . dumps (
20402040 {"role" : "user" , "parts" : [{"content" : "Hello" , "type" : "text" }]}
2041- ] ,
2042- "response" : [
2041+ ) ,
2042+ "response" : json . dumps (
20432043 {
20442044 "role" : "system" ,
20452045 "parts" : [{"content" : "Hi" , "type" : "text" }],
20462046 }
2047- ] ,
2047+ ) ,
20482048 }
20492049 ]
20502050 result_dataset = self .converter .convert (raw_data )
@@ -2068,19 +2068,21 @@ def test_convert_with_system_instruction(self):
20682068 raw_data = [
20692069 {
20702070 "format" : "observability" ,
2071- "request" : [
2071+ "request" : json . dumps (
20722072 {"role" : "user" , "parts" : [{"content" : "Hello" , "type" : "text" }]}
2073- ] ,
2074- "response" : [
2073+ ) ,
2074+ "response" : json . dumps (
20752075 {
20762076 "role" : "system" ,
20772077 "parts" : [{"content" : "Hi" , "type" : "text" }],
20782078 }
2079- ],
2080- "system_instruction" : {
2081- "role" : "user" ,
2082- "parts" : [{"content" : "Be helpful" , "type" : "text" }],
2083- },
2079+ ),
2080+ "system_instruction" : json .dumps (
2081+ {
2082+ "role" : "user" ,
2083+ "parts" : [{"content" : "Be helpful" , "type" : "text" }],
2084+ }
2085+ ),
20842086 }
20852087 ]
20862088 result_dataset = self .converter .convert (raw_data )
@@ -2093,22 +2095,28 @@ def test_convert_with_conversation_history(self):
20932095 raw_data = [
20942096 {
20952097 "format" : "observability" ,
2096- "request" : [
2097- {"role" : "user" , "parts" : [{"content" : "Hello" , "type" : "text" }]},
2098- {"role" : "system" , "parts" : [{"content" : "Hi" , "type" : "text" }]},
2098+ "request" : json .dumps (
2099+ {"role" : "user" , "parts" : [{"content" : "Hello" , "type" : "text" }]}
2100+ )
2101+ + "\n "
2102+ + json .dumps (
2103+ {"role" : "system" , "parts" : [{"content" : "Hi" , "type" : "text" }]}
2104+ )
2105+ + "\n "
2106+ + json .dumps (
20992107 {
21002108 "role" : "user" ,
21012109 "parts" : [
21022110 {"content" : "What's the meaning of life?" , "type" : "text" }
21032111 ],
2104- },
2105- ] ,
2106- "response" : [
2112+ }
2113+ ) ,
2114+ "response" : json . dumps (
21072115 {
21082116 "role" : "system" ,
21092117 "parts" : [{"content" : "42." , "type" : "text" }],
21102118 }
2111- ] ,
2119+ ) ,
21122120 }
21132121 ]
21142122
@@ -2139,27 +2147,27 @@ def test_convert_multiple_request_response(self):
21392147 raw_data = [
21402148 {
21412149 "format" : "observability" ,
2142- "request" : [
2150+ "request" : json . dumps (
21432151 {"role" : "user" , "parts" : [{"content" : "Hello" , "type" : "text" }]}
2144- ] ,
2145- "response" : [
2152+ ) ,
2153+ "response" : json . dumps (
21462154 {
21472155 "role" : "system" ,
21482156 "parts" : [{"content" : "Hi" , "type" : "text" }],
21492157 }
2150- ] ,
2158+ ) ,
21512159 },
21522160 {
21532161 "format" : "observability" ,
2154- "request" : [
2162+ "request" : json . dumps (
21552163 {"role" : "user" , "parts" : [{"content" : "Goodbye" , "type" : "text" }]}
2156- ] ,
2157- "response" : [
2164+ ) ,
2165+ "response" : json . dumps (
21582166 {
21592167 "role" : "system" ,
21602168 "parts" : [{"content" : "Bye" , "type" : "text" }],
21612169 }
2162- ] ,
2170+ ) ,
21632171 },
21642172 ]
21652173 result_dataset = self .converter .convert (raw_data )
@@ -2187,7 +2195,7 @@ def test_convert_skips_unknown_part_type(self):
21872195 raw_data = [
21882196 {
21892197 "format" : "observability" ,
2190- "request" : [
2198+ "request" : json . dumps (
21912199 {
21922200 "role" : "user" ,
21932201 "parts" : [
@@ -2196,13 +2204,13 @@ def test_convert_skips_unknown_part_type(self):
21962204 {"content" : "Hello" , "type" : "text" },
21972205 ],
21982206 }
2199- ] ,
2200- "response" : [
2207+ ) ,
2208+ "response" : json . dumps (
22012209 {
22022210 "role" : "system" ,
22032211 "parts" : [{"content" : "Hi" , "type" : "text" }],
22042212 }
2205- ] ,
2213+ ) ,
22062214 }
22072215 ]
22082216
@@ -2217,12 +2225,12 @@ def test_convert_skips_missing_request(self):
22172225 raw_data = [
22182226 {
22192227 "format" : "observability" ,
2220- "response" : [
2228+ "response" : json . dumps (
22212229 {
22222230 "role" : "system" ,
22232231 "parts" : [{"content" : "Hi" , "type" : "text" }],
22242232 }
2225- ] ,
2233+ ) ,
22262234 }
22272235 ]
22282236 result_dataset = self .converter .convert (raw_data )
@@ -2232,9 +2240,9 @@ def test_convert_skips_missing_response(self):
22322240 raw_data = [
22332241 {
22342242 "format" : "observability" ,
2235- "request" : [
2243+ "request" : json . dumps (
22362244 {"role" : "user" , "parts" : [{"content" : "Hello" , "type" : "text" }]}
2237- ] ,
2245+ ) ,
22382246 }
22392247 ]
22402248 result_dataset = self .converter .convert (raw_data )
@@ -2244,7 +2252,7 @@ def test_convert_tool_call_parts(self):
22442252 raw_data = [
22452253 {
22462254 "format" : "observability" ,
2247- "request" : [
2255+ "request" : json . dumps (
22482256 {
22492257 "role" : "user" ,
22502258 "parts" : [
@@ -2256,8 +2264,8 @@ def test_convert_tool_call_parts(self):
22562264 }
22572265 ],
22582266 }
2259- ] ,
2260- "response" : [
2267+ ) ,
2268+ "response" : json . dumps (
22612269 {
22622270 "role" : "system" ,
22632271 "parts" : [
@@ -2268,7 +2276,7 @@ def test_convert_tool_call_parts(self):
22682276 }
22692277 ],
22702278 }
2271- ] ,
2279+ ) ,
22722280 }
22732281 ]
22742282 result_dataset = self .converter .convert (raw_data )
@@ -3433,15 +3441,15 @@ def test_auto_detect_observability_schema(self):
34333441 raw_data = [
34343442 {
34353443 "format" : "observability" ,
3436- "request" : [
3444+ "request" : json . dumps (
34373445 {"role" : "user" , "parts" : [{"content" : "Hello" , "type" : "text" }]}
3438- ] ,
3439- "response" : [
3446+ ) ,
3447+ "response" : json . dumps (
34403448 {
34413449 "role" : "system" ,
34423450 "parts" : [{"content" : "Hi" , "type" : "text" }],
34433451 }
3444- ] ,
3452+ ) ,
34453453 }
34463454 ]
34473455 assert (
0 commit comments