S
sentence-transformers
Framework for state-of-the-art sentence, text, and image embeddings. Provides 5000+ pre-trained models for semantic similarity, clustering, and retrieval. Supports multilingual, domain-specific, and multimodal models. Use for generating embeddings for RAG, semantic search, or
Installation
Pick a client and clone the repository into its skills directory.
Installation
About this skill
Framework for state-of-the-art sentence, text, and image embeddings. Provides 5000+ pre-trained models for semantic similarity, clustering, and retrieval. Supports multilingual, domain-specific, and multimodal models. Use for generating embeddings for RAG, semantic search, or similarity tasks. Best for production embedding generation.
How to use
- Zainstaluj framework poleceniem
pip install sentence-transformers. Wymaga PyTorch i biblioteki transformers — instalator pobierze je automatycznie. - Załaduj wybrany model, np.
all-MiniLM-L6-v2(szybki, lekki) luball-mpnet-base-v2(dokładniejszy). WywołajSentenceTransformer('nazwa-modelu')— przy pierwszym uruchomieniu model pobierze się z huggingface.co. - Przygotuj listę tekstów do osadzenia (zdania, paragrafy, dokumenty). Przekaż je metodzie
model.encode(lista_tekstów)— otrzymasz macierz wektorów. - Oblicz podobieństwo między osadzeniami za pomocą
cos_sim()z modułusentence_transformers.util. Wynik to wartość od 0 do 1 — im bliżej 1, tym bardziej podobne teksty. - Użyj osadzeń w systemie RAG: indeksuj dokumenty wektorami, a przy zapytaniu użytkownika porównaj jego osadzenie z bazą — zwróć najbardziej podobne dokumenty jako kontekst dla LLM.
- Dla wielojęzyczności wybierz model z prefiksem
multilingual-(np.multilingual-e5-base) — obsługuje 100+ języków w jednym modelu, bez potrzeby tłumaczenia.