diff --git a/litellm-rust/crates/python-compat/generated/values.json b/litellm-rust/crates/python-compat/generated/values.json index 49a856c0c9e..be81ba326f9 100644 --- a/litellm-rust/crates/python-compat/generated/values.json +++ b/litellm-rust/crates/python-compat/generated/values.json @@ -18,6 +18,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "null", "pickle": { "0": "4e2e", @@ -46,6 +52,12 @@ "lax_int": { "value": "1" }, + "lax_float": { + "value": "1.0" + }, + "lax_bool": { + "value": "True" + }, "json": "true", "pickle": { "0": "4930310a2e", @@ -74,6 +86,12 @@ "lax_int": { "value": "0" }, + "lax_float": { + "value": "0.0" + }, + "lax_bool": { + "value": "False" + }, "json": "false", "pickle": { "0": "4930300a2e", @@ -102,6 +120,12 @@ "lax_int": { "value": "0" }, + "lax_float": { + "value": "0.0" + }, + "lax_bool": { + "value": "False" + }, "json": "0", "pickle": { "0": "49300a2e", @@ -130,6 +154,12 @@ "lax_int": { "value": "-7" }, + "lax_float": { + "value": "-7.0" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "-7", "pickle": { "0": "492d370a2e", @@ -158,6 +188,12 @@ "lax_int": { "value": "9223372036854775807" }, + "lax_float": { + "value": "9.223372036854776e+18" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "9223372036854775807", "pickle": { "0": "4c393232333337323033363835343737353830374c0a2e", @@ -186,6 +222,12 @@ "lax_int": { "value": "-9223372036854775808" }, + "lax_float": { + "value": "-9.223372036854776e+18" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "-9223372036854775808", "pickle": { "0": "4c2d393232333337323033363835343737353830384c0a2e", @@ -214,6 +256,12 @@ "lax_int": { "value": "18446744073709551616" }, + "lax_float": { + "value": "1.8446744073709552e+19" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "18446744073709551616", "pickle": { "0": "4c31383434363734343037333730393535313631364c0a2e", @@ -242,6 +290,12 @@ "lax_int": { "value": "-1180591620717411303424" }, + "lax_float": { + "value": "-1.1805916207174113e+21" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "-1180591620717411303424", "pickle": { "0": "4c2d313138303539313632303731373431313330333432344c0a2e", @@ -270,6 +324,12 @@ "lax_int": { "value": "0" }, + "lax_float": { + "value": "0.0" + }, + "lax_bool": { + "value": "False" + }, "json": "0.0", "pickle": { "0": "46302e300a2e", @@ -298,6 +358,12 @@ "lax_int": { "value": "0" }, + "lax_float": { + "value": "-0.0" + }, + "lax_bool": { + "value": "False" + }, "json": "-0.0", "pickle": { "0": "462d302e300a2e", @@ -326,6 +392,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "0.2" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "0.2", "pickle": { "0": "46302e320a2e", @@ -354,6 +426,12 @@ "lax_int": { "value": "1" }, + "lax_float": { + "value": "1.0" + }, + "lax_bool": { + "value": "True" + }, "json": "1.0", "pickle": { "0": "46312e300a2e", @@ -382,6 +460,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "-1.5" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "-1.5", "pickle": { "0": "462d312e350a2e", @@ -410,6 +494,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "0.30000000000000004" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "0.30000000000000004", "pickle": { "0": "46302e33303030303030303030303030303030340a2e", @@ -438,6 +528,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "123456789.123" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "123456789.123", "pickle": { "0": "463132333435363738392e3132330a2e", @@ -466,6 +562,12 @@ "lax_int": { "value": "1000000000000000" }, + "lax_float": { + "value": "1000000000000000.0" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "1000000000000000.0", "pickle": { "0": "46313030303030303030303030303030302e300a2e", @@ -494,6 +596,12 @@ "lax_int": { "value": "10000000000000000" }, + "lax_float": { + "value": "1e+16" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "1e+16", "pickle": { "0": "4631652b31360a2e", @@ -522,6 +630,12 @@ "lax_int": { "value": "15000000000000000" }, + "lax_float": { + "value": "1.5e+16" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "1.5e+16", "pickle": { "0": "46312e35652b31360a2e", @@ -550,6 +664,12 @@ "lax_int": { "value": "9999999999999998" }, + "lax_float": { + "value": "9999999999999998.0" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "9999999999999998.0", "pickle": { "0": "46393939393939393939393939393939382e300a2e", @@ -578,6 +698,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "0.0001" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "0.0001", "pickle": { "0": "46302e303030310a2e", @@ -606,6 +732,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "1e-05" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "1e-05", "pickle": { "0": "4631652d30350a2e", @@ -634,6 +766,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "1.25e-07" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "1.25e-07", "pickle": { "0": "46312e3235652d30370a2e", @@ -662,6 +800,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "5e-324" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "5e-324", "pickle": { "0": "4635652d3332340a2e", @@ -690,6 +834,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "1.7976931348623157e+308" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "1.7976931348623157e+308", "pickle": { "0": "46312e37393736393331333438363233313537652b3330380a2e", @@ -718,6 +868,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "1e+22" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "1e+22", "pickle": { "0": "4631652b32320a2e", @@ -746,6 +902,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "inf" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "Infinity", "pickle": { "0": "46696e660a2e", @@ -774,6 +936,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "-inf" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "-Infinity", "pickle": { "0": "462d696e660a2e", @@ -802,6 +970,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "nan" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "NaN", "pickle": { "0": "466e616e0a2e", @@ -830,6 +1004,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json_error": "Object of type complex is not JSON serializable", "pickle": { "0": "635f5f6275696c74696e5f5f0a636f6d706c65780a70300a2846302e300a46312e300a7470310a5270320a2e", @@ -858,6 +1038,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json_error": "Object of type complex is not JSON serializable", "pickle": { "0": "635f5f6275696c74696e5f5f0a636f6d706c65780a70300a28462d302e300a462d312e300a7470310a5270320a2e", @@ -886,6 +1072,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json_error": "Object of type complex is not JSON serializable", "pickle": { "0": "635f5f6275696c74696e5f5f0a636f6d706c65780a70300a2846302e300a462d312e300a7470310a5270320a2e", @@ -914,6 +1106,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json_error": "Object of type complex is not JSON serializable", "pickle": { "0": "635f5f6275696c74696e5f5f0a636f6d706c65780a70300a2846312e300a46322e300a7470310a5270320a2e", @@ -942,6 +1140,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json_error": "Object of type complex is not JSON serializable", "pickle": { "0": "635f5f6275696c74696e5f5f0a636f6d706c65780a70300a28462d312e350a462d302e350a7470310a5270320a2e", @@ -970,6 +1174,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json_error": "Object of type complex is not JSON serializable", "pickle": { "0": "635f5f6275696c74696e5f5f0a636f6d706c65780a70300a2846302e300a4631652b31360a7470310a5270320a2e", @@ -998,6 +1208,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"\"", "pickle": { "0": "560a70300a2e", @@ -1026,6 +1242,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"plain\"", "pickle": { "0": "56706c61696e0a70300a2e", @@ -1054,6 +1276,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"it's\"", "pickle": { "0": "56697427730a70300a2e", @@ -1082,6 +1310,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"say \\\"hi\\\"\"", "pickle": { "0": "5673617920226869220a70300a2e", @@ -1110,6 +1344,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"both ' and \\\"\"", "pickle": { "0": "56626f7468202720616e6420220a70300a2e", @@ -1138,6 +1378,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"back\\\\slash\"", "pickle": { "0": "566261636b5c7530303563736c6173680a70300a2e", @@ -1166,6 +1412,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"\\t\\n\\r\"", "pickle": { "0": "56095c75303030615c75303030640a70300a2e", @@ -1194,6 +1446,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"\\u0000\\u001f\\u007f\"", "pickle": { "0": "565c75303030301f7f0a70300a2e", @@ -1222,6 +1480,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"\\u0085\\u00a0\\u00ad\"", "pickle": { "0": "5685a0ad0a70300a2e", @@ -1250,6 +1514,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"caf\\u00e9\"", "pickle": { "0": "56636166e90a70300a2e", @@ -1278,6 +1548,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"\\u65e5\\u672c\"", "pickle": { "0": "565c75363565355c75363732630a70300a2e", @@ -1306,6 +1582,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"\\u200b\\u2028\\u3000\"", "pickle": { "0": "565c75323030625c75323032385c75333030300a70300a2e", @@ -1334,6 +1616,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"\\ud83d\\ude00\"", "pickle": { "0": "565c5530303031663630300a70300a2e", @@ -1362,6 +1650,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"\\udb40\\udc01\\udbff\\udfff\"", "pickle": { "0": "565c5530303065303030315c5530303130666666660a70300a2e", @@ -1390,6 +1684,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"\\b\\f\"", "pickle": { "0": "56080c0a70300a2e", @@ -1418,6 +1718,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json_error": "Object of type bytes is not JSON serializable", "pickle": { "0": "635f5f6275696c74696e5f5f0a62797465730a70300a28745270310a2e", @@ -1446,6 +1752,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json_error": "Object of type bytes is not JSON serializable", "pickle": { "0": "635f636f646563730a656e636f64650a70300a28566162630a70310a566c6174696e310a70320a7470330a5270340a2e", @@ -1474,6 +1786,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json_error": "Object of type bytes is not JSON serializable", "pickle": { "0": "635f636f646563730a656e636f64650a70300a28566127620a70310a566c6174696e310a70320a7470330a5270340a2e", @@ -1502,6 +1820,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json_error": "Object of type bytes is not JSON serializable", "pickle": { "0": "635f636f646563730a656e636f64650a70300a285661226227630a70310a566c6174696e310a70320a7470330a5270340a2e", @@ -1530,6 +1854,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json_error": "Object of type bytes is not JSON serializable", "pickle": { "0": "635f636f646563730a656e636f64650a70300a28565c7530303030095c75303030615c75303030647f80ff0a70310a566c6174696e310a70320a7470330a5270340a2e", @@ -1558,6 +1888,12 @@ "lax_int": { "value": "12" }, + "lax_float": { + "value": "12.0" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\" 12 \"", "pickle": { "0": "56203132200a70300a2e", @@ -1586,6 +1922,12 @@ "lax_int": { "value": "5" }, + "lax_float": { + "value": "5.0" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"+5\"", "pickle": { "0": "562b350a70300a2e", @@ -1614,6 +1956,12 @@ "lax_int": { "value": "-4" }, + "lax_float": { + "value": "-4.0" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"-4\"", "pickle": { "0": "562d340a70300a2e", @@ -1642,6 +1990,12 @@ "lax_int": { "value": "7" }, + "lax_float": { + "value": "7.0" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"007\"", "pickle": { "0": "563030370a70300a2e", @@ -1670,6 +2024,12 @@ "lax_int": { "value": "1000" }, + "lax_float": { + "value": "1000.0" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"1_000\"", "pickle": { "0": "56315f3030300a70300a2e", @@ -1698,6 +2058,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"1__0\"", "pickle": { "0": "56315f5f300a70300a2e", @@ -1726,6 +2092,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"_1\"", "pickle": { "0": "565f310a70300a2e", @@ -1754,6 +2126,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"1_\"", "pickle": { "0": "56315f0a70300a2e", @@ -1782,6 +2160,12 @@ "lax_int": { "value": "3" }, + "lax_float": { + "value": "3.0" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"3.0\"", "pickle": { "0": "56332e300a70300a2e", @@ -1810,6 +2194,12 @@ "lax_int": { "value": "3" }, + "lax_float": { + "value": "3.0" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"3.00\"", "pickle": { "0": "56332e30300a70300a2e", @@ -1838,6 +2228,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "3.5" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"3.5\"", "pickle": { "0": "56332e350a70300a2e", @@ -1866,6 +2262,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "0.5" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\" 0.5 \"", "pickle": { "0": "5620302e35200a70300a2e", @@ -1877,6 +2279,176 @@ }, "view": "' 0.5 '" }, + { + "name": "'true'", + "source": "'true'", + "literal": true, + "plain": true, + "repr": "'true'", + "str": "true", + "truthy": true, + "int": { + "error": "ValueError" + }, + "float": { + "error": "ValueError" + }, + "lax_int": { + "error": "ValueError" + }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "value": "True" + }, + "json": "\"true\"", + "pickle": { + "0": "56747275650a70300a2e", + "1": "58040000007472756571002e", + "2": "800258040000007472756571002e", + "3": "800358040000007472756571002e", + "4": "80049508000000000000008c0474727565942e", + "5": "80059508000000000000008c0474727565942e" + }, + "view": "'true'" + }, + { + "name": "' Yes '", + "source": "' Yes '", + "literal": true, + "plain": true, + "repr": "' Yes '", + "str": " Yes ", + "truthy": true, + "int": { + "error": "ValueError" + }, + "float": { + "error": "ValueError" + }, + "lax_int": { + "error": "ValueError" + }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, + "json": "\" Yes \"", + "pickle": { + "0": "5620596573200a70300a2e", + "1": "5805000000205965732071002e", + "2": "80025805000000205965732071002e", + "3": "80035805000000205965732071002e", + "4": "80049509000000000000008c052059657320942e", + "5": "80059509000000000000008c052059657320942e" + }, + "view": "' Yes '" + }, + { + "name": "'off'", + "source": "'off'", + "literal": true, + "plain": true, + "repr": "'off'", + "str": "off", + "truthy": true, + "int": { + "error": "ValueError" + }, + "float": { + "error": "ValueError" + }, + "lax_int": { + "error": "ValueError" + }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "value": "False" + }, + "json": "\"off\"", + "pickle": { + "0": "566f66660a70300a2e", + "1": "58030000006f666671002e", + "2": "800258030000006f666671002e", + "3": "800358030000006f666671002e", + "4": "80049507000000000000008c036f6666942e", + "5": "80059507000000000000008c036f6666942e" + }, + "view": "'off'" + }, + { + "name": "'2'", + "source": "'2'", + "literal": true, + "plain": true, + "repr": "'2'", + "str": "2", + "truthy": true, + "int": { + "value": "2" + }, + "float": { + "value": "2.0" + }, + "lax_int": { + "value": "2" + }, + "lax_float": { + "value": "2.0" + }, + "lax_bool": { + "error": "ValueError" + }, + "json": "\"2\"", + "pickle": { + "0": "56320a70300a2e", + "1": "58010000003271002e", + "2": "800258010000003271002e", + "3": "800358010000003271002e", + "4": "80049505000000000000008c0132942e", + "5": "80059505000000000000008c0132942e" + }, + "view": "'2'" + }, + { + "name": "1", + "source": "1", + "literal": true, + "plain": true, + "repr": "1", + "str": "1", + "truthy": true, + "int": { + "value": "1" + }, + "float": { + "value": "1.0" + }, + "lax_int": { + "value": "1" + }, + "lax_float": { + "value": "1.0" + }, + "lax_bool": { + "value": "True" + }, + "json": "1", + "pickle": { + "0": "49310a2e", + "1": "4b012e", + "2": "80024b012e", + "3": "80034b012e", + "4": "80044b012e", + "5": "80054b012e" + }, + "view": "1" + }, { "name": "'.5'", "source": "'.5'", @@ -1894,6 +2466,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "0.5" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\".5\"", "pickle": { "0": "562e350a70300a2e", @@ -1922,6 +2500,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "5.0" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"5.\"", "pickle": { "0": "56352e0a70300a2e", @@ -1950,6 +2534,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "1000.0" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"1e3\"", "pickle": { "0": "563165330a70300a2e", @@ -1978,6 +2568,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "10.5" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"1_0.5\"", "pickle": { "0": "56315f302e350a70300a2e", @@ -2006,6 +2602,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "10000000000.0" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"1e1_0\"", "pickle": { "0": "563165315f300a70300a2e", @@ -2034,6 +2636,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "inf" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"inf\"", "pickle": { "0": "56696e660a70300a2e", @@ -2062,6 +2670,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "-inf" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"-Infinity\"", "pickle": { "0": "562d496e66696e6974790a70300a2e", @@ -2090,6 +2704,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "nan" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"nan\"", "pickle": { "0": "566e616e0a70300a2e", @@ -2118,6 +2738,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "nan" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"NaN\"", "pickle": { "0": "564e614e0a70300a2e", @@ -2146,6 +2772,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"0x10\"", "pickle": { "0": "56307831300a70300a2e", @@ -2174,6 +2806,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "\"abc\"", "pickle": { "0": "566162630a70300a2e", @@ -2202,6 +2840,12 @@ "lax_int": { "value": "12" }, + "lax_float": { + "value": "12.0" + }, + "lax_bool": { + "error": "ValueError" + }, "json_error": "Object of type bytes is not JSON serializable", "pickle": { "0": "635f636f646563730a656e636f64650a70300a285631320a70310a566c6174696e310a70320a7470330a5270340a2e", @@ -2230,6 +2874,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "1.5" + }, + "lax_bool": { + "error": "ValueError" + }, "json_error": "Object of type bytes is not JSON serializable", "pickle": { "0": "635f636f646563730a656e636f64650a70300a285620312e35200a70310a566c6174696e310a70320a7470330a5270340a2e", @@ -2258,6 +2908,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "3.9" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "3.9", "pickle": { "0": "46332e390a2e", @@ -2286,6 +2942,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "-3.9" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "-3.9", "pickle": { "0": "462d332e390a2e", @@ -2314,6 +2976,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "value": "2.5" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "2.5", "pickle": { "0": "46322e350a2e", @@ -2342,6 +3010,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "[]", "pickle": { "0": "286c70300a2e", @@ -2370,6 +3044,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "[1, \"a\", null, true]", "pickle": { "0": "286c70300a49310a6156610a70310a614e614930310a612e", @@ -2398,6 +3078,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "[]", "pickle": { "0": "28742e", @@ -2426,6 +3112,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "[1]", "pickle": { "0": "2849310a7470300a2e", @@ -2454,6 +3146,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "[1, [2, 3]]", "pickle": { "0": "2849310a2849320a49330a7470300a7470310a2e", @@ -2482,6 +3180,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "{}", "pickle": { "0": "286470300a2e", @@ -2510,6 +3214,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "{\"a\": 1, \"b\": [1.0, 2.5]}", "pickle": { "0": "286470300a56610a70310a49310a7356620a70320a286c70330a46312e300a6146322e350a61732e", @@ -2538,6 +3248,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "{\"z\": 1, \"a\": 2, \"m\": 3}", "pickle": { "0": "286470300a567a0a70310a49310a7356610a70320a49320a73566d0a70330a49330a732e", @@ -2566,6 +3282,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "{\"1\": \"bool\", \"2.5\": \"float\", \"null\": \"none\"}", "pickle": { "0": "286470300a49310a56626f6f6c0a70310a7346322e350a56666c6f61740a70320a734e566e6f6e650a70330a732e", @@ -2594,6 +3316,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json_error": "keys must be str, int, float, bool or None, not tuple", "pickle": { "0": "286470300a2849310a49320a7470310a567475706c65206b65790a70320a732e", @@ -2622,6 +3350,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "{\"nested\": {\"deeper\": {\"deepest\": [{}]}}}", "pickle": { "0": "286470300a566e65737465640a70310a286470320a566465657065720a70330a286470340a56646565706573740a70350a286c70360a286470370a617373732e", @@ -2650,6 +3384,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json_error": "Object of type set is not JSON serializable", "pickle": { "0": "635f5f6275696c74696e5f5f0a7365740a70300a28286c70310a49310a617470320a5270330a2e", @@ -2678,6 +3418,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json_error": "Object of type set is not JSON serializable", "pickle": { "0": "635f5f6275696c74696e5f5f0a7365740a70300a28286c70310a7470320a5270330a2e", @@ -2706,6 +3452,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json_error": "Object of type frozenset is not JSON serializable", "pickle": { "0": "635f5f6275696c74696e5f5f0a66726f7a656e7365740a70300a28286c70310a49310a617470320a5270330a2e", @@ -2734,6 +3486,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "[[[[[[[[[[1]]]]]]]]]]", "pickle": { "0": "286c70300a286c70310a286c70320a286c70330a286c70340a286c70350a286c70360a286c70370a286c70380a286c70390a49310a616161616161616161612e", @@ -2762,6 +3520,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[1]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]", "pickle": { "0": "286c70300a286c70310a286c70320a286c70330a286c70340a286c70350a286c70360a286c70370a286c70380a286c70390a286c7031300a286c7031310a286c7031320a286c7031330a286c7031340a286c7031350a286c7031360a286c7031370a286c7031380a286c7031390a286c7032300a286c7032310a286c7032320a286c7032330a286c7032340a286c7032350a286c7032360a286c7032370a286c7032380a286c7032390a286c7033300a286c7033310a286c7033320a286c7033330a286c7033340a286c7033350a286c7033360a286c7033370a286c7033380a286c7033390a286c7034300a286c7034310a286c7034320a286c7034330a286c7034340a286c7034350a286c7034360a286c7034370a286c7034380a286c7034390a286c7035300a286c7035310a286c7035320a286c7035330a286c7035340a286c7035350a286c7035360a286c7035370a286c7035380a286c7035390a286c7036300a286c7036310a286c7036320a286c7036330a286c7036340a286c7036350a286c7036360a286c7036370a286c7036380a286c7036390a286c7037300a286c7037310a286c7037320a286c7037330a286c7037340a286c7037350a286c7037360a286c7037370a286c7037380a286c7037390a286c7038300a286c7038310a286c7038320a286c7038330a286c7038340a286c7038350a286c7038360a286c7038370a286c7038380a286c7038390a286c7039300a286c7039310a286c7039320a286c7039330a286c7039340a286c7039350a286c7039360a286c7039370a286c7039380a286c7039390a286c703130300a286c703130310a286c703130320a286c703130330a286c703130340a286c703130350a286c703130360a286c703130370a286c703130380a286c703130390a286c703131300a286c703131310a286c703131320a286c703131330a286c703131340a286c703131350a286c703131360a286c703131370a286c703131380a286c703131390a286c703132300a286c703132310a286c703132320a286c703132330a286c703132340a286c703132350a286c703132360a286c703132370a286c703132380a286c703132390a286c703133300a286c703133310a286c703133320a286c703133330a286c703133340a286c703133350a286c703133360a286c703133370a286c703133380a286c703133390a286c703134300a286c703134310a286c703134320a286c703134330a286c703134340a286c703134350a286c703134360a286c703134370a286c703134380a286c703134390a49310a6161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161612e", @@ -2790,6 +3554,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "{\"timestamp\": 1726000000.123, \"response\": \"{\\\"id\\\": \\\"chatcmpl-1\\\", \\\"object\\\": \\\"chat.completion\\\"}\"}", "pickle": { "0": "286470300a5674696d657374616d700a70310a46313732363030303030302e3132330a7356726573706f6e73650a70320a567b226964223a202263686174636d706c2d31222c20226f626a656374223a2022636861742e636f6d706c6574696f6e227d0a70330a732e", @@ -2818,6 +3588,12 @@ "lax_int": { "error": "ValueError" }, + "lax_float": { + "error": "ValueError" + }, + "lax_bool": { + "error": "ValueError" + }, "json": "{\"model\": \"gpt-4o\", \"messages\": [{\"role\": \"user\", \"content\": \"hi\"}], \"temperature\": 0.2, \"stream\": false}", "pickle": { "0": "286470300a566d6f64656c0a70310a566770742d346f0a70320a73566d657373616765730a70330a286c70340a286470350a56726f6c650a70360a56757365720a70370a7356636f6e74656e740a70380a5668690a70390a7361735674656d70657261747572650a7031300a46302e320a735673747265616d0a7031310a4930300a732e", diff --git a/litellm-rust/crates/python-compat/scripts/generate_fixtures.py b/litellm-rust/crates/python-compat/scripts/generate_fixtures.py index 32b198eef8d..108e5da7134 100644 --- a/litellm-rust/crates/python-compat/scripts/generate_fixtures.py +++ b/litellm-rust/crates/python-compat/scripts/generate_fixtures.py @@ -3,7 +3,7 @@ python scripts/generate_fixtures.py > generated/values.json Each row records `repr`, `str`, `json.dumps` (or its error), `bool`, `int`, `float`, pydantic's -lax `int` validation, and `pickle.dumps` at every protocol. Conversions record the result's +lax `int`, `float`, and `bool` validation, and `pickle.dumps` at every protocol. Conversions record the result's `repr` or the exception class raised. Run it with the repository environment, which has pydantic. `literal` says whether `ast.literal_eval(repr(value))` gives the value back, which is how Python reads `str(dict)` text back from a cache; the Rust tests reach the other rows only through pickle. `view` is `repr` of the value as `pickle::loads` decodes it, with @@ -20,6 +20,8 @@ import warnings from pydantic import TypeAdapter, ValidationError LAX_INT = TypeAdapter(int) +LAX_FLOAT = TypeAdapter(float) +LAX_BOOL = TypeAdapter(bool) # Entries are source texts, or `(name, source)` when the source is too long to read in a # test report. `name` is what the Rust `KNOWN` table keys on. @@ -97,6 +99,11 @@ CORPUS = [ "'3.00'", "'3.5'", "' 0.5 '", + "'true'", + "' Yes '", + "'off'", + "'2'", + "1", "'.5'", "'5.'", "'1e3'", @@ -369,6 +376,8 @@ def row(entry): "int": converted(int, value), "float": converted(float, value), "lax_int": converted(LAX_INT.validate_python, value), + "lax_float": converted(LAX_FLOAT.validate_python, value), + "lax_bool": converted(LAX_BOOL.validate_python, value), } try: entry["json"] = json.dumps(value) diff --git a/litellm-rust/crates/python-compat/src/pydantic.rs b/litellm-rust/crates/python-compat/src/pydantic.rs index fe3c37c1042..51d5272d3c7 100644 --- a/litellm-rust/crates/python-compat/src/pydantic.rs +++ b/litellm-rust/crates/python-compat/src/pydantic.rs @@ -1,10 +1,10 @@ -//! pydantic's lax-mode validation, which LiteLLM's usage and response models apply to the +//! pydantic's lax-mode validation of `int`, `float`, and `bool`, which LiteLLM's usage and response models apply to the //! numbers providers send. use num_bigint::BigInt; use num_traits::Zero; -use crate::number::{int_from_float, parse_int_literal}; +use crate::number::{self, int_from_float, parse_int_literal}; use crate::{Error, PythonException, Value}; /// pydantic-core converts floats through `i64`, so larger magnitudes fail validation. @@ -52,3 +52,34 @@ pub fn lax_int(value: &Value) -> Result { _ => Err(invalid("Input should be a valid integer")), } } + +/// `TypeAdapter(float).validate_python(value)` in lax mode. +pub fn lax_float(value: &Value) -> Result { + match value { + Value::Bool(_) | Value::Int(_) | Value::Float(_) => number::float(value), + Value::Str(text) => number::float(&Value::Str(text.trim().to_owned())).map_err(|_| { + invalid("Input should be a valid number, unable to parse string as a number") + }), + Value::Bytes(bytes) => lax_float(&Value::Str(String::from_utf8_lossy(bytes).into_owned())), + _ => Err(invalid("Input should be a valid number")), + } +} + +/// `TypeAdapter(bool).validate_python(value)` in lax mode. +pub fn lax_bool(value: &Value) -> Result { + let unparsable = || invalid("Input should be a valid boolean, unable to interpret input"); + match value { + Value::Bool(flag) => Ok(*flag), + Value::Int(number) if number.is_zero() => Ok(false), + Value::Int(number) if *number == BigInt::from(1) => Ok(true), + Value::Float(number) if *number == 0.0 => Ok(false), + Value::Float(number) if *number == 1.0 => Ok(true), + Value::Str(text) => match text.to_ascii_lowercase().as_str() { + "0" | "off" | "f" | "false" | "n" | "no" => Ok(false), + "1" | "on" | "t" | "true" | "y" | "yes" => Ok(true), + _ => Err(unparsable()), + }, + Value::Bytes(bytes) => lax_bool(&Value::Str(String::from_utf8_lossy(bytes).into_owned())), + _ => Err(unparsable()), + } +} diff --git a/litellm-rust/crates/python-compat/tests/fixtures.rs b/litellm-rust/crates/python-compat/tests/fixtures.rs index cfdfca4dcd4..ff79dcc2f61 100644 --- a/litellm-rust/crates/python-compat/tests/fixtures.rs +++ b/litellm-rust/crates/python-compat/tests/fixtures.rs @@ -64,6 +64,8 @@ struct Row { int: Conversion, float: Conversion, lax_int: Conversion, + lax_float: Conversion, + lax_bool: Conversion, json: Option, json_error: Option, pickle: Option>, @@ -236,6 +238,20 @@ fn check_value(mismatches: &mut Mismatches, row: &Row, value: &Value) { &row.lax_int.expected(), &outcome(pydantic::lax_int(value), |int| int.to_string()), ); + mismatches.check( + row, + "pydantic lax float", + &row.lax_float.expected(), + &outcome(pydantic::lax_float(value), float_repr), + ); + mismatches.check( + row, + "pydantic lax bool", + &row.lax_bool.expected(), + &outcome(pydantic::lax_bool(value), |flag| { + if flag { "True" } else { "False" }.to_owned() + }), + ); let expected = row.json.clone().or_else(|| { row.json_error .clone()