Table of Contents

Property UseEmbeddingClassifier

Namespace
LMKit.TextAnalysis
Assembly
LM-Kit.NET.dll

UseEmbeddingClassifier

Gets or sets a value indicating whether the classifier should utilize embeddings strategy instead of completion. When set to true, forces the underlying engine to classify using embeddings.

public bool UseEmbeddingClassifier { get; set; }

Property Value

bool

Examples

using LMKit.Model;
using LMKit.TextAnalysis;
using System;
using System.Collections.Generic;

class Example
{
    static void Main()
    {
        Uri modelUri = new Uri("https://your-model-link-here");
        LM model = new LM(modelUri);

        Categorization categorization = new Categorization(model);

        // Enable embedding-based classification
        categorization.UseEmbeddingClassifier = true;

        // Define categories
        var categories = new List<string> { "food", "technology", "sports" };
        string text = "The new AI research is quite revolutionary.";

        // Perform classification
        int index = categorization.GetBestCategory(categories, text);

        if (index != -1)
        {
            Console.WriteLine($"Best Category: {categories[index]}");
        }
        else
        {
            Console.WriteLine("No suitable category found.");
        }

        Console.WriteLine($"Confidence: {categorization.Confidence}");
    }
}