This repository contains implementations of various Language Models (LLMs), Chat Models and Embedding Models using LangChain. It demonstrates different model integrations for LLMs and embeddings, including OpenAI, Hugging Face, Google, Sentence Transformers and Anthropic.
04bhavyaa-langchain-models/
βββ README.md # Project documentation
βββ requirements.txt # Required dependencies
βββ LLMs/
β βββ llm_demo.py # Basic LLM demonstration
βββ chat-models/ # Various chat models
β βββ chatmodel_anthropic.py # Anthropic's Claude integration
β βββ chatmodel_google.py # Google Gemini (PaLM) integration
β βββ chatmodel_hf_api.py # Hugging Face API integration
β βββ chatmodel_hf_local.py # Local Hugging Face LLM integration
β βββ chatmodel_openai.py # OpenAI ChatGPT integration
βββ embedding-models/ # Embedding models for similarity search
βββ document_similarity.py # Cosine similarity for document search
βββ embedding_hf_local.py # Local Hugging Face embeddings
βββ embedding_openai_docs.py # OpenAI document embeddings
βββ embedding_openai_query.py # OpenAI query embeddings
- LangChain (Core framework for chaining LLMs)
- OpenAI API (ChatGPT & Embeddings)
- Anthropic API (Claude models)
- Google Generative AI (Gemini/PaLM models)
- Hugging Face (Transformer-based LLMs & embeddings)
- Scikit-learn (Cosine similarity for document search)
- Pandas & NumPy (Data processing utilities)
- LLMs: These are large-scale neural networks trained on vast text corpora. LangChain provides a structured way to interact with them.
- Chat Models: Variants of LLMs optimized for dialogue, such as OpenAI's ChatGPT, Claude, and Gemini.
- Embedding Models: Convert text into high-dimensional vectors to perform similarity search, useful for document retrieval and semantic search.
git clone https://github.com/yourusername/04bhavyaa-langchain-models.git
cd 04bhavyaa-langchain-models
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
Create a .env
file and add your API keys:
OPENAI_API_KEY=your_openai_api_key
ANTHROPIC_API_KEY=your_anthropic_api_key
GOOGLE_API_KEY=your_google_api_key
HUGGINGFACEHUB_API_TOKEN=your_huggingface_api_key
Example usage for document similarity:
python embedding-models/document_similarity.py
π‘ Contributions are welcome! Feel free to fork, open issues, or submit PRs.