forked from 1827133/BA-Chatbot
18 lines
434 B
Python
Executable File
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
|
|
|
|
|