ReAct inspired Agent developed from scratch using Ollama. This agent uses task decomposition and uses provided tools.
Project description
MLUX-Reactly Agent Framework
A ReAct inspired Agent developed from scratch using Ollama. This agent uses task decomposition and uses provided tools.
Installation
A virtual environment is recommended:
python3 -m venv .venv
source .venv/bin/activate
From PIP
pip install mlux-reactly
From Source
pip install git+https://github.com/d-volution/mlux-reactly.git
Setting up Ollama
You also have to setup Ollama. See the README of Ollama for that.
The agent uses by default the Ollama model qwen2.5:7b-instruct-q8_0, but can be configured via the llm keyword argument.
The demo RAG-tool included within this repository uses the embedding model nomic-embed-text.
ollama pull qwen2.5:7b-instruct-q8_0
ollama pull nomic-embed-text
Usage
from typing import Annotated
from mlux_reactly import ReactlyAgent, LLM
def count_substr(a: Annotated[str, "Some string"], b: Annotated[str, "substring to be counted"]) -> int:
"""This tool calculates how often string b occures in string a"""
if not b:
return 0
return sum(1 for i in range(len(a) - len(b) + 1) if a[i:i+len(b)] == b)
agent = ReactlyAgent(tools=[count_substr], llm=LLM("qwen2.5:7b-instruct-q8_0"))
answer = agent.query("How many times does the letter l occure in 'artificial general intelligence'?")
print(f"agent answer: {answer}")
When running from Git Repo
Run simple chatbot
python3 test/chat.py
Evaluation
To evaluate the agent, you can use eval.py like this:
python3 test/eval.py -agents <agent names> -tests <test names with test params>
For example, use
python3 test/eval.py -agents reactly llama-react -tests hotpot/train:100:3
to run the 'hotpot' test with the examples from index 100 to 103 on both the Reactly and the Llama-ReAct agents.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mlux_reactly-0.1.tar.gz.
File metadata
- Download URL: mlux_reactly-0.1.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51464cf3f30feaef56ed8189518e5bf6b6f470dad9cd8a3e08baaf254595f12b
|
|
| MD5 |
b86c6129c479230f6650c851899ebc4c
|
|
| BLAKE2b-256 |
114cce505695858964f8f4d5057f3ee2a5841070b811fee4cf9a8e54a289902f
|
File details
Details for the file mlux_reactly-0.1-py3-none-any.whl.
File metadata
- Download URL: mlux_reactly-0.1-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61d41792afdec9f092486cbf9b0bf25ade7c79b014d0544462ff728df3753f00
|
|
| MD5 |
27d5dcf343c5c528c187128458e47939
|
|
| BLAKE2b-256 |
a022aa3a698d64ed3e3dbf4205eec5d01d8cc50f78cd32bd85498599f55b22aa
|