diff --git a/LLama/LLamaContext.cs b/LLama/LLamaContext.cs
index 7d0c0f91..4f8e7d94 100644
--- a/LLama/LLamaContext.cs
+++ b/LLama/LLamaContext.cs
@@ -1,4 +1,4 @@
-using LLama.Exceptions;
+using LLama.Exceptions;
using LLama.Native;
using System;
using System.Collections.Generic;
@@ -521,6 +521,17 @@ namespace LLama
return candidates_p;
}
+ ///
+ /// Gets whether or not the Bos token should be added.
+ /// From common.cpp https://github.com/ggerganov/llama.cpp/blob/60325fa56f61c228464c9f065db3aa6a61f2156e/common/common.cpp#L2417
+ ///
+ ///
+ public bool ShouldAddBosToken()
+ {
+ var addBos = NativeApi.llama_add_bos_token(NativeHandle.ModelHandle);
+ return addBos != -1 ? Convert.ToBoolean(addBos) : NativeHandle.LLamaVocabType == LLamaVocabType.SentencePiece;
+ }
+
#region eval overloads
///
///
diff --git a/LLama/Native/SafeLLamaContextHandle.cs b/LLama/Native/SafeLLamaContextHandle.cs
index 51568769..13a7aa1b 100644
--- a/LLama/Native/SafeLLamaContextHandle.cs
+++ b/LLama/Native/SafeLLamaContextHandle.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
@@ -19,6 +19,8 @@ namespace LLama.Native
///
public int VocabCount => ThrowIfDisposed().VocabCount;
+ public LLamaVocabType LLamaVocabType => ThrowIfDisposed().VocabType;
+
///
/// Total number of tokens in the context
///