Search Results for

    Show / Hide Table of Contents

    Class DefaultToolRouter

    Embedding-based tool router.

    Flow: ToolRegistry (full tool list) ??embed each tool's description text ??ToolEmbeddingIndex (in-memory) ??embed user message ??cosine similarity search ??pass only top-K tools to the LLM (reduces prompt token count)

    If total tool count is ??topK, the full list is returned without filtering. Falls back to the full list if embedding fails.

    Inheritance
    object
    DefaultToolRouter
    Implements
    IToolRouter
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Glitch9.AIDevKit.Agents
    Assembly: Glitch9.AIDevKit.dll
    Syntax
    public class DefaultToolRouter : IToolRouter

    Constructors

    | Edit this page View Source

    DefaultToolRouter(Model)

    Declaration
    public DefaultToolRouter(Model embeddingModel)
    Parameters
    Type Name Description
    Model embeddingModel

    Methods

    | Edit this page View Source

    Initialize(ToolRegistry, ILogger)

    Declaration
    public void Initialize(ToolRegistry registry, ILogger logger)
    Parameters
    Type Name Description
    ToolRegistry registry
    ILogger logger
    | Edit this page View Source

    Invalidate()

    Marks the index as stale so it is rebuilt on the next route request.

    Declaration
    public void Invalidate()
    | Edit this page View Source

    RouteAsync(string, int, CancellationToken)

    Returns the top-K tools most relevant to the user message. Returns the full list if there is no embedding model or the total tool count is ??topK.

    Declaration
    public UniTask<List<Tool>> RouteAsync(string userMessage, int topK = 12, CancellationToken ct = default)
    Parameters
    Type Name Description
    string userMessage
    int topK
    CancellationToken ct
    Returns
    Type Description
    UniTask<List<Tool>>
    | Edit this page View Source

    SetEmbeddingModel(Model)

    Declaration
    public void SetEmbeddingModel(Model model)
    Parameters
    Type Name Description
    Model model

    Implements

    IToolRouter

    Extension Methods

    ArrayExtensions.ToArrayOrEmpty<T>(T)
    ArrayExtensions.ToArrayOrNull<T>(T)
    EventExtensions.ToDelta<T>(T, string, int, string, bool)
    EventExtensions.ToDone<T>(T, string, int, string)
    EventExtensions.ToEvent<T>(T)
    EventExtensions.UpcastDelta<T1, T2>(T1, string, int, string, bool)
    FallbackExtensions.IsOr<TParent, TChild>(TParent, TChild)
    ResponseCastingExtensions.GetResult<T>(T)
    SystemExtensions.GetName(object)
    • Edit this page
    • View Source
    In this article
    Back to top AI DevKit Documentation