Поделиться через


FunctionInvokingChatClient.KeepFunctionCallingMessages Property

Definition

Gets or sets a value indicating whether to keep intermediate function calling request and response messages in the chat history.

public:
 property bool KeepFunctionCallingMessages { bool get(); void set(bool value); };
public bool KeepFunctionCallingMessages { get; set; }
member this.KeepFunctionCallingMessages : bool with get, set
Public Property KeepFunctionCallingMessages As Boolean

Property Value

true if intermediate messages persist in the IList<T> list provided to GetResponseAsync(IList<ChatMessage>, ChatOptions, CancellationToken) and GetStreamingResponseAsync(IList<ChatMessage>, ChatOptions, CancellationToken) by the caller. false if intermediate messages are removed prior to completing the operation. The default value is true.

Remarks

When the inner IChatClient returns FunctionCallContent to the FunctionInvokingChatClient, the FunctionInvokingChatClient adds those messages to the list of messages, along with FunctionResultContent instances it creates with the results of invoking the requested functions. The resulting augmented list of messages is then passed to the inner client in order to send the results back. By default, those messages persist in the IList<T> list provided to GetResponseAsync(IList<ChatMessage>, ChatOptions, CancellationToken) and GetStreamingResponseAsync(IList<ChatMessage>, ChatOptions, CancellationToken) by the caller, such that those messages are available to the caller. Set KeepFunctionCallingMessages to avoid including those messages in the caller-provided IList<T>.

Changing the value of this property while the client is in use might result in inconsistencies as to whether function calling messages are kept during an in-flight request.

If the underlying IChatClient responds with ChatThreadId set to a non-null value, this property may be ignored and behave as if it is false, with any such intermediate messages not stored in the messages list.

Applies to