You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

llama.llamaembedder.md 2.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. # LLamaEmbedder
  2. Namespace: LLama
  3. The embedder for LLama, which supports getting embeddings from text.
  4. ```csharp
  5. public sealed class LLamaEmbedder : System.IDisposable
  6. ```
  7. Inheritance [Object](https://docs.microsoft.com/en-us/dotnet/api/system.object) → [LLamaEmbedder](./llama.llamaembedder.md)<br>
  8. Implements [IDisposable](https://docs.microsoft.com/en-us/dotnet/api/system.idisposable)
  9. ## Properties
  10. ### **EmbeddingSize**
  11. Dimension of embedding vectors
  12. ```csharp
  13. public int EmbeddingSize { get; }
  14. ```
  15. #### Property Value
  16. [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  17. ## Constructors
  18. ### **LLamaEmbedder(IModelParams)**
  19. ```csharp
  20. public LLamaEmbedder(IModelParams params)
  21. ```
  22. #### Parameters
  23. `params` [IModelParams](./llama.abstractions.imodelparams.md)<br>
  24. ### **LLamaEmbedder(LLamaWeights, IModelParams)**
  25. ```csharp
  26. public LLamaEmbedder(LLamaWeights weights, IModelParams params)
  27. ```
  28. #### Parameters
  29. `weights` [LLamaWeights](./llama.llamaweights.md)<br>
  30. `params` [IModelParams](./llama.abstractions.imodelparams.md)<br>
  31. ## Methods
  32. ### **GetEmbeddings(String, Int32, Boolean, String)**
  33. #### Caution
  34. 'threads' and 'encoding' parameters are no longer used
  35. ---
  36. Get the embeddings of the text.
  37. ```csharp
  38. public Single[] GetEmbeddings(string text, int threads, bool addBos, string encoding)
  39. ```
  40. #### Parameters
  41. `text` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  42. `threads` [Int32](https://docs.microsoft.com/en-us/dotnet/api/system.int32)<br>
  43. unused
  44. `addBos` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  45. Add bos to the text.
  46. `encoding` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  47. unused
  48. #### Returns
  49. [Single[]](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  50. #### Exceptions
  51. [RuntimeError](./llama.exceptions.runtimeerror.md)<br>
  52. ### **GetEmbeddings(String)**
  53. Get the embeddings of the text.
  54. ```csharp
  55. public Single[] GetEmbeddings(string text)
  56. ```
  57. #### Parameters
  58. `text` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  59. #### Returns
  60. [Single[]](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  61. #### Exceptions
  62. [RuntimeError](./llama.exceptions.runtimeerror.md)<br>
  63. ### **GetEmbeddings(String, Boolean)**
  64. Get the embeddings of the text.
  65. ```csharp
  66. public Single[] GetEmbeddings(string text, bool addBos)
  67. ```
  68. #### Parameters
  69. `text` [String](https://docs.microsoft.com/en-us/dotnet/api/system.string)<br>
  70. `addBos` [Boolean](https://docs.microsoft.com/en-us/dotnet/api/system.boolean)<br>
  71. Add bos to the text.
  72. #### Returns
  73. [Single[]](https://docs.microsoft.com/en-us/dotnet/api/system.single)<br>
  74. #### Exceptions
  75. [RuntimeError](./llama.exceptions.runtimeerror.md)<br>
  76. ### **Dispose()**
  77. ```csharp
  78. public void Dispose()
  79. ```