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.
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.
- Project Setup Instructions
- Setting Up the LLM
- Getting Ready to use ReActXen
- Hello Word ReActXen
- API Functions
- Publications
To get started with this project, follow these steps:
-
Clone the repository:
git clone [email protected]:GenAIApps/ReActXen.git cd reactxen
-
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
-
Install the required dependencies: Simply run the following command to install the package and its dependencies:
pip install .
-
If you need to clean or remove the Python virtual environment (
reactxen
), follow these steps:deactivate rm -rf reactxen
-
Setting Up Environment Variables. Copy the
.env_template
file to.env
:cp env/.env_template .env
-
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
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.
-
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
-
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