Skip to content

A collection of Jupyter notebooks demonstrating implementations of Large Language Models (LLMs) using LangChain and LangGraph

Notifications You must be signed in to change notification settings

dmiranda2791/llm-playground

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LLM Playground

A collection of Jupyter notebooks demonstrating implementations of Large Language Models (LLMs) using LangChain and LangGraph.

Overview

This repository contains four notebooks that explore different aspects of LLM application development:

  1. Agent.ipynb: Implements a basic agent that can perform web searches using the Tavily API and maintain conversation state.
  2. Chatbot.ipynb: Demonstrates building a chatbot with conversation memory and custom prompt templates.
  3. Simple LLM Application.ipynb: Covers fundamental LLM interactions and streaming responses.
  4. Semantic Search Engine.ipynb: Implements a semantic search system using vector embeddings and document retrieval, with PDF processing and advanced search capabilities.

Technical Stack

  • 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

Features

Agent Implementation

  • Web search integration using Tavily API
  • Basic conversation state management
  • Simple memory persistence
  • Response streaming

Chatbot Features

  • Conversation memory using LangGraph's MemorySaver
  • Custom prompt templates
  • Basic token management
  • Async processing

Core LLM Features

  • Basic model interactions
  • Streaming responses
  • Prompt templates
  • Environment configuration

Observability

  • LangSmith integration for tracing and monitoring
  • Conversation history tracking
  • Performance metrics

Semantic Search Features

  • 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

Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/llm-playground.git
    cd llm-playground
  2. Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Set up environment variables:

    cp .env.example .env

    Then edit .env with 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
    

Development

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

Contributing

Contributions are welcome. Please submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For questions or opportunities, please reach out through GitHub or LinkedIn.

About

A collection of Jupyter notebooks demonstrating implementations of Large Language Models (LLMs) using LangChain and LangGraph

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published