Custom preset

You can use a built-in preset as-is, or customize parameters by creating a class that extends PresetCoreBase or by modifying a preset instance before creating the API.

Extend a built-in preset

Derive from an existing preset and override or set properties in the constructor:

using Aspose.LLM.Abstractions.Parameters.Presets;
using Aspose.LLM.Abstractions.Models;

public class MyQwenPreset : Qwen25Preset
{
    public MyQwenPreset()
    {
        ContextParameters.ContextSize = 8192;
        BaseModelInferenceParameters.GpuLayers = 0; // CPU only
    }
}

// Use it
using var api = AsposeLLMApi.Create(new MyQwenPreset());

Create a preset from base

For full control, extend PresetCoreBase and set all required properties (model source, context size, chat template, etc.):

public class MyPreset : PresetCoreBase
{
    public MyPreset()
    {
        BaseModelSourceParameters.HuggingFaceRepoId = "your/repo";
        BaseModelSourceParameters.HuggingFaceFileName = "model.gguf";
        ContextParameters.ContextSize = 4096;
        // ... set other parameters
    }
}

Refer to existing presets in the codebase (e.g. Qwen25Preset, Gemma3Preset) for typical values. See Presets and Supported presets for more information.