ModelPredictionTool
Models & Types · AiDotNet.Agentic.Tools
Exposes a trained model’s prediction as a callable agent tool, so an LLM agent can query the model you just trained mid-reasoning — the same way it would call web search or a calculator.
Inheritance: AgentToolBase → ModelPredictionTool
For Beginners
This turns your trained model into a “gadget” the assistant can use. When the assistant needs a prediction, it calls this tool with the input numbers and gets the model’s answer back.
How It Works
The tool takes a numeric feature vector as { "features": [ ... ] } and returns the model’s output
vector as JSON. It is built by AiModelResult for tabular models (matrix/vector shaped), which supplies
the marshalling delegate; unsupported model shapes simply do not produce this tool.
Constructors
| Constructor | Summary |
|---|---|
ModelPredictionTool(Func<double[], double[]> predict, int featureCount, string name, string description) |
Creates a model-prediction tool. |
Methods
| Method | Summary |
|---|---|
double? TryParseFirstPrediction(string toolResultContent) |
Parses the first numeric value from this tool’s JSON result, for grounded verification. |