AgentRunResponseExtensions.AsChatResponse(AgentRunResponse) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Creates a ChatResponse from an AgentRunResponse instance.
public static Microsoft.Extensions.AI.ChatResponse AsChatResponse(this Microsoft.Agents.AI.AgentRunResponse response);
static member AsChatResponse : Microsoft.Agents.AI.AgentRunResponse -> Microsoft.Extensions.AI.ChatResponse
<Extension()>
Public Function AsChatResponse (response As AgentRunResponse) As ChatResponse
Parameters
- response
- AgentRunResponse
The AgentRunResponse to convert.
Returns
A ChatResponse built from the specified response.
Exceptions
response is null.
Remarks
If the response's RawRepresentation is already a ChatResponse instance, that instance is returned directly. Otherwise, a new ChatResponse is created and populated with the data from the response. The resulting instance is a shallow copy; any reference-type members (e.g. Messages) will be shared between the two instances.