Skip to content

Consider an AIContent type for content that must be roundtripped #7184

@stephentoub

Description

@stephentoub

In cases where middleware needs to create content that will be sent back to the consumer which must then include that content in a subsequent request, we should consider introducing some IncludeContent type like:

class IncludeContent : UserInputRequestContent
{
    public IList<AIContent>? Content { get; set; } 
}

This could be used, for example, by FunctionInvokingChatClient to work around:

/// <para>
/// Due to the nature of interactions with an underlying <see cref="IChatClient"/>, if any <see cref="FunctionCallContent"/> is received
/// for a function that requires approval, all received <see cref="FunctionCallContent"/> in that same response will also require approval,
/// even if they were not <see cref="ApprovalRequiredAIFunction"/> instances. If this is a concern, consider requesting that multiple tool call
/// requests not be made in a single response, by setting <see cref="ChatOptions.AllowMultipleToolCalls"/> to <see langword="false"/>.
/// </para>

cc: @westey-m, @jozkee

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-aiMicrosoft.Extensions.AI librariesuntriaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions