A collection of Jupyter notebooks demonstrating implementations of Large Language Models (LLMs) using LangChain and LangGraph.
This repository contains four notebooks that explore different aspects of LLM application development:
- Agent.ipynb: Implements a basic agent that can perform web searches using the Tavily API and maintain conversation state.
- Chatbot.ipynb: Demonstrates building a chatbot with conversation memory and custom prompt templates.
- Simple LLM Application.ipynb: Covers fundamental LLM interactions and streaming responses.
- Semantic Search Engine.ipynb: Implements a semantic search system using vector embeddings and document retrieval, with PDF processing and advanced search capabilities.
- LangChain: LLM interactions and prompt management
- LangGraph: State management and agent orchestration
- OpenAI API: Model inference
- Tavily API: Web search functionality
- LangSmith: Observability and tracing
- Python 3.11
- Web search integration using Tavily API
- Basic conversation state management
- Simple memory persistence
- Response streaming
- Conversation memory using LangGraph's MemorySaver
- Custom prompt templates
- Basic token management
- Async processing
- Basic model interactions
- Streaming responses
- Prompt templates
- Environment configuration
- LangSmith integration for tracing and monitoring
- Conversation history tracking
- Performance metrics
- PDF document processing and chunking
- Vector embeddings using OpenAI's text-embedding-3-large model
- In-memory vector store implementation
- Multiple search methods (basic, scored, vector-based)
- Batch processing and async search capabilities
- Document metadata preservation
-
Clone the repository:
git clone https://github.com/yourusername/llm-playground.git cd llm-playground -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables:
cp .env.example .env
Then edit
.envwith your API keys:OPENAI_API_KEY=your_openai_key TAVILY_API_KEY=your_tavily_key LANGSMITH_API_KEY=your_langsmith_key LANGSMITH_PROJECT=your_project_name
The notebooks demonstrate:
- Basic LLM application development
- API integration (OpenAI, Tavily)
- Simple state management
- Basic async programming
- Environment configuration
- API key management
- Observability with LangSmith
Contributions are welcome. Please submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
For questions or opportunities, please reach out through GitHub or LinkedIn.