Skip to content

Latest commit

 

History

History
156 lines (118 loc) · 6.95 KB

README.md

File metadata and controls

156 lines (118 loc) · 6.95 KB

Meta Expert

A project for versatile AI agents that can run with proprietary models or completely open-source. The meta expert has two agents: a basic Meta Agent, and Jar3d, a more sophisticated and versatile agent.

Table of Contents

  1. Core Concepts
  2. Prerequisites
  3. Repository Setup
  4. API Key Configuration
  5. Basic Meta Agent Setup
  6. Jar3d Setup
  7. Working with Ollama
  8. On the Roadmap for Jar3d

Core Concepts

This project leverages three core concepts:

  1. Meta prompting: For more information, refer to the paper on Meta-Prompting (source). Read our notes on Meta-Prompting Overview for a more concise overview.
  2. Chain of Reasoning: For Jar3d, we also leverage an adaptation of Chain-of-Reasoning
  3. Jar3d uses retrieval augmented generation, which isn't used within the Basic Meta Agent. Read our notes on Overview of Agentic RAG.

Prerequisites

Environment Setup

  1. Install Anaconda:
    Download Anaconda from https://www.anaconda.com/.

  2. Create a Virtual Environment:

    conda create -n agent_env python=3.11 pip
  3. Activate the Virtual Environment:

    conda activate agent_env

Repository Setup

  1. Clone the Repository:

    git clone https://github.com/brainqub3/meta_expert.git
  2. Navigate to the Repository:

    cd /path/to/your-repo/meta_expert
  3. Install Requirements:

    pip install -r requirements.txt

API Key Configuration

  1. Open the config.yaml file:

    nano config.yaml
  2. Enter API Keys:

Setup for Basic Meta Agent

The basic meta agent is an early iteration of the project. It demonstrates meta prompting rather than being a useful tool for research. It uses a naive approach of scraping the entirety of a web page and feeding that into the context of the meta agent, who either continues the task or delivers a final answer.

Run Your Query in Shell

python -m agents.meta_agent

Then enter your query.

Setup for Jar3d

Jar3d is a more sophisticated agent that uses RAG, Chain-of-Reasoning, and Meta-Prompting to complete long-running research tasks.

Note: Currently, th best results are with Claude 3.5 Sonnet and Llama 3.1 70B. Results with GPT-4o are inconsistent

Try Jar3d with:

  • Writing a newsletter - Example
  • Writing a literature review
  • As a holiday assistant

Jar3d is in active development, and its capabilities are expected to improve with better models. Feedback is greatly appreciated.

Jar3d is capable of running 100% locally. However, the setup itself is non-trivial. There are two components to set up:

  1. The nlm-ingestor server
  2. Running the application

1. Setting up the NLM-Ingestor Server

Running Jar3d requires you to set up your own backend server to run the document parsing. We leverage the nlm-ingestor and llm-sherpa from NLMatics to do this.

The nlm-ingestor uses a modified version of Apache Tika for parsing documents. The server will be deployed locally on whatever machine you run the Docker image.

The server provides an easy way to parse and intelligently chunk a variety of documents including "HTML", "PDF", "Markdown", and "Text". There is an option to turn on OCR; check out the docs.

Setup Steps

  1. Ensure you have Docker installed on your machine. Once installed, ensure you have started the Docker daemon.

  2. Next, pull the Docker image from nlmatics:

    docker pull jamesmtc/nlm-ingestor:latest

    Note this version of the docker image is unofficial, it is being used as a stop-gap until the library authors fix bugs in the official version

  3. Once you have pulled the image, you can run the container:

    docker run -p 5010:5001 jamesmtc/nlm-ingestor:latest
  4. Navigate to config/config.yaml and check that the LLM_SHERPA_SERVER variable is exactly like this:

    http://localhost:5010/api/parseDocument?renderFormat=all
    

    Note: You can change the port mapping from 5010 to whatever mapping you want. You must ensure that it is consistent with the mapping you select in the docker run command.

  5. Once you're ready, you can kickstart the Jar3d web-app by running the following from the meta_expert directory.

    chainlit run chat.py

    Note that you will need to ensure that you uncomment the relevant agent_kwargs in the chat.py script

  6. There is a CLI version of Jar3d you can run if you would prefer to. Simply run the following command from the meta_expert directory.

    python -m agents.jar3d

    Note that you will need to ensure that you uncomment the relevant agent_kwargs in the jar3d.py script

Interacting with Jar3d

Once you're setup, Jar3d will proceed to introduce itself and ask some questions. The questions are designed to help you refine your requirements. When you feel you have provided all the relevant information to Jar3d, you can end the questioning part of the workflow play typing /end.

If you want to work with Ollama

Setup Ollama Server

  1. Download Ollama: Download from https://ollama.com/download

  2. Download an Ollama Model:

    curl http://localhost:11434/api/pull -d "{\"name\": \"llama3\"}"

For more information, refer to the Ollama API documentation.

On the Roadmap for Jar3d

  • Feedback to Jar3d so that final responses can be iterated on and amended.
  • Long term memory.
  • Frontend.
  • Integrations to RAG platforms for more intelligent document processing and faster RAG.