Basic Semantic Search with Embedded Models

Basic Semantic Search with Embedded Models

🚀 Excited to Share my recent hands-on with : "AI LangChain Basic Semantic Search with Embedded Models"!

I’m excited to share my latest project—a step-by-step starter implementation for beginners in semantic search, built using the LangChain framework. Leveraging HuggingFace and OpenAI models, this project demonstrates how document embeddings enable more contextual and relevant results than traditional keyword searches.

🔍 What Is Semantic Search?

Semantic search uses AI to understand the meaning behind user queries and documents. Instead of relying on exact keyword matches, it retrieves results based on contextual relevance, powering smarter chatbots, document retrieval, and knowledge management applications.

Article content

Key Features

  • Simple, modular codebase for easy learning and extension
  • Document embedding through HuggingFace and OpenAI
  • Context-aware semantic search and similarity queries
  • Example scripts and test cases for hands-on exploration

It’s ideal for those new to NLP and vector search—jumpstart your learning with practical, readable code!

AI LangChain Basic Semantic Search with Embedded Models

This project demonstrates basic semantic search using embedding models with the LangChain framework. It provides examples for document embedding, querying, and semantic similarity using both HuggingFace and OpenAI models.

Features

  • Embed documents using HuggingFace or OpenAI models
  • Perform semantic search and similarity queries
  • Modular code for easy extension
  • Example scripts and test cases

Project Structure

EmbededModels/
    EmbeddingDocs_HFModel           # Embedding with HuggingFace models
    EmbeddingDocs_OpenAIModel.py    # Embedding with OpenAI models
    EmbeddingQuery_OpenAIModel.py   # Querying with OpenAI models
    DocSimilarity_SemanticSearch.py # Semantic search and similarity

requirements.txt                   # Python dependencies
README.md                          # Project documentation
tests/
    test.py                        # Test cases
        

Setup

  1. Create and activate a Python environment (Anaconda or venv recommended).
  2. Install dependencies:

Usage

  • Run embedding scripts or semantic search examples from the EmbededModels directory.
  • Example:

Troubleshooting

  • If you see errors related to missing DLLs (e.g., torch_python.dll), ensure you have the correct version of torch and the Microsoft Visual C++ Redistributable installed.
  • For network issues with conda, use pip for package installation.


#AI #NLP #LangChain #SemanticSearch #Python #MachineLearning #BeginnerFriendly


To view or add a comment, sign in

More articles by Sanjay Dubey

  • How RAG Unlocks Dynamic, Context-Aware AI

    🚀 Building a Wikipedia Q&A app with Retrieval-Augmented Generation (RAG) and LangChain I’m excited to share my latest…

    3 Comments
  • No Code Test Automation using Playwright MCP

    🚀 Excited to share my first experience using Playwright MCP with Visual Studio Code! With the help of VS Code Copilot,…

    2 Comments
  • Test Automation with Javascript based tools, libs & frameworks

    Test Automation with Javascript based tools, libs & frameworks matrix by features : As JavaScript automated testing…

  • Let's test the Data pipeline

    Just came across a cool python package to test the Data called Great Expectations. We can use it to any…

  • Karate Framework for API tests

    Karate is a relatively new open source framework for testing Web services. Even though Karate is written in Java, its…

    2 Comments
  • Jenkins shared lib for pipelines

    It is useful to share parts of Pipelines between various projects to reduce redundancies and keep code "DRY". Pipeline…

Explore content categories