Share via


FunctionInvokingChatClient.MaximumConsecutiveErrorsPerRequest Property

Definition

Gets or sets the maximum number of consecutive iterations that are allowed to fail with an error.

public:
 property int MaximumConsecutiveErrorsPerRequest { int get(); void set(int value); };
public int MaximumConsecutiveErrorsPerRequest { get; set; }
member this.MaximumConsecutiveErrorsPerRequest : int with get, set
Public Property MaximumConsecutiveErrorsPerRequest As Integer

Property Value

The maximum number of consecutive iterations that are allowed to fail with an error. The default value is 3.

Remarks

When function invocations fail with an exception, the FunctionInvokingChatClient continues to make requests to the inner client, optionally supplying exception information (as controlled by IncludeDetailedErrors). This allows the IChatClient to recover from errors by trying other function parameters that may succeed.

However, in case function invocations continue to produce exceptions, this property can be used to limit the number of consecutive failing attempts. When the limit is reached, the exception will be rethrown to the caller.

If the value is set to zero, all function calling exceptions immediately terminate the function invocation loop and the exception will be rethrown to the caller.

Changing the value of this property while the client is in use might result in inconsistencies as to how many iterations are allowed for an in-flight request.

Applies to