BotSharp/src/Infrastructure/BotSharp.Core/Plugins/LLamaSharp/LlamaAiModel.cs
Haiping Chen e5e322b3d7 #81
2023-06-27 18:36:50 -05:00

33 lines
663 B
C#

using LLama;
using LLama.Common;
namespace BotSharp.Core.Plugins.LLamaSharp;
public class LlamaAiModel
{
private readonly LlamaSharpSettings _settings;
public LlamaSharpSettings Settings => _settings;
LLamaModel _model;
public LLamaModel Model => _model;
public LlamaAiModel(LlamaSharpSettings settings)
{
_settings = settings;
}
public void LoadModel()
{
if (_model != null)
{
return;
}
_model = new LLamaModel(new ModelParams(_settings.ModelPath,
contextSize: _settings.MaxContextLength,
gpuLayerCount: _settings.NumberOfGpuLayer));
}
}