LangChain

Embedd in gs and Vector Stores: OpenAI Embeddings, FAISS, Chroma, and Similarity Search

Vector stores enable semantic search. Load embeddings, store vectors in FAISS or Chroma, and query with similarity search to retrieve relevant documents for RAG.

SS
Soham Sharma
AI Engineer, Botmartz · July 17, 2026 · 1 min read
Read Time
1 min
Failure Modes
5
Code Snippets
3
Runnable Notebook
1
Embeddings and Vector Stores: OpenAI Embeddings, FAISS, Chroma, and Similarity Search

Embeddings convert text to vectors. Vector stores enable semantic search by finding the nearest neighbors. This post covers embedding models, vector databases, and similarity search queries.

Embeddings

from langchain.embeddings import OpenAIEmbeddings

embeddings = OpenAIEmbeddings(model="text-embedding-3-small") vector = embeddings.embed_query("What is semantic search?") print(f"Embedding dimension: {len(vector)}")

Output:

Embedding dimension: 1536

Vector Stores

from langchain_community.vectorstores import FAISS, Chroma

from langchain.embeddings import OpenAIEmbeddings

embeddings = OpenAIEmbeddings()

# FAISS for in-memory search vector_store = FAISS.from_documents(documents, embeddings)

# Query results = vector_store.similarity_search("What is the main topic?", k=3) for doc in results: print(f"- {doc.page_content[:100]}...")

Output:

- The main topic is semantic search and retrieval-augmented generation...

FAISS is fast and lightweight; Chroma persists to disk.

Conclusion

Embeddings and vector stores are the retrieval backbone of RAG. OpenAI embeddings are high-quality; FAISS and Chroma offer flexible storage and search. Understanding vector databases enables building effective semantic search. Next: we'll build a complete RAG pipeline from data ingestion to generation.

Closing Takeaways

Measure retrieval precision and recall in isolation before touching the model.
Chunk along document structure, not arbitrary character counts.
Combine vector and keyword search — hybrid retrieval beats either alone.
Treat evaluation as continuous infrastructure, not a launch-week report.
Try It Yourself
A runnable Google Colab notebook with the eval harness and hybrid search code from this post.
#LangChain#Embeddings#Vector Stores#FAISS#Semantic Search
0 views
SS
Soham Sharma
AI Engineer at Botmartz, building enterprise RAG and agent systems in production. Contributing to open-source libraries.

Discussion (0)

No approved comments yet. Be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *

More Engineering Insights
TensorFlow>-
Soham Sharma · 8 min read
GeneralPlaywright E2E Test Post
Integration Bot · 5 min read