Metadata-Version: 2.4
Name: jax-gemini
Version: 0.1.1
Summary: Natural language-driven JAX/Flax model building powered by Gemini
Project-URL: Homepage, https://github.com/wkambale/jax-gemini
Project-URL: Documentation, https://wkambale.github.io/jax-gemini
Project-URL: Repository, https://github.com/wkambale/jax-gemini
Project-URL: Issues, https://github.com/wkambale/jax-gemini/issues
Project-URL: Changelog, https://github.com/wkambale/jax-gemini/blob/main/CHANGELOG.md
Author-email: Wesley Kambale <spartanwk@gmail.com>
License: MIT License
        
        Copyright (c) 2026 Wesley Kambale
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: ai,flax,gemini,jax,machine-learning,natural-language,neural-networks
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Requires-Dist: flax>=0.9.0
Requires-Dist: google-generativeai>=0.8.0
Requires-Dist: jax>=0.4.25
Requires-Dist: numpy>=1.24.0
Requires-Dist: optax>=0.2.0
Requires-Dist: orbax-checkpoint>=0.6.0
Provides-Extra: dev
Requires-Dist: hatch; extra == 'dev'
Requires-Dist: mypy>=1.9.0; extra == 'dev'
Requires-Dist: pre-commit; extra == 'dev'
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.4.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.24.0; extra == 'docs'
Provides-Extra: gpu
Requires-Dist: jax[cuda12]; extra == 'gpu'
Provides-Extra: tpu
Requires-Dist: jax[tpu]; extra == 'tpu'
Description-Content-Type: text/markdown

<div align="center">
  <h1>Jax-Gemini</h1>
  <p><b>Natural language-driven JAX/Flax model building powered by Google Gemini.</b></p>
  
  [![PyPI version](https://img.shields.io/pypi/v/jax-gemini.svg)](https://pypi.org/project/jax-gemini/0.1.0/)
  [![Python Versions](https://img.shields.io/pypi/pyversions/jax-gemini.svg)](https://pypi.org/project/jax-gemini/0.1.0/)
  [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
</div>

<br/>

`jax-gemini` is a Python library that allows AI/ML practitioners, researchers, and domain experts to build, train, evaluate, and snapshot JAX/Flax neural network models using conversational plain English prompts without writing JAX boilerplate code.

Unlike traditional descriptive LLM wrappers, **jax-gemini returns real, executable Python/JAX `flax.nnx.Module` objects**. Your prompts dictate instructions; Gemini generates the respective code; jax-gemini runs it securely inside a sandboxed namespace and hands the resulting object back to you.

## Features

- **Real Objects, Not Text**: Every operation yields a genuine Python object (e.g. `flax.nnx.Module`), trained weights, or dictionaries natively integrated with JAX environments.
- **Conversational Memory**: Retains the context of modifications multi-turn iteratively. Add dropout layers, reshape variables or tweak hyper-parameters step-by-step.
- **Safe Execution by Default**: All parsed LLM code generation is restricted through an AST Abstract Syntax Tree Validator restricting arbitrary script execution and imports. 
- **Auto-Healing**: Encountering exceptions? jax-gemini features an adaptive auto-correction mechanism which relays failed code and Python tracebacks directly back to Gemini for automatic pipeline repair.

## Quickstart

### Installation

Install via [PyPI](https://pypi.org/project/jax-gemini/0.1.0/):
```bash
pip install jax-gemini
```

Setup your [Gemini API Key](https://aistudio.google.com/):
```bash
export GEMINI_API_KEY="your-api-key-here"
```

### Conversational Model Building

```python
import jax_gemini as jg
import numpy as np

# Note: jg automatically picks up GEMINI_API_KEY from env
jg.config.set({"model_name": "gemini-3.1-pro"})

# Build a model exclusively purely from text
model = jg.build("Build a 4-layer MLP for handwritten digit classification")

# Refine the architecture interactively
model = jg.modify("Ah, wait, add dropout with rate 0.2 between each layer for regularization")

# Train your model
X_train = np.random.randn(100, 28, 28, 1).astype(np.float32)
y_train = np.random.randint(0, 10, size=(100,))

model, metrics = jg.train(
    "Train for 10 epochs with Adam optimizer and Cross Entropy Loss",
    dataset=(X_train, y_train)
)
print(f"Accuracy: {metrics['accuracy']:.2%}")

# Checkpoint Persistence
checkpoint_path = jg.save("digit_classifier_v1")
```

See [examples/](examples/) for more comprehensive workflows such as Jupyter Notebook deployments end-to-end setups.

## Documentation
- [Quickstart Guide](docs/quickstart.md): Extensive introduction and core philosophies.
- [API Reference](docs/api-reference.md): Detailed API coverage and methods parameters.
- [Architecture Insights](docs/architecture.md): Design elements under the hood. 
- [Security Protocol](docs/security.md): Code validation and restricted runtime policies.

## License and Contributing
This repository thrives on community input. Check out our [Contribution Guidelines](CONTRIBUTING.md) to log issues or prepare Pull Requests.

Distributed under the **MIT License**. See `LICENSE` for more information.
