Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose RequestOptions for Chat #77

Merged
merged 8 commits into from
Sep 12, 2024
Merged
Changes from all 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
9 changes: 8 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,11 @@ public class Chat
/// Gets or sets the AI model to chat with
/// </summary>
public string Model { get; set; }

/// <summary>
/// Gets or sets the RequestOptions to chat with
/// </summary>
public RequestOptions? Options { get; set; }
awaescher marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Creates a new chat instance
Expand Down Expand Up @@ -97,7 +103,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
Loading