Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public interface IChatClient : IDisposable
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
/// <returns>The response messages generated by the client.</returns>
/// <exception cref="ArgumentNullException"><paramref name="messages"/> is <see langword="null"/>.</exception>
/// <remarks>
/// Applications must consider the risks of prompt injection attacks, data sizes, and the number of messages
/// sent to the underlying provider or returned from it. Unless a specific <see cref="IChatClient"/> implementation
/// explicitly documents safeguards for these concerns, the application is expected to implement appropriate protections.
/// </remarks>
/// <related type="Article" href="https://learn.microsoft.com/dotnet/ai/microsoft-extensions-ai#request-a-chat-response">Request a chat response.</related>
Task<ChatResponse> GetResponseAsync(
IEnumerable<ChatMessage> messages,
Expand All @@ -45,6 +50,11 @@ Task<ChatResponse> GetResponseAsync(
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
/// <returns>The response messages generated by the client.</returns>
/// <exception cref="ArgumentNullException"><paramref name="messages"/> is <see langword="null"/>.</exception>
/// <remarks>
/// Applications must consider the risks of prompt injection attacks, data sizes, and the number of messages
/// sent to the underlying provider or returned from it. Unless a specific <see cref="IChatClient"/> implementation
/// explicitly documents safeguards for these concerns, the application is expected to implement appropriate protections.
/// </remarks>
/// <related type="Article" href="https://learn.microsoft.com/dotnet/ai/microsoft-extensions-ai#request-a-streaming-chat-response">Request a streaming chat response.</related>
IAsyncEnumerable<ChatResponseUpdate> GetStreamingResponseAsync(
IEnumerable<ChatMessage> messages,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ public AzureAIInferenceChatClient(ChatCompletionsClient chatCompletionsClient, s
}

/// <inheritdoc />
/// <remarks>
/// <para>
/// No prompt injection defense is performed by default for data within <paramref name="messages"/>.
/// Applications are expected to implement guards against prompt injection attacks as needed.
/// </para>
/// <para>
/// There are no limits or restrictions imposed on data sizes sent to the underlying provider or returned from it
/// by default. Applications are expected to apply data size limits as needed.
/// </para>
/// <para>
/// There are no limits or restrictions imposed on the number of messages sent to the underlying provider or returned from
/// it by default. Applications are expected to apply rate limits on a per-user or per-session basis as needed.
/// </para>
/// </remarks>
public async Task<ChatResponse> GetResponseAsync(
IEnumerable<ChatMessage> messages, ChatOptions? options = null, CancellationToken cancellationToken = default)
{
Expand Down Expand Up @@ -128,6 +142,20 @@ public async Task<ChatResponse> GetResponseAsync(
}

/// <inheritdoc />
/// <remarks>
/// <para>
/// No prompt injection defense is performed by default for data within <paramref name="messages"/>.
/// Applications are expected to implement guards against prompt injection attacks as needed.
/// </para>
/// <para>
/// There are no limits or restrictions imposed on data sizes sent to the underlying provider or returned from it
/// by default. Applications are expected to apply data size limits as needed.
/// </para>
/// <para>
/// There are no limits or restrictions imposed on the number of messages sent to the underlying provider or returned from
/// it by default. Applications are expected to apply rate limits on a per-user or per-session basis as needed.
/// </para>
/// </remarks>
public async IAsyncEnumerable<ChatResponseUpdate> GetStreamingResponseAsync(
IEnumerable<ChatMessage> messages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default)
{
Expand Down
28 changes: 28 additions & 0 deletions src/Libraries/Microsoft.Extensions.AI.Ollama/OllamaChatClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,20 @@ public JsonSerializerOptions ToolCallJsonSerializerOptions
}

/// <inheritdoc />
/// <remarks>
/// <para>
/// No prompt injection defense is performed by default for data within <paramref name="messages"/>.
/// Applications are expected to implement guards against prompt injection attacks as needed.
/// </para>
/// <para>
/// There are no limits or restrictions imposed on data sizes sent to the underlying provider or returned from it
/// by default. Applications are expected to apply data size limits as needed.
/// </para>
/// <para>
/// There are no limits or restrictions imposed on the number of messages sent to the underlying provider or returned from
/// it by default. Applications are expected to apply rate limits on a per-user or per-session basis as needed.
/// </para>
/// </remarks>
public async Task<ChatResponse> GetResponseAsync(
IEnumerable<ChatMessage> messages, ChatOptions? options = null, CancellationToken cancellationToken = default)
{
Expand Down Expand Up @@ -118,6 +132,20 @@ public async Task<ChatResponse> GetResponseAsync(
}

/// <inheritdoc />
/// <remarks>
/// <para>
/// No prompt injection defense is performed by default for data within <paramref name="messages"/>.
/// Applications are expected to implement guards against prompt injection attacks as needed.
/// </para>
/// <para>
/// There are no limits or restrictions imposed on data sizes sent to the underlying provider or returned from it
/// by default. Applications are expected to apply data size limits as needed.
/// </para>
/// <para>
/// There are no limits or restrictions imposed on the number of messages sent to the underlying provider or returned from
/// it by default. Applications are expected to apply rate limits on a per-user or per-session basis as needed.
/// </para>
/// </remarks>
public async IAsyncEnumerable<ChatResponseUpdate> GetStreamingResponseAsync(
IEnumerable<ChatMessage> messages, ChatOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default)
{
Expand Down
28 changes: 28 additions & 0 deletions src/Libraries/Microsoft.Extensions.AI.OpenAI/OpenAIChatClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ public OpenAIChatClient(ChatClient chatClient)
}

/// <inheritdoc />
/// <remarks>
/// <para>
/// No prompt injection defense is performed by default for data within <paramref name="messages"/>.
/// Applications are expected to implement guards against prompt injection attacks as needed.
/// </para>
/// <para>
/// There are no limits or restrictions imposed on data sizes sent to the underlying provider or returned from it
/// by default. Applications are expected to apply data size limits as needed.
/// </para>
/// <para>
/// There are no limits or restrictions imposed on the number of messages sent to the underlying provider or returned from
/// it by default. Applications are expected to apply rate limits on a per-user or per-session basis as needed.
/// </para>
/// </remarks>
public async Task<ChatResponse> GetResponseAsync(
IEnumerable<ChatMessage> messages, ChatOptions? options = null, CancellationToken cancellationToken = default)
{
Expand All @@ -83,6 +97,20 @@ public async Task<ChatResponse> GetResponseAsync(
}

/// <inheritdoc />
/// <remarks>
/// <para>
/// No prompt injection defense is performed by default for data within <paramref name="messages"/>.
/// Applications are expected to implement guards against prompt injection attacks as needed.
/// </para>
/// <para>
/// There are no limits or restrictions imposed on data sizes sent to the underlying provider or returned from it
/// by default. Applications are expected to apply data size limits as needed.
/// </para>
/// <para>
/// There are no limits or restrictions imposed on the number of messages sent to the underlying provider or returned from
/// it by default. Applications are expected to apply rate limits on a per-user or per-session basis as needed.
/// </para>
/// </remarks>
public IAsyncEnumerable<ChatResponseUpdate> GetStreamingResponseAsync(
IEnumerable<ChatMessage> messages, ChatOptions? options = null, CancellationToken cancellationToken = default)
{
Expand Down
Loading