@@ -42,6 +42,7 @@ class llama_token_data(Structure):
4242
4343llama_progress_callback = ctypes .CFUNCTYPE (None , c_double , c_void_p )
4444
45+
4546class llama_context_params (Structure ):
4647 _fields_ = [
4748 ("n_ctx" , c_int ), # text context
@@ -55,7 +56,6 @@ class llama_context_params(Structure):
5556 ("vocab_only" , c_bool ), # only load the vocabulary, no weights
5657 ("use_mlock" , c_bool ), # force system to keep model in RAM
5758 ("embedding" , c_bool ), # embedding mode only
58-
5959 # called with a progress value between 0 and 1, pass NULL to disable
6060 ("progress_callback" , llama_progress_callback ),
6161 # context pointer passed to the progress callback
@@ -165,6 +165,14 @@ def llama_n_ctx(ctx: llama_context_p) -> c_int:
165165_lib .llama_n_ctx .restype = c_int
166166
167167
168+ def llama_n_embd (ctx : llama_context_p ) -> c_int :
169+ return _lib .llama_n_ctx (ctx )
170+
171+
172+ _lib .llama_n_embd .argtypes = [llama_context_p ]
173+ _lib .llama_n_embd .restype = c_int
174+
175+
168176# Token logits obtained from the last call to llama_eval()
169177# The logits for the last token are stored in the last row
170178# Can be mutated in order to change the probabilities of the next token
0 commit comments