A sophisticated implementation of the ReAct (Reasoning + Acting) agent pattern using LangChain, designed for string length calculations with high accuracy and reliability.
- Features
- Technologies
- Getting Started
- Project Structure
- Usage
- Testing
- Contributing
- Authors
- Acknowledgments
- Advanced ReAct agent implementation with LangChain
- High-precision string length calculation
- Robust error handling and validation
- Environment-based configuration management
- Comprehensive logging system
- Extensive test coverage
- Python 3.8+
- LangChain Framework
- OpenAI GPT Models
- pytest for Testing
- python-dotenv for Configuration
- Python 3.8 or higher
- OpenAI API key
- Git
- Clone the repository:
git clone https://github.com/redrussianarmy/react-agent-calculator.git
cd react-agent-calculator- Create and activate virtual environment:
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt- Configure environment:
cp .env.example .env
# Edit .env with your OpenAI API keyreact-agent-calculator/
├── src/
│ ├── agents/ # Agent implementation
│ ├── tools/ # Utility tools
│ └── utils/ # Helper functions
├── tests/ # Test suite
├── .env # Environment configuration
├── main.py # Entry point
└── requirements.txt # Dependencies
from src.agents.react_agent import ReActAgent
from src.agents.config import AgentConfig
# Configure agent
config = AgentConfig(
model_name="gpt-3.5-turbo",
temperature=0.7
)
# Initialize and run
agent = ReActAgent(config)
result = agent.run("Calculate length: 'Hello, World!'")
print(result)Run tests:
# All tests
pytest
# With coverage
pytest --cov=src tests/- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push branch (
git push origin feature/amazing-feature) - Open Pull Request
- Hakan BOGAN - Initial work and maintenance
- LangChain team for the excellent framework
- OpenAI for providing powerful language models
- Open source community for inspiration and support
This project is currently unlicensed.