Embedding Models
Embeddings are vector representations of text that capture semantic meaning. In RAG, we embed both document chunks and user queries, then find the most similar chunks via vector similarity.
OpenAI Embeddings
Models: `text-embedding-3-small`, `text-embedding-3-large`, `text-embedding-ada-002`. Good quality, paid API.
from langchain.embeddings import OpenAIEmbeddings
embeddings = OpenAIEmbeddings(model="text-embedding-3-small")Hugging Face Sentence Transformers (Local, Free)
Popular models: `all-MiniLM-L6-v2` (384 dimensions), `all-mpnet-base-v2` (768 dimensions).
from langchain.embeddings import HuggingFaceEmbeddings
embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")Cohere Embeddings
Alternative cloud embedding API. Free tier available.
Embedding Dimensions
Higher dimensions capture more nuance but require more storage and compute. For many RAG tasks, 384‑dim models work well.
Two Minute Drill
- Embeddings convert text to vectors for similarity search.
- OpenAI embeddings are paid, high quality.
- Hugging Face sentence‑transformers are free and run locally.
- `all-MiniLM-L6-v2` is a good starting point.
Need more clarification?
Drop us an email at career@quipoinfotech.com
