Skip to content

IBM/ReActXen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReAct eXtENded Agent Design (ReActXen)

This repository contains the implementation of the ReActXen framework, focused on agent-based design and interaction. It has been referred to as ReAct++, Enhanced ReAct, etc.

Overview

The ReActXen framework is built on the Agent-Family that has multiple helper agents as outlined in the following diagram. The ReAct agent supports both text generation and code generation based on the specified action.

Table of Contents

Project Setup Instructions

To get started with this project, follow these steps:

  1. Clone the repository:

    git clone [email protected]:GenAIApps/ReActXen.git
    cd reactxen
  2. Set up a Python virtual environment (Python 3.11 or greater is required):

    python3.11 -m venv reactxen
    source reactxen/bin/activate  # On macOS/Linux
    # .\\reactxen\\Scripts\\activate  # On Windows
  3. Install the required dependencies: Simply run the following command to install the package and its dependencies:

    pip install .
  4. If you need to clean or remove the Python virtual environment (reactxen), follow these steps:

    deactivate
    rm -rf reactxen

Getting Ready to use ReActXen

  1. Setting Up Environment Variables. Copy the .env_template file to .env:

    cp env/.env_template .env
  2. Edit the .env file and replace the placeholders with your actual values:

    WATSONX_APIKEY=your_watsonx_apikey
    WATSONX_URL=https://your-watsonx-url.com
    WATSONX_PROJECT_ID=your_project_id

Hello World ReActXen

In the hello_world_math.py demo, the ReActXen framework is used to solve the following mathematical equation:

Question: Find the (r) that satisfies the equation:

[ \log_{16} (r+16) = \frac{5}{4} ]

The question asks the agent to find the value of (r) that satisfies the logarithmic equation.

  1. Execute the demo script (id 14 = granite 3.2 preview)

    cd src/reactxen/demo
    python hello_world_math.py --mode code --model_id 14 # for code model
    python hello_world_math.py --mode text --model_id 14 # for text model

API Functions

  • create_reactxen_agent
    Description: Initializes and configures a ReActXen agent.
    Example Usage:

    agent = create_reactxen_agent(question="Find the r...", key="", ...)
  • run_reactxen_agent Description: Runs the agent and returns the result. Example Usage:

    agent.run()

    You can view the review agent output here: Review

  • export_benchmark_metric Description: Exports benchmark metrics from the agent's run. Example Usage:

    agent.export_benchmark_metric()

    You can view the benchmark metric here: Benchmark

  • export_trajectory Description: Exports the trajectory of the agent's decisions. Example Usage:

    agent.export_trajectory()

    You can view the sample exported trajectory here: Trajectory

About

This is a base-react agent for AssetOpsBench

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages