/INSIGHT

INSIGHT is an autonomous AI that can do medical research!

Primary LanguagePythonApache License 2.0Apache-2.0

INSIGHT

Insight is an autonomous AI that can do medical research. It has a boss agent that takes an objective and an executive summary of the tasks completed already and their results and creates a task list. A worker agent picks up a task from the list and completes it, saving the results to llama index. The boss gets informed of the results and changes/reprioritizes the task list. The workers can call into the pubmed and mygene APIs (more to come). The workers also get context from llama index to help complete their tasks.

Very much a work in progress, but it is showing some early results!

Please reach out to me or contribute if this interests you :)

graph TB;

    subgraph APIs;
        API1[PUBMED API];
        API2[MYGENE API];
    end;

    Boss((BOSS AGENT)) <--> GPT[LLM];
    Llama[(LLAMA INDEX)] -->|Summary of results| Boss;
    Boss -->|Create| Queue[TASK LIST];

    Worker((WORKER AGENT)) <--> GPT;
    Queue --> |Pull| Worker;
    Llama -->|Context for task| Worker;
    Worker --> Result[Task Result];

    Result --> |Text| Llama;
    Result -->|Code| Executor{PYTHON EXECUTOR};

    Executor --> API1[PUBMED];
    Executor --> API2[MYGENE];
    Executor --> Execution[Execution Result];

    Execution --> Llama;
Loading

Getting Started

  1. Sign up for OpenAI

  2. Expose the following environment vars

    • EMAIL
    • OPENAI_API_KEY
    • OPENAI_ORG
  3. run pip install -r requirements.txt

  4. run python main.py

BE MINDFUL OF EXPENSES!!

Currently an execution for a few minutes should cost no more than a few cents. This will go up if you use a more powerful model like GPT-4

NOTE:

At the bottom of the main.py loop there is a break statement to safeguard against the loop running forever.

if task_id_counter > MAX_ITERATIONS:
    break

Output will be saved in ./out

TODOs

Expand APIs

  • more useful examples
  • different APIs
  • NOTE: prompt space is out most scarce commodity. Be as terse as possible and be careful not to add redundancies

Implement token limit constraints

  • currently it's possible to pass an agent a prompt with say 4096 tokens, leaving it space for only one single token for its completion. This should be fixed, but whatever error is passed should be propagated and fixed gracefully

Allow way to reload program from saved state

Implement logging

  • Ideally the output of every run should be saved to its own log file