Edit

Share via


MicrosoftExtensionsAIResponsesExtensions.Add Method

Definition

Adds the ResponseTool to the list of AITools.

public:
[System::Runtime::CompilerServices::Extension]
 static void Add(System::Collections::Generic::IList<Microsoft::Extensions::AI::AITool ^> ^ tools, OpenAI::Responses::ResponseTool ^ tool);
public static void Add(this System.Collections.Generic.IList<Microsoft.Extensions.AI.AITool> tools, OpenAI.Responses.ResponseTool tool);
static member Add : System.Collections.Generic.IList<Microsoft.Extensions.AI.AITool> * OpenAI.Responses.ResponseTool -> unit
<Extension()>
Public Sub Add (tools As IList(Of AITool), tool As ResponseTool)

Parameters

tools
IList<AITool>

The list of AITools to which the provided tool should be added.

tool
ResponseTool

The ResponseTool to add.

Remarks

ResponseTool does not derive from AITool, so it cannot be added directly to a list of AITools. Instead, this method wraps the provided ResponseTool in an AITool and adds that to the list. The IChatClient returned by AsIChatClient(OpenAIResponseClient) will be able to unwrap the ResponseTool when it processes the list of tools and use the provided tool as-is.

Applies to