diff --git a/LLama/Native/SafeLLamaHandleBase.cs b/LLama/Native/SafeLLamaHandleBase.cs
index 023f8cdd..6371b327 100644
--- a/LLama/Native/SafeLLamaHandleBase.cs
+++ b/LLama/Native/SafeLLamaHandleBase.cs
@@ -1,11 +1,13 @@
using System;
-using System.Collections.Generic;
using System.Runtime.InteropServices;
-using System.Text;
namespace LLama.Native
{
- public abstract class SafeLLamaHandleBase: SafeHandle
+ ///
+ /// Base class for all llama handles to native resources
+ ///
+ public abstract class SafeLLamaHandleBase
+ : SafeHandle
{
private protected SafeLLamaHandleBase()
: base(IntPtr.Zero, ownsHandle: true)
@@ -24,8 +26,10 @@ namespace LLama.Native
SetHandle(handle);
}
+ ///
public override bool IsInvalid => handle == IntPtr.Zero;
+ ///
public override string ToString()
=> $"0x{handle.ToString("x16")}";
}
diff --git a/LLama/Native/SafeLlamaModelHandle.cs b/LLama/Native/SafeLlamaModelHandle.cs
index 7448efa1..5607ccee 100644
--- a/LLama/Native/SafeLlamaModelHandle.cs
+++ b/LLama/Native/SafeLlamaModelHandle.cs
@@ -3,10 +3,13 @@ using LLama.Exceptions;
namespace LLama.Native
{
+ ///
+ /// A reference to a set of llama model weights
+ ///
public class SafeLlamaModelHandle
: SafeLLamaHandleBase
{
- public SafeLlamaModelHandle(IntPtr handle)
+ internal SafeLlamaModelHandle(IntPtr handle)
: base(handle)
{
}
@@ -19,10 +22,17 @@ namespace LLama.Native
return true;
}
+ ///
+ /// Load a model from the given file path into memory
+ ///
+ ///
+ ///
+ ///
+ ///
public static SafeLlamaModelHandle LoadFromFile(string modelPath, LLamaContextParams lparams)
{
var model_ptr = NativeApi.llama_load_model_from_file(modelPath, lparams);
- if (model_ptr == null)
+ if (model_ptr == IntPtr.Zero)
throw new RuntimeError($"Failed to load model {modelPath}.");
return new SafeLlamaModelHandle(model_ptr);