Skip to content

Commit

Permalink
feat: added StreamChat call to IOllamaClient interface
Browse files Browse the repository at this point in the history
  • Loading branch information
JerrettDavis committed Jun 4, 2024
1 parent b0016ad commit 879ef80
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/IOllamaApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ public interface IOllamaApiClient
/// <returns>List of the returned messages including the previous context</returns>
Task<IEnumerable<Message>> SendChat(ChatRequest chatRequest, IResponseStreamer<ChatResponseStream> streamer, CancellationToken cancellationToken = default);

/// <summary>
/// Sends a request to the /api/chat endpoint and streams the response of the chat.
/// </summary>
/// <param name="chatRequest">The request to send to Ollama</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <returns>
/// An asynchronous enumerable that yields ChatResponseStream. Each item represents a message in the chat response stream.
/// Returns null when the stream is completed.</returns>
IAsyncEnumerable<ChatResponseStream?> StreamChat(ChatRequest chatRequest, [EnumeratorCancellation] CancellationToken cancellationToken = default);

/// <summary>
/// Sends a request to the /api/copy endpoint to copy a model
/// </summary>
Expand Down

0 comments on commit 879ef80

Please sign in to comment.