Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fr. Francis: Your AI-Powered Spiritual Guide 📖

Fr. Francis is not just another chatbot; it's a compassionate and thoughtful AI designed to offer spiritual guidance and comfort in a fast-paced world. Built as a powerful Streamlit web application, this project creates a digital confessor ready to listen to your deepest concerns, providing a private and accessible space for reflection. By leveraging the immense power of the Groq API, it provides heartfelt, relevant advice, grounding its responses in specific, carefully selected Bible verses to illuminate your path forward. It's a modern bridge to timeless wisdom, offering a moment of spiritual solace anytime, anywhere.

✨ Features

  • Divine Guidance, Instantly: Experience a new level of responsiveness. Receive fast, spiritual advice powered by the lightning-fast Groq API, which is optimized for low-latency inference. This ensures that your moments of reflection are not interrupted by long loading times.

  • Biblical Wisdom at Your Fingertips: The AI persona meticulously selects and presents a relevant Bible verse for every situation you share. It's designed to go beyond superficial connections, offering a piece of scripture that speaks directly to the emotional and contextual nuances of your query.

  • Empathic Analysis: This application doesn't just quote scripture; it provides a profound explanation of how the chosen verse directly applies to your feelings and circumstances. The AI's purpose is to help you understand the message and apply its wisdom to your personal journey, guiding you toward a more meaningful path.

  • A Sanctuary for Your Soul: The user interface is a simple, beautiful, and minimalist web app that allows you to share your thoughts freely and privately. There's no complex setup or distracting elements, just a clear space for a quiet conversation with your spiritual guide.

  • Fully Customizable Persona: The core of the AI's personality and purpose is defined in a a straightforward system prompt. This makes the application incredibly flexible; you can easily modify the prompt to change the spiritual guide's tone, expertise, or even to focus on a different faith or philosophical tradition.

🛠️ Installation

Prerequisites

  • Python 3.8 or higher
  • A Groq API key

Steps

Clone the repository: Begin by cloning the project from GitHub to your local machine using the following command. This will create a local copy of all the files needed to run the application.

git clone https://github.com/your-username/fr-francis.git
cd fr-francis

Install dependencies: The project relies on two main libraries: Streamlit for the user interface and Groq for the AI engine. Create a requirements.txt file with the following content, and then run the installation command.

streamlit
groq

Now, run the installation command to fetch and install all required packages:

pip install -r requirements.txt

Set up your Groq API key: Security is paramount. The application securely accesses your Groq API key from an environment variable named GROQAPI to prevent hard-coding sensitive information directly into the source code. This is a best practice that keeps your key safe from accidental exposure.

On macOS/Linux: Open your terminal and run the following command. This sets the environment variable for your current session.

export GROQAPI='your-api-key-here'

On Windows: Open your command prompt and use the set command.

set GROQAPI='your-api-key-here'

🚀 Usage

Run the application: Once your dependencies are installed and your API key is set, you can launch the application with a simple Streamlit command from your terminal.

streamlit run your_script_name.py

Find your spiritual center: The application will automatically open in your web browser. A clean, simple interface will greet you. Type your question or concern into the text box, and as you do, the AI will provide a thoughtful, biblical response, offering you guidance and a moment of reflection.

👨‍💻 Technical Deep Dive: How It Works

This application is built on a simple yet powerful architecture, intelligently combining front-end simplicity with a sophisticated back-end.

  • Front-End with Streamlit: The visual interface is created entirely with Streamlit, a powerful yet easy-to-use Python library for building interactive web apps. It abstracts away the complexities of HTML, CSS, and JavaScript, allowing the developer to focus on the application's logic. The commands st.title(), st.subheader(), st.text_input(), and st.write() are responsible for dynamically rendering the titles, subheadings, the user's input box, and the AI's final response on the web page.

  • Back-End AI with Groq: The true magic happens in the generate_response function, which makes a low-latency API call to Groq. This is the core of the AI's "brain" and is where the heavy lifting of language processing occurs.

    • The Model: The code specifically uses the "meta-llama/llama-4-scout-17b-16e-instruct" model. This model is a highly capable Large Language Model (LLM) that has been fine-tuned to excel at following instructions. Its architecture is optimized for speed and accuracy in conversational tasks.

    • The System Prompt: The most critical part of the application's unique functionality is the system prompt. The line "content": "You are Fr. Francis, Christian Catholic Priest. You have to understand the scenario and emotion..." acts as a fundamental set of instructions for the AI. This is a form of prompt engineering, where we meticulously craft a persona and a set of rules for the AI to follow. It tells the model to not only adopt the specific persona of a priest but also to perform a multi-step task: understand the user's emotion, find a relevant Bible verse, and provide a compassionate explanation and a path forward.

    • Streamed Responses: By setting the stream=True parameter in the API call, the application receives the AI's response in "chunks" as it's being generated. This creates a much more dynamic and engaging user experience, as the text appears on the screen in real-time, simulating a natural conversation rather than a delayed response.

  • API Key Management: The application adheres to modern security best practices by not hard-coding the API key. Instead, os.environ.get('GROQAPI') retrieves the key from the operating system's environment variables. This practice keeps sensitive information secure and separate from the source code, which is essential for projects that may be shared publicly on platforms like GitHub.

🤝 Contributing

We welcome contributions! If you would like to contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature/your-feature-name).
  3. Commit your changes (git commit -m 'Add a new feature').
  4. Push to the branch (git push origin feature/your-feature-name).
  5. Open a Pull Request.

📄 License

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

🙏 Acknowledgments

Manu Martin: For the original code and the wonderful idea.

Groq: For the high-performance inference API that makes this project's responsiveness possible.

Streamlit: For the simple and elegant web framework that brings this application to life.

About

A Streamlit application that simulates a chatbot capable of responding to user queries with the wisdom and compassion of a Catholic priest. It uses advanced NLP techniques to understand and generate human-like responses. The chatbot is designed to provide spiritual guidance, answer questions about faith, and engage in meaningful conversations

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages