sentence-transformers

Generate sentence, text, and image embeddings for semantic search and RAG pipelines.

1|Updated Mar 5, 2026
One-click install
npx skills add https://github.com/Clay-HHK/claude-skills --skill sentence-transformers-clay-hhk
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: sentence-transformers
Source: https://github.com/Clay-HHK/claude-skills/tree/main/sentence-transformers
Command: npx skills add https://github.com/Clay-HHK/claude-skills --skill sentence-transformers-clay-hhk

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires sentence-transformers, transformers, torch, and includes references (resource) components.

What problem does it solve? Generating high-quality text embeddings locally for semantic search, clustering, and retrieval-augmented generation typically requires choosing among thousands of models and writing boilerplate encoding code. This Skill provides ready-to-use patterns for the Sentence Transformers framework so you can produce embeddings without API costs or external services. ## Core Features & Use Cases - Embedding Generation: Encode sentences and documents into dense vectors using 5000+ pre-trained models like all-MiniLM-L6-v2 and all-mpnet-base-v2. - Semantic Search & Similarity: Compute cosine similarity and run top-k semantic search over document corpora with built-in utilities. - Fine-tuning & Integration: Fine-tune models on domain data with InputExample and loss functions, and integrate with LangChain or LlamaIndex vector stores. - Use Case: Build a multilingual RAG system by encoding your document corpus with paraphrase-multilingual-mpnet-base-v2, storing embeddings in Chroma, and retrieving relevant passages for user queries. ## Quick Start Use the sentence-transformers skill to generate embeddings for my document corpus and find the most semantically similar passages to a query.

Frequently Asked Questions about sentence-transformers

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate sentence embeddings in Python?▼

Load a model with SentenceTransformer('all-MiniLM-L6-v2') and call model.encode() on your list of sentences. The method returns embedding vectors, optionally as PyTorch tensors, with batch size and progress bar options for large corpora.

Which sentence-transformers model should I use for semantic search?▼

Use all-MiniLM-L6-v2 for fast prototyping at 384 dimensions, all-mpnet-base-v2 for production RAG at 768 dimensions, or all-roberta-large-v1 when highest accuracy matters. For multilingual tasks, choose paraphrase-multilingual-mpnet-base-v2.

Sentence Transformers vs OpenAI embeddings: which is better?▼

Sentence Transformers runs locally with no API costs and offers 5000+ models including domain-specific ones, making it cost-effective for high-volume encoding. OpenAI embeddings are API-based and may suit cases needing managed infrastructure without local GPU resources.

Can I use sentence-transformers with LangChain or LlamaIndex?▼

Yes, LangChain supports it via HuggingFaceEmbeddings with a model name like sentence-transformers/all-mpnet-base-v2, and LlamaIndex via HuggingFaceEmbedding. Both integrate directly with vector stores such as Chroma for retrieval pipelines.

How do I fine-tune a sentence-transformers model on my own data?▼

Create InputExample pairs with similarity labels, wrap them in a DataLoader, and choose a loss like CosineSimilarityLoss. Call model.fit() with the training objectives, epochs, and warmup steps, then save the result with model.save().

When should I not use sentence-transformers for embeddings?▼

Avoid it when you need a fully managed API service without maintaining local infrastructure, or when task-specific instruction-based embeddings are required. Alternatives include OpenAI Embeddings, Cohere Embed, or Instructor for those scenarios.