Class SingleFunctionCall
- Namespace
- LMKit.FunctionCalling
- Assembly
- LM-Kit.NET.dll
The SingleFunctionCall
class provides an interface to execute a single method
based on a natural language prompt, leveraging language model inference for function selection
and parameter extraction. It supports dynamic method invocation, function registration,
and parameter validation. The class allows configuration to force function selection even when
no suitable function is identified.
public class SingleFunctionCall : IDisposable
- Inheritance
-
SingleFunctionCall
- Implements
- Inherited Members
Constructors
- SingleFunctionCall(LLM)
Initializes a new instance of the
SingleFunctionCall
class with the specified language model.
Properties
- ForceFunctionSelection
Gets or sets a value indicating whether a function must be selected even if none seems suitable. When set to
true
, the engine will always select a function. When set tofalse
, the engine can detect that no function is suitable for the instruction. The default value isfalse
.
- InvokeFunctions
Gets or sets a value indicating whether the registered functions should be invoked automatically. The default value is
true
.
Methods
- ImportFunctions(object)
Registers all methods in the specified object instance that are marked with the LMFunctionAttribute.
- ImportFunctions<T>()
Registers all methods in the specified type
T
that are marked with the LMFunctionAttribute.
- Submit(string, CancellationToken)
Synchronously submits a natural language prompt and returns the result of the function invocation.
- SubmitAsync(string, CancellationToken)
Asynchronously submits a natural language prompt and returns the result of the function invocation.
Events
- BeforeMethodInvoke
Occurs before the invocation of an identified method, allowing subscribers to cancel the invocation.