Metadata-Version: 2.4
Name: bio-reasoning
Version: 0.1.0
Summary: Biological Reasoning System
Author-email: Thomas Brettin <brettint@gmail.com>, Peng Ding <oaklight@gmx.com>
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: openai>=1.79.0
Requires-Dist: cicada-agent>=0.7.4
Requires-Dist: loguru>=0.7.3
Requires-Dist: httpx>=0.28.1
Requires-Dist: toolregistry>=0.4.12
Requires-Dist: python-dotenv>=1.1.0
Provides-Extra: dev
Requires-Dist: pyright>=1.1.402; extra == "dev"
Requires-Dist: ruff>=0.12; extra == "dev"
Requires-Dist: build>=1.2.2.post1; extra == "dev"
Requires-Dist: twine>=6.1.0; extra == "dev"

# Biological Reasoning Framework

A three-layer artificial intelligence architecture designed to emulate biological reasoning, following the principles outlined in "Biological Reasoning for Advanced AI: A Layered Architecture Approach".

## Architecture Overview

The system consists of three main layers:

1. **Layer A (Parametric Memory)**

   - General-purpose language model interface
   - Stores and retrieves broad biological knowledge
   - Natural language processing capabilities

2. **Layer B (Bespoke Foundation Models)**

   - Specialized modules for biological data analysis
   - Genomic sequence analysis
   - Imaging analysis
   - Integration with language models

3. **Layer C (External Knowledge Repositories)**
   - Integration with external databases and APIs
   - OpenTargets database integration
   - Literature search capabilities

## Reasoning Modes

The system supports multiple biological reasoning modes:

- Phylogenetic Reasoning: Uses evolutionary relationships (via genetic or phenotypic comparisons) to infer common ancestry, divergence, and the historical origins of traits. It relies on sequence alignments, phylogenetic trees, and taxonomic data to transfer knowledge among organisms.
- Teleonomic Reasoning: Explains traits in terms of their purpose or function—that is, how a trait may confer a fitness advantage. It connects observed biological features with their adaptive benefits, often drawing on well‐documented case studies (e.g., beak shapes in finches).
- Mechanistic Reasoning: Focuses on the cause‐and‐effect processes underlying biological functions. It breaks down complex phenomena (e.g., metabolic pathways, signal transduction, muscle contraction) into component interactions and causal chains to explain 'how' a process works.
- Tradeoff Reasoning:
- Systems Reasoning:
- Spatial Reasoning:
- Temporal Reasoning:
- Homeostatic Reasoning: 
- Ontogenetic Reasoning: 
- Comparative Reasoning: 
- (Additional modes can be added following the same pattern)

## Installation

1. Clone the repository:

   ```bash
   git clone https://github.com/yourusername/biological-reasoning.git
   cd biological-reasoning
   ```

2. Install dependencies:

   ```bash
   pip install .
   ```

3. Set up environment variables:

   ```bash
   cp .env.example .env
   # Edit .env with your API keys and configuration
   ```

## Usage

### Command Line Interface

Run the CLI in interactive mode:

```bash
python -m bio_reasoning.cli
```

Or process a specific query:

```bash
python -m bio_reasoning.cli --query "What is the function of TP53?"
```

### Python API

```python
from bio_reasoning.coordinator import BiologicalReasoningCoordinator

# Initialize the coordinator
coordinator = BiologicalReasoningCoordinator()

# Process a query
result = coordinator.process_query("What is the function of TP53?")
print(result)
```

## Project Structure

```
bio_reasoning/
├── layers/
│   ├── layer_a.py      # Parametric Memory implementation
│   ├── layer_b.py      # Bespoke Foundation Models
│   └── layer_c.py      # External Knowledge Repositories
├── reasoning/
│   └── reasoning_modes.py  # Biological reasoning modes
├── coordinator.py      # Main system coordinator
└── cli.py             # Command-line interface
```

## Development

To add new reasoning modes:

1. Create a new class in `reasoning_modes.py` that inherits from `ReasoningMode`
2. Implement the `reason` method
3. Add the new mode to the `reasoning_modes` dictionary in `coordinator.py`

## Testing

Run the test suite:

```bash
pytest tests/
```

## License

MIT License

## Contributing

1. Fork the repository
2. Create a feature branch
3. Commit your changes
4. Push to the branch
5. Create a Pull Request
