Table of Contents

Class OllamaAgent

Namespace
AutoGen.Ollama
Assembly
AutoGen.Ollama.dll

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 HttpClient
name string
modelName string
systemMessage string
replyOptions OllamaReplyOptions

Properties

Name

public string Name { get; }

Property Value

string

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 GenerateReplyOptions

completion option. If provided, it should override existing option if there's any

cancellation CancellationToken

Returns

Task<IMessage>

GenerateStreamingReplyAsync(IEnumerable<IMessage>, GenerateReplyOptions?, CancellationToken)

public IAsyncEnumerable<IMessage> GenerateStreamingReplyAsync(IEnumerable<IMessage> messages, GenerateReplyOptions? options = null, CancellationToken cancellationToken = default)

Parameters

messages IEnumerable<IMessage>
options GenerateReplyOptions
cancellationToken CancellationToken

Returns

IAsyncEnumerable<IMessage>