Skip to main content

RecallAIsh: A Retrieval-Augmented Generation (RAG) Framework

RecallAIsh is a comprehensive Python package designed to easily add Retrieval-Augmented Generation capabilities to your applications. It seamlessly integrates real-time knowledge retrieval with Large Language Model (LLM) responses to deliver context-aware, accurate, and dynamic results.

Table of Contents

Overview

RecallAIsh leverages the power of state-of-the-art retrieval methods combined with LLMs, allowing you to enrich your text generation workflows with up-to-date and contextually relevant information. With built-in support for various document sources, dynamic web content scraping, and flexible vector storage solutions such as Qdrant, Pinecone, and MongoDB, this package is ideal for projects ranging from smart document QA systems to advanced conversational agents.

Features

  • Retrieval-Augmented Generation (RAG): Combine real-time data retrieval with LLM responses for informed outputs.
  • Plug-and-Play Integration: Easily integrate with GPT-based models and other LLMs for powerful natural language understanding.
  • Vector Storage Solutions: Built-in support for Qdrant, Pinecone, and MongoDB for efficient document embedding storage and retrieval.
  • Multi-Source Ingestion: Ingest content from PDFs, web pages via integrated web scrapers, and additional document sources.
  • Custom Prompt Management: Create tailored prompts with context-rich information to steer LLM responses.
  • Modular Pipeline: Extend or modify components according to your project requirements.

Installation

Prerequisites

  • Python 3.10 or higher
  • pip package manager
  • A vector database: Qdrant, Pinecone, or MongoDB
  • An OpenAI API key

Install via PyPI

Install RecallAIsh using the Python Package Index:

pip install RecallAIsh

If you plan to use MongoDB for storing vectors, install the optional dependencies:

pip install RecallAIsh[mongodb]

Manual Installation

  1. Clone the repository:
    git clone https://github.com/AshishChandpa/RecallAIsh.git
    cd RecallAIsh
    
  2. Install the dependencies:
    pip install -r requirements.txt
    
  3. Create a .env file in the project root and add your OpenAI API key:
    OPENAI_API_KEY=your_openai_api_key
    
  4. Ensure your vector database is up and running. For example, start Qdrant:
    docker run -p 6333:6333 -p 6334:6334 qdrant/qdrant
    
    Or, set up your MongoDB instance accordingly.

Usage

Running an Example

See RecallAIsh in action with the provided example script:

python examples/example.py

Integrating RecallAIsh into Your Project

Below is a detailed example highlighting primary components, including the new MongoDB vector store and web scraper integration:

import os

from RecallAIsh.document_loaders.web_loader import WebDocumentLoader
from RecallAIsh.prompt_manager import PromptManager
from RecallAIsh.rag_system import RAGSystem
from RecallAIsh.vector_store.mongodb_store import MongoDBVectorStore
from RecallAIsh.vector_store.qdrant_store import QdrantVectorStore

# Example: Connecting using Qdrant
qdrant_store = QdrantVectorStore(
    url="http://localhost:6333",
    collection_name="my_rag_collection",
    vector_size=1536,  # Adjust to match your chosen embedding dimension
)

# Example: Connecting using MongoDB
mongodb_store = MongoDBVectorStore(
    uri="<MongoAtlasURL>",
    database="recallai_db",
    collection="vector_store",
    vector_size=1536,  # Adjust to match your embedding dimension
)

# Initialize the Retrieval-Augmented Generation system with your preferred vector store
rag_system = RAGSystem(
    vector_store=mongodb_store,  # or qdrant_store if preferred
    vector_namespace="default_namespace",
    openai_api_key=os.getenv("OPENAI_API_KEY"),
)

# Retrieve relevant documents based on the user's query
user_query = "Summarize the latest news on technology."
# First, use the web scraper to fetch dynamic content from the web
doc = WebDocumentLoader().load(url="https://news.example.com/technology")
# Store processed web content into the vector store as needed
rag_system.ingestion_pipeline([doc])

# Retrieve documents including the freshly scraped web content
context = rag_system.retrieve_documents(user_query, source="all")

# Define custom instructions and generate the full prompt
instructions = "You are an expert assistant tasked with summarizing complex technical news."
prompt_manager = PromptManager(instructions=instructions)
full_prompt = prompt_manager.create_prompt(context, user_query)

# Generate answer using the RAG system
response = rag_system.chat(full_prompt, model="gpt-4o-mini")
print("Answer:", response)

Configuration

  • Customize vector store parameters such as collection name and embedding dimensions as needed.
  • Extend the ingestion pipeline to incorporate additional document formats, web scraping, or data sources.
  • Adjust the prompt management module to refine how context and instructions are combined for your specific application.

Web Scraper Integration

RecallAIsh now includes a web scraper module which leverages standard libraries like BeautifulSoup and requests. This allows you to dynamically ingest web content:

  • Configure the scraper with custom parameters such as user-agent, timeout, and parsing criteria.
  • Automatically process and clean HTML content before storing it in your chosen vector store.

Contributing

Contributions are welcome! To contribute:

  1. Open an issue for discussion or report a bug.
  2. Submit a pull request with your improvements.
  3. Follow the coding standards and ensure tests pass before submission.

License

RecallAIsh is available under the MIT License. See the LICENSE file for more details.

Contact

For further questions or feedback, please contact via email: chandpa.ashish007@gmail.com.

Happy coding with RecallAIsh!

Metadata

Release files for RecallAIsh 0.2.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for RecallAIsh 0.2.5
File Size Uploaded Provenance Actions
recallaish-0.2.5.tar.gz 16.3 kB Without provenance Details for recallaish-0.2.5.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for RecallAIsh 0.2.5
File Interpreter ABI Platform Actions
recallaish-0.2.5-py3-none-any.whl Python 3 none any Details for recallaish-0.2.5-py3-none-any.whl

Total release size: 34.2 kB

Release files / recallaish-0.2.5.tar.gz

Download URL recallaish-0.2.5.tar.gz
Size 16.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ee10297a091cec8e2cab88bcf7dfb0fcd3feec2c003f0396c369b500a4fdb1a5
BLAKE2b-256 checksum
How to use checksums
1a72dbc33933759945de11d8d8569b8619fbe82412d43c3a3162a054d443ecdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / recallaish-0.2.5-py3-none-any.whl

Download URL recallaish-0.2.5-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf5e752f3dff2407f219bcca9969fc9fee42bc6a8b5edca443c11668983e8005
BLAKE2b-256 checksum
How to use checksums
21a0b90f9e175f91e897612145bbf2e77201493027e19a7df1174444e9e2cee3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Security for RecallAIsh 0.2.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page