Skip to content

Repository files navigation

LLMs and a Bit More

A comprehensive educational repository exploring Large Language Models (LLMs), Retrieval-Augmented Generation (RAG), AI Agents, and Model Context Protocol (MCP) through practical, hands-on examples.

Discord

What's Inside

This repository contains practical demonstrations and implementations of modern AI technologies:

LLM Demos (llms.ipynb)

  • Azure OpenAI Integration: Complete setup guide for Azure OpenAI services
  • Chat Conversations: Build an AI study buddy for computer science topics
  • Image Generation: Create visual aids using DALL-E
  • Educational Applications: Real-world examples for students
  • Essay Writing Assistant: Help with academic writing and outlines

RAG Implementation (rag.ipynb)

  • Document Processing: Extract text from PDF files (Constitution of Kenya 2010)
  • Text Chunking: Intelligent document segmentation
  • Vector Embeddings: Using Sentence Transformers for semantic search
  • FAISS Integration: Efficient similarity search
  • Query System: Ask questions about constitutional content

Spotify MCP Server (spotify-play-music/)

A complete Model Context Protocol (MCP) server for Spotify integration:

  • Music Control: Play, pause, skip tracks, and adjust volume
  • Apple Script Integration: Native macOS Spotify control
  • MCP Tools: Structured tool definitions for AI agents
  • Debug Support: Built-in debugging with MCP Inspector
  • Agent Builder Integration: Connect with AI Toolkit Agent Builder

Getting Started

Prerequisites

  • Python 3.8+
  • Azure OpenAI subscription (for LLM demos) or GitHub Models
  • Spotify application (for MCP server)
  • macOS (for Spotify MCP server)

Setup Instructions

  1. Clone the repository:

    git clone https://github.com/BethanyJep/llms-and-a-bit-more.git
    cd llms-and-a-bit-more
  2. For LLM Notebooks:

    • Create a .env file with your Azure OpenAI credentials:
      AZURE_OPENAI_ENDPOINT=your_azure_endpoint_here
      AZURE_OPENAI_API_KEY=your_azure_api_key_here
    • Install dependencies:
      pip install openai python-dotenv requests pillow
  3. For RAG Implementation:

    pip install pymupdf sentence-transformers faiss-cpu openai tiktoken
  4. For Spotify MCP Server:

    cd spotify-play-music
    # Using uv (recommended)
    uv venv && uv pip install -r pyproject.toml --extra dev
    # Or using pip
    python -m venv .venv && pip install -e .[dev]

Spotify MCP system prompt

System ptompt: Control Spotify playback effectively using specific tools for playing, pausing, skipping tracks, setting volume, and retrieving currently playing track information.

Usage Examples

LLM Chat Assistant

# Create a conversation with AI
study_conversation = [
    {"role": "system", "content": "You are a helpful computer science tutor."},
    {"role": "user", "content": "Explain data structures simply."}
]
response = chat_with_ai(study_conversation)

RAG Query System

# Query the Constitution of Kenya
question = "What are the fundamental rights in Kenya?"
relevant_chunks = query_constitution(question, k=3)

Spotify MCP Tools

  • play_music(query): Play specific songs, artists, or albums
  • pause_music(): Pause current playback
  • next_track() / previous_track(): Navigate tracks
  • get_current_track(): Get currently playing track info
  • set_volume(level): Adjust volume (0-100)

Resources

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

License

This project is licensed under the MIT License.

About

an overview of LLMs, RAG, Agents and MCP

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages