Property Timeout
Timeout
Gets or sets the maximum time allowed for execution.
public TimeSpan? Timeout { get; set; }
Property Value
Examples
Setting execution timeouts:
using LMKit.Model;
using LMKit.Agents;
using var model = new LM("path/to/model.gguf");
var agent = new Agent(model);
// Short timeout for chat interactions
var chatOptions = new AgentExecutionOptions
{
Timeout = TimeSpan.FromSeconds(30)
};
var result = await agent.RunAsync("Quick question: what is 2+2?", chatOptions);
if (result.IsCancelled)
{
Console.WriteLine("Response took too long.");
}