Introducing Canopy: A Seamless Framework for Retrieval Augmented Generation
Canopy is an innovative open-source framework designed for Retrieval Augmented Generation (RAG) that facilitates interaction with your documents or text data. Built on top of the Pinecone vector database, Canopy allows users to quickly and effortlessly develop applications using RAG, transforming text data into powerful conversational experiences.
What is Canopy?
At its core, Canopy takes the complex tasks involved in building RAG applications and simplifies them. These tasks include chunking and embedding text data, managing chat history, optimizing queries, retrieving relevant context (including prompt engineering), and generating augmented responses.
Canopy is versatile, with the ability to deploy RAG-powered chat applications through a built-in server that can be integrated into an existing chat interface. For those seeking a more personalized solution, Canopy offers the flexibility to create custom RAG applications via its library.
How Does Canopy Work?
Canopy functions using two primary flows: knowledge base creation and chat interaction. During the knowledge base creation phase, users upload their documents, which are then converted into meaningful data representations stored within Pinecone's Vector Database. The chat flow begins by processing incoming queries and chat histories to fetch the most pertinent documents, querying the knowledge base and generating meaningful contexts which a Language Model can use to provide answers.
Features and Components
-
Canopy Core Library:
- ChatEngine: Allows interaction with data, sending queries to the
ContextEngine
and generating informed responses using a Language Model. - ContextEngine: Focuses on retrieving the most relevant documents through the
KnowledgeBase
and constructing coherent contexts for the Language Model. - KnowledgeBase: Manages data for RAG workflows by chunking and embedding text, storing them in vector databases like Pinecone or Qdrant, and retrieving relevant document chunks for queries.
- ChatEngine: Allows interaction with data, sending queries to the
-
Canopy Server:
- Offers a REST API using FastAPI, Uvicorn, and Gunicorn to seamlessly deploy in production environments. Test and document APIs with built-in Swagger UI.
-
Canopy CLI:
- A command-line tool that simplifies setting up a Canopy server, uploading documents, and interacting with a chat application directly from the terminal. Compare RAG-infused responses against native Language Model chatbots for evaluation.
Getting Started with Canopy
Begin with setting up a virtual environment, installing the Canopy software package, and configuring relevant environment variables for API access. Use the simple command canopy
to verify successful installation.
To get hands-on with Canopy, you can start by creating a new Pinecone index, upload your data, and begin deploying a Canopy server to interact with your data through chat interfaces.
Additional Considerations
Deploying Canopy requires careful consideration of rate limits and pricing set by model providers like OpenAI and Cohere. Additional integrations are planned for the future, enhancing Canopy's capabilities.
For those interested in contributing to the Canopy project, detailed guidelines are available in the project’s documentation.
Advanced and Production Use
Canopy supports migration from existing OpenAI applications by changing API endpoints to align with Canopy's configurations. For production environments, it’s recommended to use the provided Docker image or Gunicorn for deploying FastAPI applications efficiently.
Securing the server with authentication mechanisms is crucial when handling sensitive authentication credentials to prevent unauthorized access.
In summary, Canopy is a powerful tool designed to enhance interaction with text data, making advanced RAG workflows accessible and scalable. Whether you're developing a simple chatbot or a complex data-driven application, Canopy offers the tools and flexibility needed to succeed.