Add return type annotations for embeddings and logits

This commit is contained in:
Andrei Betlen 2023-05-05 14:22:55 -04:00
parent 3e28e0e50c
commit b5f3e74627

View file

@ -387,7 +387,7 @@ _lib.llama_n_embd.restype = c_int
# Can be mutated in order to change the probabilities of the next token # Can be mutated in order to change the probabilities of the next token
# Rows: n_tokens # Rows: n_tokens
# Cols: n_vocab # Cols: n_vocab
def llama_get_logits(ctx: llama_context_p): def llama_get_logits(ctx: llama_context_p): # type: (...) -> Array[float] # type: ignore
return _lib.llama_get_logits(ctx) return _lib.llama_get_logits(ctx)
@ -397,7 +397,7 @@ _lib.llama_get_logits.restype = c_float_p
# Get the embeddings for the input # Get the embeddings for the input
# shape: [n_embd] (1-dimensional) # shape: [n_embd] (1-dimensional)
def llama_get_embeddings(ctx: llama_context_p): def llama_get_embeddings(ctx: llama_context_p): # type: (...) -> Array[float] # type: ignore
return _lib.llama_get_embeddings(ctx) return _lib.llama_get_embeddings(ctx)