Skip to main content

SciBORG: A framework for building agents that automate scientific discovery

Project description

SciBORG

SciBORG Banner Image

SciBORG is an innovative framework designed for building agents that can rapidly automate scientific discovery. It's built to be modular, extensible, and easy to integrate with new components and agents, making it suitable for diverse research domains.

This framework allows for smooth integration of various AI agents, each customizable to specific tasks, making it ideal for research labs, academic institutions, and organizations focusing on scientific discovery. By leveraging SciBORG, teams can automate complex workflows, empowering researchers to focus on innovative thinking and problem-solving.

Task:(some tracking tags go here)

Key Features

  • Modular Design: Easily add, replace, or upgrade agents as per project needs.
  • Extensible Framework: Integrate new components effortlessly.
  • Agent Library: Ready-to-use agents like the RAG agent, which supports retrieval-augmented generation for scientific Q&A tasks.
  • Benchmarking and Testing: Built-in benchmarking tools to ensure reliability and effectiveness of each agent.

Quick Start Guide

Pre-requisites

For compatibility, it's recommended to use a virtual environment with Python 3.10. Follow these steps to set it up:

python3.10 -m venv sciborg-env
source sciborg-env/bin/activate

Installation

To install the SciBORG agent, clone the repository and install the dependencies using the following commands:

git clone https://github.com/chopralab/sciborg.git
cd sciborg
pip install -r requirements.txt

Testing the Installation

Test the installation by running the following command:

import os
os.environ['OPENAI_API_KEY'] = "<YOUR_API_KEY_HERE>"

import sys
sys.path.insert(1, "path to the parent of this folder") 

from langchain_openai import ChatOpenAI
from sciborg.ai.agents.core import create_sciborg_chat_agent
from sciborg.ai.chains.microservice import module_to_microservice
from sciborg.ai.chains.workflow import create_workflow_planner_chain, create_workflow_constructor_chain

from sciborg.utils.drivers import MicrowaveSynthesizer, MicrowaveSynthesizerObject, PubChemCaller
from sciborg.core.library.base import BaseDriverMicroservice

If the above command runs without any errors, the installation was successful and the SciBORG agent is ready to use.

Directory Structure

If the installation was successful, the directory structure should look like this:

sciborg/
  sciborg/          # Main package (installed via pip)
    ai/             # AI agents, chains, memory, prompts, schema, tools
    core/           # Core infrastructure (commands, library, parameters, workflows)
    utils/          # Utilities (benchmarking, example drivers)
    embeddings/     # Embeddings data
  notebooks/        # Example notebooks (not in package)
  tests/            # Test suite (not in package)
  README.md
  requirements.txt
  pyproject.toml

Directory Structure Explanation:

  • sciborg/ai/: Contains implementations of various AI agents that drive SciBORG's functionality, including the RAG agent and other pre-built agents.
  • sciborg/core/: The core logic and infrastructure that powers SciBORG, including utilities for agent management, execution, and task orchestration.
  • sciborg/embeddings/: Stores embeddings data used for document similarity and context retrieval.
  • sciborg/utils/: Utility scripts and helper functions that support various tasks across SciBORG, like benchmarking. Also contains example drivers in sciborg/utils/drivers/.
  • notebooks/: Jupyter notebooks providing tutorials, demos, and examples for using SciBORG agents. This folder is highly recommended for new users to understand SciBORG's capabilities.
  • tests/: All testing code including unit tests and integration tests.

Creating Agents

Making the microservice for the agents

Microwave Synthesizer microservice

file_path = 'path_to_json/driver_MicroSynth.json'

driver_command_microservice = module_to_microservice(MicrowaveSynthesizer)

with open(file_path, 'w') as outfile:
    outfile.write(driver_command_microservice.model_dump_json(indent=2))

PubChem microservice

file_path = 'path_to_json/driver_pubchem.json'

pubchem_command_microservice = module_to_microservice(PubChemCaller)

with open(file_path, 'w') as outfile:
    outfile.write(pubchem_command_microservice.model_dump_json(indent=2))

RAG Agent

The RAG Agent (Retrieval-Augmented Generation) is used for answering scientific questions based on provided context. To use the RAG agent, run the following command:

rag_agent = create_sciborg_chat_agent(
    microservice=driver_command_microservice,
    rag_vectordb_path = '<path>/embeddings/NIH_docs_embeddings',
    llm=ChatOpenAI(model='gpt-4'),
    human_interaction=False,
    verbose=True
)

Pubchem Agent

pubchem_agent = create_sciborg_chat_agent(
    microservice=pubchem_command_microservice,
    llm=ChatOpenAI(model='gpt-4'),
    human_interaction=False,
    verbose=True
)

PubChem and RAG Agent

pubchem_and_rag_agent = create_sciborg_chat_agent(
    microservice=pubchem_command_microservice,
    rag_vectordb_path = '<path>/embeddings/NIH_docs_embeddings',
    llm=ChatOpenAI(model='gpt-4'),
    human_interaction=False,
    verbose=True
)

What do these paramaters mean?

  • microservice: The microservice that the agent will use to interact with external services or APIs.
  • rag_vectordb_path: The path to the document embeddings used by the RAG agent for context retrieval.
  • llm: The language model used by the agent for generating responses. In this case, it's the GPT-4 model.
  • human_interaction: A boolean flag to enable or disable human interaction with the agent.

For detailed demonstrations and examples, refer to the Jupyter notebooks notebooks/SI/SI_traces_01.ipynb and notebooks/SI/SI_traces_02.ipynb in the repository. Task: link the folder to the notebooks

Benchmarking the Agents

SciBORG includes benchmarking scripts to evaluate the performance of each agent. There are three ways to benchmark the agents:

  • State Based Benchmarking
  • Path Based Benchmarking
  • RegEx Based Benchmarking

For additional details on benchmarking and usage, refer to the notebooks/SI/SI_benchmarks_01.ipynb, notebooks/SI/SI_benchmarks_02.ipynb and notebooks/SI/SI_benchmarks_03.ipynb notebooks. Task: link the folder to the notebooks

Additional Resources (adding soon...)

Explore additional details on extending SciBORG's functionality with custom integrations:

  • Creating Custom Integrations: Learn how to add new agents to SciBORG, configure workflows, and customize agents for specific needs. (add in readme file to help do this)
  • Adding Custom Document Embeddings: Understand how to integrate different embeddings for specialized document types or formats. (add in a readme file and a code file to help do this)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sciborg_async-1.0.0.tar.gz (67.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sciborg_async-1.0.0-py3-none-any.whl (87.6 kB view details)

Uploaded Python 3

File details

Details for the file sciborg_async-1.0.0.tar.gz.

File metadata

  • Download URL: sciborg_async-1.0.0.tar.gz
  • Upload date:
  • Size: 67.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.10

File hashes

Hashes for sciborg_async-1.0.0.tar.gz
Algorithm Hash digest
SHA256 c880ca9f112314726c278d0a52cc85511e1f54beb59c866056ef25d17c2951b6
MD5 3a41620576a0f8ebbfa2debd43243ac6
BLAKE2b-256 9575d3762ed86348934266650b1daf423a3a545d156d27c60e740a6a7c8ab6a0

See more details on using hashes here.

File details

Details for the file sciborg_async-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: sciborg_async-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 87.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.10

File hashes

Hashes for sciborg_async-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee7bacd58f936ed91b83d9c39e808789f950d5277f45b9fc1f24ebcb316cb97c
MD5 7a060099c8d03268961bb7d639373788
BLAKE2b-256 73bb3b82bd677c505c850c0fd59f2fc8b4017a6bcc3df4458477617356f9ab46

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page