Files
Projet-Agent-IA/AgentReact/utils/VectorDatabase.py
LJ5O 1c2f0728ea Passage Jina -> intfloat/multilingual-e5-large
Jina me donne toujours RuntimeError: The size of tensor a (5) must match the size of tensor b (4) at non-singleton dimension 1
2026-02-06 17:38:27 +01:00

23 lines
791 B
Python
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from langchain_huggingface import HuggingFaceEmbeddings
from langchain_chroma import Chroma # TODO plus tard, ramplacer par PG Vector
import sys
from pathlib import Path
base_dir:str = Path(sys.argv[0]).resolve().parent.as_posix() # Récupérer le chemin vers le point d'entrée du programme
bdd_path:str = base_dir + "/../chroma_db/"
EMBEDDINGS = HuggingFaceEmbeddings(model_name="intfloat/multilingual-e5-large", model_kwargs={"trust_remote_code": True})
CHROMA = Chroma(
persist_directory=bdd_path,
embedding_function=EMBEDDINGS
)
class VectorDatabase: # Classe pour récupérer la BDD
@staticmethod
def getChroma()->Chroma:
return CHROMA
@staticmethod
def getEmbeddings()->'Embeddings Hugging Face':
return EMBEDDINGS