Skip to main content

Multi-agent system for data analysis, made by cosmologists, powered by autogen.

Project description

cmbagent

PyPI versionLicense Documentation Status

Multi-agent system for data analysis, made by cosmologists, powered by autogen.

Note: This software is under MIT license. We bear no responsibility for any misuse of this software or its outputs.

See our examples here to have a preview of our work.

Contributed by:

  • Boris Bolliet (Cambridge)
  • Andrew Laverick (Independent)
  • Inigo Zubeldia (Cambridge)
  • Kristen Surrao (Columbia)
  • Miles Cranmer (Cambridge)
  • Antony Lewis (Sussex)
  • Blake Sherwin (Cambridge)
  • Julien Lesgourgues (Aachen)

Installation

To install cmbagent, follow these steps:

Clone and install our package from the cmbagent repository:

pip install cmbagent

Before pip installing cmbagent, creating a virual environment is envouraged:

python -m venv /path/to/your/envs/cmbagent_env
source /path/to/your/envs/cmbagent_env/bin/activate

You can then pip install cmbagent in this fresh environment.

Structure

RAG agents are defined in a generic way. The core of the code is located in cmbagent.py.

To generate a RAG agent, create a .py and .yaml file and place them in the assistants directory. Additionally, create a directory named after the agent and include associated files in the data directory of cmbagent.

Apart from the RAG agents, we have assistant agents (engineer and planner) and a code agent (executor).

Agents

All agents inherit from the BaseAgent class. You can find the definition of BaseAgent in the base_agent.py file.

Usage

Before you can use cmbagent, you need to set your OpenAI API key as an environment variable:

For Unix-based systems (Linux, macOS):

export OPENAI_API_KEY="sk-..."

(paste in your bashrc or zshrc file, if possible.)

For Windows:

setx OPENAI_API_KEY "sk-..."

You can also pass your API key to cmbagent as an argument when you instantiate it:

cmbagent = CMBAgent(llm_api_key="sk-...")

Instantiate the CMBAgent with:

from cmbagent import CMBAgent
cmbagent = CMBAgent(verbose=True)

Define a task as:

task = """
       Get cosmological parameter values from Planck 2018 analysis of TT,TE,EE+lowE+lensing with the Plik likelihood in LCDM. 
       Use Cobaya with Classy_SZ to evaluate the ACT DR6 lensing likelihood for sigma8=0.8 and Omega_m=0.31. Other parameters set to Planck 2018.  
       To set Omega_m, adjust the value of omch2. 
       Give me the value of log-likelihood.
       """

Solve the task with:

cmbagent.solve(task)

If you request any output, it will be saved in the output directory.

Show the plot with:

cmbagent.show_plot("cmb_tt_power_spectrum.png")

Restore session with:

cmbagent.restore()

Push vector stores of RAG agents into the OpenAI platform:

cmbagent = CMBAgent(make_vector_stores=True)

Push selected vector stores of RAG agents into the OpenAI platform:

cmbagent = CMBAgent(make_vector_stores=['act', 'camb'])

Start session with only a subset of RAG agents:

cmbagent = CMBAgent(agent_list=['classy', 'planck'])

Show allowed transitions:

cmbagent.show_allowed_transitions()

cmbagent uses cache to speed up the process and reduce costs when asking the same questions. When developing, it can be useful to clear the cache. Do this with:

cmbagent.clear_cache()

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

cmbagent-0.0.0b6.tar.gz (28.5 kB view details)

Uploaded Source

Built Distribution

cmbagent-0.0.0b6-py3-none-any.whl (37.8 kB view details)

Uploaded Python 3

File details

Details for the file cmbagent-0.0.0b6.tar.gz.

File metadata

  • Download URL: cmbagent-0.0.0b6.tar.gz
  • Upload date:
  • Size: 28.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for cmbagent-0.0.0b6.tar.gz
Algorithm Hash digest
SHA256 d5409064488e904d326a97a069e7977267f6907b48d34f3a1fddc994fe5a483e
MD5 b2c3ba2a66cdf705b27ce2ff02ea24e8
BLAKE2b-256 6dc1870e00d28a4a176c693a35b8a64ecc5d6eed5126c99b5a44542f621ca4b8

See more details on using hashes here.

File details

Details for the file cmbagent-0.0.0b6-py3-none-any.whl.

File metadata

  • Download URL: cmbagent-0.0.0b6-py3-none-any.whl
  • Upload date:
  • Size: 37.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for cmbagent-0.0.0b6-py3-none-any.whl
Algorithm Hash digest
SHA256 2d52ec4e4be1bfcbedb77fa8d850468a89950427d1190c15671973ea9e0afb4e
MD5 997a00c17f75e811e22963ddb13f1a30
BLAKE2b-256 2b2c31dc3e24413cf1cfec21c06b2a66ead6abda6dc56a6ef8d3b0828f5cb09e

See more details on using hashes here.

Supported by

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