Creates a new Chat instance for sending messages to the chat API.
The constructor initializes basic properties. Most properties should be set after construction, including options, stream, think, tools, and agent.
// Create connection
var connection = new Settings.Connection() {
name = "Local Ollama",
url = "http://127.0.0.1:11434/api"
};
// Create chat with properties set via object initializer
var chat = new Call.Chat(connection, "llama3.2") {
stream = true,
think = true,
agent = agent_handler
};
// Create and assign Options object
chat.options = new Call.Options() {
temperature = 0.7,
top_p = 0.9
};
// Or assign existing Options object
chat.options = existing_options;
// Add tools
foreach (var tool in manager.tools.values) {
chat.add_tool(tool);
}
// Send messages
var response = yield chat.send(messages);
| connection |
The connection settings for the API endpoint |
| model |
The model name to use for chat |
| OllmError.INVALID_ARGUMENT |
if model is empty |