@@ -504,7 +504,7 @@ private static string PreparePayload(JObject sourceObject, ChatRequest context,
504504 return sourceObject . ToString ( settings ? . Formatting ?? Formatting . None ) ;
505505 }
506506
507- private static readonly Dictionary < LLmProviders , Func < ChatRequest , IEndpointProvider , CapabilityEndpoints , JsonSerializerSettings ? , string > > SerializeMap = new Dictionary < LLmProviders , Func < ChatRequest , IEndpointProvider , CapabilityEndpoints , JsonSerializerSettings ? , string > > ( ( int ) LLmProviders . Length )
507+ private static readonly Dictionary < LLmProviders , Func < ChatRequest , IEndpointProvider , CapabilityEndpoints , JsonSerializerSettings ? , string > > serializeMap = new Dictionary < LLmProviders , Func < ChatRequest , IEndpointProvider , CapabilityEndpoints , JsonSerializerSettings ? , string > > ( ( int ) LLmProviders . Length )
508508 {
509509 {
510510 LLmProviders . OpenAi , ( x , y , z , a ) =>
@@ -530,7 +530,14 @@ private static string PreparePayload(JObject sourceObject, ChatRequest context,
530530 } ,
531531 { LLmProviders . DeepSeek , ( x , y , z , a ) => PreparePayload ( x , x , y , z , GetSerializer ( EndpointBase . NullSettings , a ) ) } ,
532532 { LLmProviders . Anthropic , ( x , y , z , a ) => PreparePayload ( new VendorAnthropicChatRequest ( x , y ) , x , y , z , GetSerializer ( EndpointBase . NullSettings , a ) ) } ,
533- { LLmProviders . Cohere , ( x , y , z , a ) => PreparePayload ( new VendorCohereChatRequest ( x , y ) , x , y , z , GetSerializer ( EndpointBase . NullSettings , a ) ) } ,
533+ {
534+ LLmProviders . Cohere , ( x , y , z , a ) =>
535+ {
536+ VendorCohereChatRequest request = new VendorCohereChatRequest ( x , y ) ;
537+ JsonSerializerSettings serializer = GetSerializer ( EndpointBase . NullSettings , a ) ;
538+ return PreparePayload ( request . Serialize ( serializer ) , x , y , z , serializer ) ;
539+ }
540+ } ,
534541 { LLmProviders . Google , ( x , y , z , a ) => PreparePayload ( new VendorGoogleChatRequest ( x , y ) , x , y , z , GetSerializer ( EndpointBase . NullSettings , a ) ) } ,
535542 {
536543 LLmProviders . Mistral , ( x , y , z , a ) =>
@@ -730,7 +737,7 @@ private TornadoRequestContent Serialize(IEndpointProvider provider, CapabilityEn
730737 outboundCopy . ReasoningFormat = null ;
731738 }
732739
733- TornadoRequestContent serialized = SerializeMap . TryGetValue ( provider . Provider , out Func < ChatRequest , IEndpointProvider , CapabilityEndpoints , JsonSerializerSettings ? , string > ? serializerFn ) ? new TornadoRequestContent ( serializerFn . Invoke ( outboundCopy , provider , capabilityEndpoint , pretty ? new JsonSerializerSettings
740+ TornadoRequestContent serialized = serializeMap . TryGetValue ( provider . Provider , out Func < ChatRequest , IEndpointProvider , CapabilityEndpoints , JsonSerializerSettings ? , string > ? serializerFn ) ? new TornadoRequestContent ( serializerFn . Invoke ( outboundCopy , provider , capabilityEndpoint , pretty ? new JsonSerializerSettings
734741 {
735742 Formatting = Formatting . Indented
736743 } : null ) , outboundCopy . Model , outboundCopy . UrlOverride , provider , capabilityEndpoint ) : new TornadoRequestContent ( string . Empty , outboundCopy . Model , outboundCopy . UrlOverride , provider , CapabilityEndpoints . Chat ) ;
0 commit comments