Class OllamaAgent
An agent that can interact with ollama models.
public class OllamaAgent : IStreamingAgent, IAgent, IAgentMetaInformation
- Inheritance
-
OllamaAgent
- Implements
- Inherited Members
- Extension Methods
Constructors
OllamaAgent(HttpClient, string, string, string, OllamaReplyOptions?)
public OllamaAgent(HttpClient httpClient, string name, string modelName, string systemMessage = "You are a helpful AI assistant", OllamaReplyOptions? replyOptions = null)
Parameters
httpClientHttpClientnamestringmodelNamestringsystemMessagestringreplyOptionsOllamaReplyOptions
Properties
Name
public string Name { get; }
Property Value
Methods
GenerateReplyAsync(IEnumerable<IMessage>, GenerateReplyOptions?, CancellationToken)
Generate reply
public Task<IMessage> GenerateReplyAsync(IEnumerable<IMessage> messages, GenerateReplyOptions? options = null, CancellationToken cancellation = default)
Parameters
messagesIEnumerable<IMessage>conversation history
optionsGenerateReplyOptionscompletion option. If provided, it should override existing option if there's any
cancellationCancellationToken
Returns
GenerateStreamingReplyAsync(IEnumerable<IMessage>, GenerateReplyOptions?, CancellationToken)
public IAsyncEnumerable<IMessage> GenerateStreamingReplyAsync(IEnumerable<IMessage> messages, GenerateReplyOptions? options = null, CancellationToken cancellationToken = default)
Parameters
messagesIEnumerable<IMessage>optionsGenerateReplyOptionscancellationTokenCancellationToken