Skip to content

Gershonbest/Scribe

Repository files navigation

Bible Study Agent

An AI-powered Bible study assistant built with LangChain and LangGraph, offering multiple interface options including direct API, WhatsApp, and more.

Features

  • 🤖 Intelligent Bible study assistance using LangChain and LangGraph
  • 📱 Multiple interface options:
    • RESTful API for direct integration
    • WhatsApp integration via Twilio
  • 🔍 Advanced Bible study capabilities:
    • Verse lookup and search
    • Cross-reference analysis
    • Contextual understanding
    • Topic-based study
  • 🛠️ Modular architecture with clean separation of concerns
  • 📝 Comprehensive logging and error handling
  • 📚 Swagger UI documentation

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/bible_study_agent.git
cd bible_study_agent
  1. Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt

Configuration

Create a .env file in the project root with the following variables:

# Server Configuration
API_HOST=0.0.0.0
API_PORT=8000

# WhatsApp Integration (Optional)
TWILIO_ACCOUNT_SID=your_account_sid
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_FROM_NUMBER=your_whatsapp_number

Usage

Starting the Server

Run the unified server:

python -m bible_study_agent

This will start the server with all configured integrations.

API Endpoints

Direct API

  • Endpoint: /api/study
  • Method: POST
  • Request Body:
    {
      "message": "What does the Bible say about love?",
      "user_id": "optional_user_id",
      "context": {}
    }
  • Response:
    {
      "response": "The Bible's teaching on love...",
      "context": {}
    }

WhatsApp Webhook

  • Endpoint: /whatsapp/webhook
  • Method: POST
  • Handles incoming WhatsApp messages via Twilio

Documentation

Access the Swagger UI documentation at http://localhost:8000/docs when the server is running.

Project Structure

src/bible_study_agent/
├── __init__.py
├── __main__.py
├── server.py           # Unified server implementation
├── agents/
│   ├── __init__.py
│   └── study_agent.py  # Core Bible study agent
├── tools/
│   ├── __init__.py
│   └── bible_tools.py  # Bible-specific tools
├── api/
│   ├── __init__.py
│   └── api.py         # Direct API implementation
└── integrations/
    ├── __init__.py
    └── whatsapp_bot.py # WhatsApp integration

Architecture

The Bible Study Agent uses a modular architecture:

  1. Core Agent: Built with LangChain and LangGraph for intelligent Bible study assistance
  2. Tools: Specialized tools for Bible verse lookup, search, and analysis
  3. Unified Server: Single server handling multiple interfaces
  4. Integrations: Platform-specific integrations (WhatsApp, etc.)

Development

Adding New Tools

  1. Create a new tool class in tools/bible_tools.py
  2. Inherit from BaseTool
  3. Implement the required methods

Example:

from langchain.tools import BaseTool

class NewBibleTool(BaseTool):
    name = "tool_name"
    description = "Tool description"
    
    def _run(self, input_str: str) -> str:
        # Implementation
        pass

Adding New Integrations

  1. Create a new integration class in integrations/
  2. Implement the required interface methods
  3. Add configuration to the unified server

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

[Your chosen license]

Contact

[Your contact information]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages