feat: add the api to get the embedding length of the model.

This commit is contained in:
Yaohui Liu 2023-08-08 21:41:33 +08:00
parent d609b0e1d5
commit 3a1daa98a3
No known key found for this signature in database
GPG Key ID: E86D01E1809BD23E
1 changed files with 14 additions and 0 deletions

View File

@ -41,6 +41,20 @@ namespace LLama
/// The encoding set for this model to deal with text input. /// The encoding set for this model to deal with text input.
/// </summary> /// </summary>
public Encoding Encoding => _encoding; public Encoding Encoding => _encoding;
/// <summary>
/// The embedding length of the model, also known as `n_embed`
/// </summary>
public int EmbeddingLength
{
get
{
if(_ctx is null)
{
throw new NullReferenceException("The native context has not been created in this model.");
}
return NativeApi.llama_n_embd(_ctx);
}
}
/// <summary> /// <summary>
/// ///