1
0
Fork 0
BA-Chatbot_Ali_Thesis/backend/embeddings/llama.py

18 lines
434 B
Python
Executable File

from llama_cpp import Llama
class Embedder:
def __init__(self, llama_model_path:str) -> None:
self.llama = Llama(
model_path=llama_model_path,
n_ctx=2048,
n_parts=1,
f16_kv=3,
embedding=True,
)
def embed_text_llama(self, doc: str):
embeddings_query = self.llama.embed(doc)
return embeddings_query