Skip to content

Commit

Permalink
Expose RequestOptions for Chat
Browse files Browse the repository at this point in the history
ChatRequest holds support RequestOptions but there is no way to pass an instance into the chat requests currently (That I can see at least?)
  • Loading branch information
Plootie committed Sep 6, 2024
1 parent 2c071b8 commit b27f8dd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Chat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Runtime.CompilerServices;
using System.Threading;
using OllamaSharp.Models;
using OllamaSharp.Models.Chat;

namespace OllamaSharp;
Expand All @@ -26,6 +27,8 @@ public class Chat
/// Gets or sets the AI model to chat with
/// </summary>
public string Model { get; set; }

public RequestOptions? Options { get; set; }

/// <summary>
/// Creates a new chat instance
Expand Down Expand Up @@ -97,7 +100,8 @@ public async IAsyncEnumerable<string> SendAs(ChatRole role, string message, IEnu
Messages = Messages,
Model = Model,
Stream = !hasTools, // cannot stream if tools should be used
Tools = tools
Tools = tools,
Options = Options
};

var messageBuilder = new MessageBuilder();
Expand Down

0 comments on commit b27f8dd

Please sign in to comment.