Metadata-Version: 2.3
Name: dspy-react-machina
Version: 0.1.1
Summary: Alternative ReAct implementation for DSPy with full conversation history
Keywords: dspy,react,llm,agent,state-machine,conversation
Author: Arthur Moura Carvalho
Author-email: Arthur Moura Carvalho <armoucar@gmail.com>
License: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Dist: dspy>=3.0.0
Requires-Python: >=3.12
Project-URL: Homepage, https://github.com/armoucar/dspy-react-machina
Project-URL: Issues, https://github.com/armoucar/dspy-react-machina/issues
Project-URL: Repository, https://github.com/armoucar/dspy-react-machina
Description-Content-Type: text/markdown

# DSPy-ReAct-Machina

Alternative ReAct implementation for DSPy with full conversation history in a unified context.

## Installation

```bash
pip install dspy-react-machina
```

## Quick Start

```python
import dspy
from dspy_react_machina import ReActMachina

# Configure your LM
lm = dspy.LM(model="openai/gpt-4o-mini")
dspy.configure(lm=lm)

# Define tools
def get_weather(city: str) -> str:
    """Get current weather for a city"""
    return f"Weather in {city}: 72°F, sunny"

# Create agent
agent = ReActMachina("history: dspy.History, question -> answer", tools=[get_weather])

# Chat with persistent history
history = dspy.History(messages=[])

while True:
    user_input = input("You: ").strip()
    if user_input.lower() in ["quit", "exit"]:
        break

    response = agent(question=user_input, history=history)
    print(f"Agent: {response.answer}\n")

    # Update history for next turn
    history = response.history
```

## Documentation

- [Examples](examples/) - Working examples including async and instrumentation
- [Testing Conventions](tests/TESTING_CONVENTIONS.md) - Testing guidelines

## Development

### Setup

```bash
uv sync
uv run pre-commit install
```

### Code Quality

```bash
uv run quality-check  # Run all checks: ruff + pyright
```

### Testing

```bash
uv run tests                    # Run tests
uv run tests-coverage           # Run tests with coverage
uv run tests-coverage --web     # Run tests with coverage and open HTML report
```
