ChatMessageExtensions.WithAgentRequestMessageSource 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.
Ensure that the provided message is tagged with the provided source type and source id in the context of a specific agent run.
public static Microsoft.Extensions.AI.ChatMessage WithAgentRequestMessageSource(this Microsoft.Extensions.AI.ChatMessage message, Microsoft.Agents.AI.AgentRequestMessageSourceType sourceType, string? sourceId = default);
static member WithAgentRequestMessageSource : Microsoft.Extensions.AI.ChatMessage * Microsoft.Agents.AI.AgentRequestMessageSourceType * string -> Microsoft.Extensions.AI.ChatMessage
<Extension()>
Public Function WithAgentRequestMessageSource (message As ChatMessage, sourceType As AgentRequestMessageSourceType, Optional sourceId As String = Nothing) As ChatMessage
Parameters
- message
- ChatMessage
The message to tag.
- sourceType
- AgentRequestMessageSourceType
The source type to tag the message with.
- sourceId
- String
The source id to tag the message with.
Returns
The tagged message.
Remarks
If the message is already tagged with the provided source type and source id, it is returned as is. Otherwise, a cloned message is returned with the appropriate tagging in the AdditionalProperties.