Method Validate
Validate(out IReadOnlyList<string>)
Validates the agent configuration, ensuring it is ready for execution.
public bool Validate(out IReadOnlyList<string> errors)
Parameters
errorsIReadOnlyList<string>When this method returns, contains a list of validation error messages, or an empty list if validation succeeded.
Returns
Examples
Validating an agent before execution:
using LMKit.Model;
using LMKit.Agents;
var agent = new Agent();
// Validate without a model
if (!agent.Validate(out var errors))
{
Console.WriteLine("Validation failed:");
foreach (var error in errors)
{
Console.WriteLine($" - {error}");
}
}
// Fix the issue and re-validate
using var model = new LM("path/to/model.gguf");
agent.Model = model;
if (agent.Validate(out errors))
{
Console.WriteLine("Agent is ready!");
}
Remarks
Validation checks include:
- A language model must be assigned.
- If tools are registered, the model must support tool calls.
- If Specific is set, the forced tool must exist.