@@ -244,11 +244,19 @@ public string ApplicationName
244244 /// </summary>
245245 /// <remarks>
246246 /// This setting is only applicable in Gateway mode.
247- /// The SDK sets EnableMultipleHttp2Connections = true on the underlying SocketsHttpHandler,
248- /// allowing additional HTTP/2 TCP connections to be opened when the maximum concurrent streams
249- /// limit on an existing connection is reached. This property controls the upper bound on the
250- /// total number of connections per server endpoint.
251- /// When using a custom <see cref="HttpClientFactory"/>, set EnableMultipleHttp2Connections
247+ /// The SDK sets the following on the underlying SocketsHttpHandler:
248+ /// <list type="bullet">
249+ /// <item><description>EnableMultipleHttp2Connections = true — allows additional HTTP/2 TCP connections
250+ /// to be opened when the maximum concurrent streams limit on an existing connection is reached.</description></item>
251+ /// <item><description>KeepAlivePingDelay = 1 second — sends HTTP/2 PING frames after 1 second
252+ /// of inactivity to detect broken connections in the pool.</description></item>
253+ /// <item><description>KeepAlivePingTimeout = 2 seconds — marks a connection as dead if no PONG
254+ /// response is received within 2 seconds.</description></item>
255+ /// <item><description>KeepAlivePingPolicy = Always — sends pings even for idle connections, which
256+ /// is critical for detecting broken connections that remain in the pool.</description></item>
257+ /// </list>
258+ /// This property controls the upper bound on the total number of connections per server endpoint.
259+ /// When using a custom <see cref="HttpClientFactory"/>, configure these properties
252260 /// directly on your SocketsHttpHandler for equivalent behavior.
253261 /// </remarks>
254262 /// <example>
@@ -268,7 +276,10 @@ public string ApplicationName
268276 /// SocketsHttpHandler handler = new SocketsHttpHandler
269277 /// {
270278 /// MaxConnectionsPerServer = 100,
271- /// EnableMultipleHttp2Connections = true
279+ /// EnableMultipleHttp2Connections = true,
280+ /// KeepAlivePingDelay = TimeSpan.FromSeconds(1),
281+ /// KeepAlivePingTimeout = TimeSpan.FromSeconds(2),
282+ /// KeepAlivePingPolicy = HttpKeepAlivePingPolicy.Always
272283 /// };
273284 /// CosmosClientOptions options = new CosmosClientOptions()
274285 /// {
@@ -306,6 +317,24 @@ public int GatewayModeMaxConnectionLimit
306317 /// <seealso cref="CosmosClientBuilder.WithRequestTimeout(TimeSpan)"/>
307318 public TimeSpan RequestTimeout { get ; set ; }
308319
320+ /// <summary>
321+ /// Gets or sets the request timeout for inference service operations (e.g., semantic reranking).
322+ /// The number specifies the time to wait for a response from the inference service before the request is cancelled.
323+ /// This is a single-attempt timeout with no retries.
324+ /// </summary>
325+ /// <value>Default value is 5 seconds.</value>
326+ /// <remarks>
327+ /// This timeout is specific to inference service operations and is separate from the standard <see cref="RequestTimeout"/>.
328+ /// If the request does not complete within the specified duration, a <see cref="CosmosException"/> with status 408 (Request Timeout) is thrown.
329+ /// No retries are attempted on timeout.
330+ /// </remarks>
331+ #if PREVIEW
332+ public
333+ #else
334+ internal
335+ #endif
336+ TimeSpan InferenceRequestTimeout { get ; set ; } = InferenceService . DefaultInferenceRequestTimeout ;
337+
309338 /// <summary>
310339 /// The SDK does a background refresh based on the time interval set to refresh the token credentials.
311340 /// This avoids latency issues because the old token is used until the new token is retrieved.
@@ -474,6 +503,7 @@ public ConnectionMode ConnectionMode
474503 /// ]]>
475504 /// </code>
476505 /// </example>
506+ [ JsonConverter ( typeof ( ClientOptionJsonConverter ) ) ]
477507 public System . Text . Json . JsonSerializerOptions UseSystemTextJsonSerializerWithOptions
478508 {
479509 get => this . stjSerializerOptions ;
@@ -1372,14 +1402,19 @@ public override void WriteJson(JsonWriter writer, object value, JsonSerializer s
13721402 return ;
13731403 }
13741404
1375- CosmosJsonSerializerWrapper cosmosJsonSerializerWrapper = value as CosmosJsonSerializerWrapper ;
1376- if ( value is CosmosJsonSerializerWrapper )
1405+ if ( value is System . Text . Json . JsonSerializerOptions )
1406+ {
1407+ writer . WriteValue ( value . GetType ( ) . ToString ( ) ) ;
1408+ return ;
1409+ }
1410+
1411+ if ( value is CosmosJsonSerializerWrapper cosmosJsonSerializerWrapper )
13771412 {
13781413 writer . WriteValue ( cosmosJsonSerializerWrapper . InternalJsonSerializer . GetType ( ) . ToString ( ) ) ;
1414+ return ;
13791415 }
13801416
1381- CosmosSerializer cosmosSerializer = value as CosmosSerializer ;
1382- if ( cosmosSerializer is CosmosSerializer )
1417+ if ( value is CosmosSerializer cosmosSerializer )
13831418 {
13841419 writer . WriteValue ( cosmosSerializer . GetType ( ) . ToString ( ) ) ;
13851420 }
0 commit comments