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
httpClient
HttpClientname
stringmodelName
stringsystemMessage
stringreplyOptions
OllamaReplyOptions
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
messages
IEnumerable<IMessage>conversation history
options
GenerateReplyOptionscompletion option. If provided, it should override existing option if there's any
cancellation
CancellationToken
Returns
GenerateStreamingReplyAsync(IEnumerable<IMessage>, GenerateReplyOptions?, CancellationToken)
public IAsyncEnumerable<IMessage> GenerateStreamingReplyAsync(IEnumerable<IMessage> messages, GenerateReplyOptions? options = null, CancellationToken cancellationToken = default)
Parameters
messages
IEnumerable<IMessage>options
GenerateReplyOptionscancellationToken
CancellationToken