@@ -81,9 +81,10 @@ object JsonFormats {
8181
8282 implicit lazy val contentReads : Reads [Content ] = Reads [Content ] { (json : JsValue ) =>
8383 (json \ " type" ).validate[String ].flatMap {
84- case " text" => (json \ " text" ).validate[String ].map(TextContent )
85- case " image_url" => (json \ " image_url" \ " url" ).validate[String ].map(ImageURLContent )
86- case _ => JsError (" Invalid type" )
84+ case " text" => (json \ " text" ).validate[String ].map(TextContent .apply)
85+ case " image_url" =>
86+ (json \ " image_url" \ " url" ).validate[String ].map(ImageURLContent .apply)
87+ case _ => JsError (" Invalid type" )
8788 }
8889 }
8990
@@ -504,7 +505,9 @@ object JsonFormats {
504505
505506 implicit lazy val assistantToolResourceReads : Reads [AssistantToolResource ] = Reads { json =>
506507 (json \ " code_interpreter" ).toOption.map { codeInterpreterJson =>
507- (codeInterpreterJson \ " file_ids" ).validate[Seq [FileId ]].map(CodeInterpreterResources )
508+ (codeInterpreterJson \ " file_ids" )
509+ .validate[Seq [FileId ]]
510+ .map(CodeInterpreterResources .apply)
508511 }.orElse(
509512 (json \ " file_search" ).toOption.map { fileSearchJson =>
510513 val fileSearchVectorStoreIds = (fileSearchJson \ " vector_store_ids" ).asOpt[Seq [String ]]
@@ -784,10 +787,9 @@ object JsonFormats {
784787 Format (reads, writes)
785788 }
786789
787- implicit lazy val runReasonFormat : Format [Run .Reason ] = {
788- implicit lazy val stringStringMapFormat : Format [Map [String , String ]] =
789- JsonUtil .StringStringMapFormat
790- Json .format[Run .Reason ]
790+ implicit lazy val runReasonFormat : Format [Run .Reason ] = new Format [Run .Reason ] {
791+ def reads (json : JsValue ): JsResult [Run .Reason ] = json.validate[String ].map(Run .Reason )
792+ def writes (o : Run .Reason ): JsValue = JsString (o.value)
791793 }
792794
793795 implicit lazy val lastRunErrorCodeFormat : Format [Run .LastErrorCode ] = {
0 commit comments