godaix 1.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- godaix-1.0.1/LICENSE +21 -0
- godaix-1.0.1/PKG-INFO +325 -0
- godaix-1.0.1/README.md +295 -0
- godaix-1.0.1/pyproject.toml +51 -0
- godaix-1.0.1/setup.cfg +4 -0
- godaix-1.0.1/src/godai/__init__.py +14 -0
- godaix-1.0.1/src/godai/_core.py +103 -0
- godaix-1.0.1/src/godai/aether/__init__.py +414 -0
- godaix-1.0.1/src/godai/apex/__init__.py +372 -0
- godaix-1.0.1/src/godai/aura/__init__.py +399 -0
- godaix-1.0.1/src/godai/nexus/__init__.py +352 -0
- godaix-1.0.1/src/godaix.egg-info/PKG-INFO +325 -0
- godaix-1.0.1/src/godaix.egg-info/SOURCES.txt +15 -0
- godaix-1.0.1/src/godaix.egg-info/dependency_links.txt +1 -0
- godaix-1.0.1/src/godaix.egg-info/entry_points.txt +2 -0
- godaix-1.0.1/src/godaix.egg-info/requires.txt +12 -0
- godaix-1.0.1/src/godaix.egg-info/top_level.txt +2 -0
godaix-1.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ayush Giri
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
godaix-1.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: godaix
|
|
3
|
+
Version: 1.0.1
|
|
4
|
+
Summary: Resilient AI tooling with decorators, coding analysis, provider resilience, and integrations
|
|
5
|
+
Author: Ayush Giri
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/ayushgiriai21-cmd/God
|
|
8
|
+
Project-URL: Repository, https://github.com/ayushgiriai21-cmd/God
|
|
9
|
+
Keywords: ai,llm,resilience,developer-tools
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Programming Language :: Python :: 3
|
|
13
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: rich>=13.7
|
|
18
|
+
Requires-Dist: requests>=2.31
|
|
19
|
+
Requires-Dist: python-dotenv>=1.0
|
|
20
|
+
Requires-Dist: pydantic>=2.0
|
|
21
|
+
Requires-Dist: openai>=1.0
|
|
22
|
+
Requires-Dist: anthropic>=0.30
|
|
23
|
+
Requires-Dist: google-generativeai>=0.8
|
|
24
|
+
Requires-Dist: groq>=0.6
|
|
25
|
+
Requires-Dist: flask>=3.0
|
|
26
|
+
Requires-Dist: fastapi>=0.110
|
|
27
|
+
Requires-Dist: uvicorn>=0.29
|
|
28
|
+
Requires-Dist: pytest>=7.0
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# godai
|
|
32
|
+
|
|
33
|
+
> Resilient AI tooling for healing Python calls, understanding code, surviving bad networks, and shipping developer integrations.
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
<img src="https://raw.githubusercontent.com/ayushgiriai21-cmd/God/main/assets/logo.png" alt="godai logo" width="180">
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
<p align="center">
|
|
40
|
+
<a href="https://pypi.org/project/godaix/"><img src="https://img.shields.io/pypi/v/godaix.svg" alt="PyPI version"></a>
|
|
41
|
+
<a href="https://github.com/ayushgiriai21-cmd/God/blob/main/LICENSE"><img src="https://img.shields.io/github/license/ayushgiriai21-cmd/God.svg" alt="MIT license"></a>
|
|
42
|
+
<img src="https://img.shields.io/pypi/pyversions/godaix.svg" alt="Python versions">
|
|
43
|
+
<a href="https://github.com/ayushgiriai21-cmd/God/actions"><img src="https://img.shields.io/github/actions/workflow/status/ayushgiriai21-cmd/God/publish.yml?label=Publish" alt="Publish status"></a>
|
|
44
|
+
</p>
|
|
45
|
+
|
|
46
|
+
`godai` is one installable package with four deliberately independent sub-libraries. Importing the root stays cheap: `aura`, `nexus`, `aether`, and `apex` load lazily on first access.
|
|
47
|
+
|
|
48
|
+
## What is godai?
|
|
49
|
+
|
|
50
|
+
- **Aura** provides decorators for healing, retrying, validating, tracing, caching, sandboxing, auditing, and rate-limiting Python calls.
|
|
51
|
+
- **Nexus** provides direct coding functions for explanation, structured parsing, project agents, reviews, test generation, refactoring, complexity, and security analysis.
|
|
52
|
+
- **Aether** provides resilience primitives for timeouts, circuits, offline queues, fallback providers, health checks, persistent caches, and degraded operation.
|
|
53
|
+
- **Apex** connects godai to pytest, pre-commit, GitHub Actions, web frameworks, CLI workflows, dashboards, metrics, tenants, and on-premise deployments.
|
|
54
|
+
|
|
55
|
+
The package is authored by **Ayush Giri**. The verified repository is [github.com/ayushgiriai21-cmd/God](https://github.com/ayushgiriai21-cmd/God). No separate project website URL is configured in the repository metadata; the static documentation site lives in [`docs/`](docs/).
|
|
56
|
+
|
|
57
|
+
## Dependencies
|
|
58
|
+
|
|
59
|
+
`pip install godaix` installs these dependencies together. They are normal project dependencies, not optional extras.
|
|
60
|
+
|
|
61
|
+
| Dependency | Purpose |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| `rich>=13.7` | Rich terminal output for CLI-oriented integrations. |
|
|
64
|
+
| `requests>=2.31` | HTTP transport for provider and integration calls. |
|
|
65
|
+
| `python-dotenv>=1.0` | Loading provider configuration from `.env` files. |
|
|
66
|
+
| `pydantic>=2.0` | Input/output schemas and structured parsing. |
|
|
67
|
+
| `openai>=1.0` | OpenAI SDK compatibility. |
|
|
68
|
+
| `anthropic>=0.30` | Anthropic Claude integration. |
|
|
69
|
+
| `google-generativeai>=0.8` | Google Gemini integration. |
|
|
70
|
+
| `groq>=0.6` | Groq fast-inference integration. |
|
|
71
|
+
| `flask>=3.0` | Flask middleware integration. |
|
|
72
|
+
| `fastapi>=0.110` | FastAPI middleware integration. |
|
|
73
|
+
| `uvicorn>=0.29` | ASGI serving for FastAPI-based tooling. |
|
|
74
|
+
| `pytest>=7.0` | The Apex pytest plugin and test-oriented tooling. |
|
|
75
|
+
|
|
76
|
+
## Installation
|
|
77
|
+
|
|
78
|
+
### Normal environments
|
|
79
|
+
|
|
80
|
+
Use a virtual environment, especially on Linux distributions that enforce PEP 668:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
python3 -m venv .venv
|
|
84
|
+
source .venv/bin/activate
|
|
85
|
+
python -m pip install --upgrade pip
|
|
86
|
+
python -m pip install godaix
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Windows PowerShell equivalent:
|
|
90
|
+
|
|
91
|
+
```powershell
|
|
92
|
+
py -m venv .venv
|
|
93
|
+
.venv\Scripts\Activate.ps1
|
|
94
|
+
python -m pip install godaix
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Installing on Termux (Android)
|
|
98
|
+
|
|
99
|
+
Installing directly in Termux is expected to fail when `pydantic-core` has no matching Android wheel and falls back to a Rust/maturin build. Errors commonly include `Unsupported Android architecture`. Use Ubuntu inside `proot-distro` instead:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pkg install proot-distro
|
|
103
|
+
proot-distro install ubuntu
|
|
104
|
+
proot-distro login ubuntu
|
|
105
|
+
apt update && apt upgrade -y
|
|
106
|
+
apt install -y python3 python3-pip python3-venv
|
|
107
|
+
python3 -m venv godenv
|
|
108
|
+
source godenv/bin/activate
|
|
109
|
+
pip install godaix
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
During `apt upgrade`, `tzdata` may show a timezone prompt. Select your geographic area and city when prompted. On a non-interactive setup, set `DEBIAN_FRONTEND=noninteractive` and `TZ=UTC` before the upgrade, or run `dpkg-reconfigure tzdata` later.
|
|
113
|
+
|
|
114
|
+
## Known Environment Issues
|
|
115
|
+
|
|
116
|
+
### Termux / Android
|
|
117
|
+
|
|
118
|
+
`pydantic-core` is a Rust extension and Android/Termux may not have a compatible prebuilt wheel. Maturin can report `Unsupported Android architecture`. Install through Ubuntu in `proot-distro` using the steps above; do not try to work around it by removing a required dependency.
|
|
119
|
+
|
|
120
|
+
### iSH / iPadOS terminal apps
|
|
121
|
+
|
|
122
|
+
iSH uses an Alpine/musl-based environment and often runs under x86 emulation. A matching `pydantic-core` wheel may not exist, and a usable Rust toolchain may not be available. Use a proper Linux VM/container or a cloud development environment such as GitHub Codespaces or Replit on iPad instead of installing this package directly in iSH.
|
|
123
|
+
|
|
124
|
+
### `externally-managed-environment` / PEP 668
|
|
125
|
+
|
|
126
|
+
Newer Debian and Ubuntu installations may reject system-wide pip writes. Create and activate a virtual environment first:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
python3 -m venv .venv
|
|
130
|
+
source .venv/bin/activate
|
|
131
|
+
python -m pip install godaix
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Do not remove the distribution's `EXTERNALLY-MANAGED` marker. `pip install --break-system-packages` is a last-resort system choice, not the recommended installation path.
|
|
135
|
+
|
|
136
|
+
### Rust, maturin, or missing wheel errors
|
|
137
|
+
|
|
138
|
+
On unsupported Python/platform combinations, pip may attempt to compile `pydantic-core` and fail with `cargo`, `rustc`, or `maturin` errors. Use a supported CPython release with a compatible wheel, preferably Python 3.10 or newer, and upgrade pip before retrying. The package metadata allows Python 3.9, but current `pydantic-core` releases declare Python 3.10+; Python 3.9 users may need a compatible dependency resolution or should use Python 3.10+.
|
|
139
|
+
|
|
140
|
+
### Dependency resolution conflicts
|
|
141
|
+
|
|
142
|
+
If pip reports `ResolutionImpossible`, inspect the first conflicting requirement and update pip in a fresh environment. Do not mix unrelated global packages into the install:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
python -m venv .venv
|
|
146
|
+
source .venv/bin/activate
|
|
147
|
+
python -m pip install --upgrade pip setuptools wheel
|
|
148
|
+
python -m pip install godaix
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Alpine, musl, emulated, or unusual architectures
|
|
152
|
+
|
|
153
|
+
Alpine's musl libc, iSH's emulated x86 environment, and less common CPU
|
|
154
|
+
architectures can all lack a compatible `pydantic-core` wheel. In that case
|
|
155
|
+
pip falls back to a native build even when the Python version is supported.
|
|
156
|
+
Prefer a glibc-based Ubuntu environment with CPython 3.10+ and a matching
|
|
157
|
+
wheel. If you must retry the build, make the build tools explicit first:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
python -m pip install --upgrade pip setuptools wheel
|
|
161
|
+
python -m pip install godai
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Termux package maintainers sometimes ship Rust-backed extensions as separate
|
|
165
|
+
native packages, but that does not make arbitrary pip builds on Android
|
|
166
|
+
reliable; the Ubuntu `proot-distro` route above remains the supported setup.
|
|
167
|
+
|
|
168
|
+
### TLS certificate failures
|
|
169
|
+
|
|
170
|
+
`SSLCertVerificationError`, `CERTIFICATE_VERIFY_FAILED`, and similar errors usually mean the host Python or corporate proxy lacks a trusted CA bundle. Update the operating-system CA certificates, configure the organization’s CA bundle as documented by its proxy, and retry in a fresh environment. Avoid disabling TLS verification.
|
|
171
|
+
|
|
172
|
+
### Missing provider or system dependency
|
|
173
|
+
|
|
174
|
+
Provider SDKs are installed by default, but an environment can still have a broken or incomplete installation. godai’s dependency helper raises a clear `ImportError` naming the exact command, such as `python -m pip install torch`, rather than hiding the problem behind a raw traceback. Install the named package in the active virtual environment and retry.
|
|
175
|
+
|
|
176
|
+
## Examples
|
|
177
|
+
|
|
178
|
+
Run examples from the repository root, inside an activated environment where godai is installed:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
python3 examples/aura_examples.py
|
|
182
|
+
python3 examples/nexus_examples.py
|
|
183
|
+
python3 examples/aether_examples.py
|
|
184
|
+
python3 examples/apex_examples.py
|
|
185
|
+
python3 examples/combined_examples.py
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
All five files use offline or local paths and run without an API key. The combined workflow touches all 60 public members.
|
|
189
|
+
|
|
190
|
+
## Quick Start
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
from godai import aura, nexus, aether, apex
|
|
194
|
+
|
|
195
|
+
@aura.trace
|
|
196
|
+
@aura.heal(retries=1)
|
|
197
|
+
def add(left: int, right: int) -> int:
|
|
198
|
+
return left + right
|
|
199
|
+
|
|
200
|
+
print(add(2, 3))
|
|
201
|
+
print(nexus.explain(KeyError("name")))
|
|
202
|
+
print(aether.heuristics(ZeroDivisionError()))
|
|
203
|
+
print(apex.redact("api_key=do-not-send-this"))
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## API Reference
|
|
207
|
+
|
|
208
|
+
Every public member is listed below. The static site in [`docs/`](docs/) expands each entry with an executable example taken from the repository’s example files.
|
|
209
|
+
|
|
210
|
+
### Aura
|
|
211
|
+
|
|
212
|
+
| Member | Description |
|
|
213
|
+
| --- | --- |
|
|
214
|
+
| `heal` | Diagnoses runtime exceptions, logs an explanation, retries, and re-raises after failures. |
|
|
215
|
+
| `patch` | Requests corrected Python, strips fences, validates with `ast.parse()`, and executes the replacement in a controlled namespace. |
|
|
216
|
+
| `retry` | Retries transient/network errors with exponential backoff and fails fast on logic errors. |
|
|
217
|
+
| `validate` | Validates inputs and outputs against a Pydantic model or dictionary schema. |
|
|
218
|
+
| `trace` | Logs arguments, return value, exceptions, and elapsed time. |
|
|
219
|
+
| `cache` | Memoizes results with optional whitespace-normalized semantic caching. |
|
|
220
|
+
| `async_heal` | Async-compatible healing decorator for coroutine functions. |
|
|
221
|
+
| `sandbox` | Runs a decorated function with a restricted builtins mapping. |
|
|
222
|
+
| `explain` | Adds a plain-English explanation note to raised exceptions. |
|
|
223
|
+
| `benchmark` | Measures and logs function execution timing and wrapper overhead. |
|
|
224
|
+
| `guard` | Blocks execution with a clear message when environment variables or packages are missing. |
|
|
225
|
+
| `dry_run` | Logs configured side-effect interception for safe test paths. |
|
|
226
|
+
| `audit` | Writes calls, successes, and exceptions to a JSON-lines audit file. |
|
|
227
|
+
| `fallback` | Returns a fallback function result or default after a failure. |
|
|
228
|
+
| `rate_limit` | Uses a token bucket to throttle calls and cap provider cost. |
|
|
229
|
+
|
|
230
|
+
### Nexus
|
|
231
|
+
|
|
232
|
+
| Member | Description |
|
|
233
|
+
| --- | --- |
|
|
234
|
+
| `explain` | Produces a plain-English diagnosis for an exception or traceback. |
|
|
235
|
+
| `parse` | Extracts schema-shaped values from text and validates a Pydantic model. |
|
|
236
|
+
| `agent` | Inspects a project directory and gates edits behind `allow_edits`. |
|
|
237
|
+
| `summarize` | Summarizes functions, classes, and the public shape of Python code. |
|
|
238
|
+
| `review` | Flags risky patterns in a unified diff. |
|
|
239
|
+
| `test_gen` | Generates a runnable pytest skeleton for a callable. |
|
|
240
|
+
| `docstring` | Generates a concise docstring from a function signature. |
|
|
241
|
+
| `translate` | Requests a behavior-preserving translation to another language. |
|
|
242
|
+
| `refactor` | Requests a refactor toward a stated goal after syntax validation. |
|
|
243
|
+
| `complexity` | Estimates cyclomatic complexity offline using `ast`. |
|
|
244
|
+
| `security_scan` | Flags `eval`, `exec`, and likely hardcoded secrets offline. |
|
|
245
|
+
| `dependency_check` | Finds imports and suggests non-stdlib requirements entries. |
|
|
246
|
+
| `commit_message` | Generates a conventional commit subject from a diff. |
|
|
247
|
+
| `changelog` | Formats commit subjects into a changelog entry. |
|
|
248
|
+
| `ask` | Answers a question scoped to supplied code context. |
|
|
249
|
+
|
|
250
|
+
### Aether
|
|
251
|
+
|
|
252
|
+
| Member | Description |
|
|
253
|
+
| --- | --- |
|
|
254
|
+
| `timeout` | Enforces a hard deadline and raises `TimeoutError` promptly. |
|
|
255
|
+
| `circuit_breaker` | Tracks provider failures, opens a circuit, and fails fast during cooldown. |
|
|
256
|
+
| `offline_queue` | Persists failed JSON requests in SQLite for later replay. |
|
|
257
|
+
| `heuristics` | Diagnoses common Python exceptions without network access. |
|
|
258
|
+
| `fallback_provider` | Tries configured providers in order and returns the first success. |
|
|
259
|
+
| `degraded_mode` | Detects unavailable networking and logs an offline-mode warning. |
|
|
260
|
+
| `lazy_load` | Imports a heavy module only at first actual use. |
|
|
261
|
+
| `zero_overhead` | Benchmarks decorated fast-path overhead. |
|
|
262
|
+
| `network_probe` | Measures connection quality and recommends timeout/retry values. |
|
|
263
|
+
| `missing_dependency_helper` | Raises an exact pip command for an unavailable dependency. |
|
|
264
|
+
| `cache_store` | Provides bounded TTL disk-and-memory caching. |
|
|
265
|
+
| `debounce` | Suppresses repeated identical calls during a configured window. |
|
|
266
|
+
| `status` | Reports online, offline, degraded, or circuit-open health. |
|
|
267
|
+
| `rust_core` | Uses a future compiled extension when present and a Python reference otherwise. |
|
|
268
|
+
| `config` | Centralizes timeout, retry, circuit, and cache settings. |
|
|
269
|
+
|
|
270
|
+
### Apex
|
|
271
|
+
|
|
272
|
+
| Member | Description |
|
|
273
|
+
| --- | --- |
|
|
274
|
+
| `pytest_plugin` | Returns a pytest hook plugin that diagnoses failed tests. |
|
|
275
|
+
| `pre_commit_hook` | Reviews staged Python diffs and returns a hook status code. |
|
|
276
|
+
| `github_action` | Posts suggested fixes to GitHub using `GITHUB_TOKEN`. |
|
|
277
|
+
| `django_middleware` | Captures and diagnoses unhandled Django exceptions with guarded imports. |
|
|
278
|
+
| `flask_middleware` | Registers a Flask exception diagnosis handler. |
|
|
279
|
+
| `fastapi_middleware` | Adds FastAPI middleware that observes unhandled failures. |
|
|
280
|
+
| `cli` | Provides `godai fix`, `godai explain`, and `godai agent` commands. |
|
|
281
|
+
| `vscode_extension` | Serves a documented local JSON-RPC-style editor endpoint. |
|
|
282
|
+
| `redact` | Removes likely secrets and PII before code leaves the process. |
|
|
283
|
+
| `on_prem` | Describes self-hosted OpenAI-compatible endpoint configuration. |
|
|
284
|
+
| `multi_tenant` | Stores tenant keys, quotas, and usage counters. |
|
|
285
|
+
| `shared_cache` | Exposes a shared-backend cache adapter. |
|
|
286
|
+
| `metrics` | Produces Prometheus-compatible call counters. |
|
|
287
|
+
| `dashboard` | Renders an HTML history view from audit events. |
|
|
288
|
+
| `docker_ready` | Validates required environment variables without prompting. |
|
|
289
|
+
|
|
290
|
+
## Supported LLM Providers
|
|
291
|
+
|
|
292
|
+
Set the provider and its credential before making an online call. `offline` and `local` are safe defaults for examples.
|
|
293
|
+
|
|
294
|
+
| Provider | Environment variables |
|
|
295
|
+
| --- | --- |
|
|
296
|
+
| Anthropic Claude | `GODAI_PROVIDER=anthropic`, `ANTHROPIC_API_KEY=...` |
|
|
297
|
+
| OpenAI GPT | `GODAI_PROVIDER=openai`, `OPENAI_API_KEY=...` |
|
|
298
|
+
| Google Gemini | `GODAI_PROVIDER=gemini`, `GOOGLE_API_KEY=...` |
|
|
299
|
+
| Groq | `GODAI_PROVIDER=groq`, `GROQ_API_KEY=...` |
|
|
300
|
+
| xAI Grok | `GODAI_PROVIDER=xai`, `XAI_API_KEY=...` |
|
|
301
|
+
| Ollama | `GODAI_PROVIDER=ollama`, `OLLAMA_BASE_URL=http://localhost:11434` |
|
|
302
|
+
| Qwen | `GODAI_PROVIDER=qwen`, `DASHSCOPE_API_KEY=...` |
|
|
303
|
+
| OpenRouter | `GODAI_PROVIDER=openrouter`, `OPENROUTER_API_KEY=...` |
|
|
304
|
+
| Generic OpenAI-compatible | `GODAI_PROVIDER=openai_compatible`, `GODAI_BASE_URL=https://host/v1`, `GODAI_API_KEY=...` |
|
|
305
|
+
|
|
306
|
+
For the provider-specific cloud entries, set the provider-specific key shown
|
|
307
|
+
above. The low-level OpenAI-compatible transport sends `GODAI_API_KEY` as its
|
|
308
|
+
Bearer token, so set that shared variable as well when using `openai`, `groq`,
|
|
309
|
+
`xai`, `qwen`, or `openrouter` with the built-in HTTP transport.
|
|
310
|
+
|
|
311
|
+
Optional model and resilience settings use `GODAI_MODEL`, `GODAI_TIMEOUT`, `GODAI_RETRIES`, `GODAI_CIRCUIT_THRESHOLD`, and `GODAI_CACHE_TTL`.
|
|
312
|
+
|
|
313
|
+
## License
|
|
314
|
+
|
|
315
|
+
godai is released under the [MIT License](LICENSE).
|
|
316
|
+
|
|
317
|
+
## Contributing
|
|
318
|
+
|
|
319
|
+
Open an issue or pull request on [ayushgiriai21-cmd/God](https://github.com/ayushgiriai21-cmd/God). Keep changes focused, add or update runnable examples for public behavior, and run the offline example suite before requesting review.
|
|
320
|
+
|
|
321
|
+
## About the Author
|
|
322
|
+
|
|
323
|
+
**Ayush Giri** · GitHub: [@ayushgiriai21-cmd](https://github.com/ayushgiriai21-cmd) · Repository: [github.com/ayushgiriai21-cmd/God](https://github.com/ayushgiriai21-cmd/God)
|
|
324
|
+
|
|
325
|
+
The repository does not currently declare a separate project website URL. The local documentation website is available from [`docs/index.html`](docs/index.html).
|
godaix-1.0.1/README.md
ADDED
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
# godai
|
|
2
|
+
|
|
3
|
+
> Resilient AI tooling for healing Python calls, understanding code, surviving bad networks, and shipping developer integrations.
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="https://raw.githubusercontent.com/ayushgiriai21-cmd/God/main/assets/logo.png" alt="godai logo" width="180">
|
|
7
|
+
</p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://pypi.org/project/godaix/"><img src="https://img.shields.io/pypi/v/godaix.svg" alt="PyPI version"></a>
|
|
11
|
+
<a href="https://github.com/ayushgiriai21-cmd/God/blob/main/LICENSE"><img src="https://img.shields.io/github/license/ayushgiriai21-cmd/God.svg" alt="MIT license"></a>
|
|
12
|
+
<img src="https://img.shields.io/pypi/pyversions/godaix.svg" alt="Python versions">
|
|
13
|
+
<a href="https://github.com/ayushgiriai21-cmd/God/actions"><img src="https://img.shields.io/github/actions/workflow/status/ayushgiriai21-cmd/God/publish.yml?label=Publish" alt="Publish status"></a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+
`godai` is one installable package with four deliberately independent sub-libraries. Importing the root stays cheap: `aura`, `nexus`, `aether`, and `apex` load lazily on first access.
|
|
17
|
+
|
|
18
|
+
## What is godai?
|
|
19
|
+
|
|
20
|
+
- **Aura** provides decorators for healing, retrying, validating, tracing, caching, sandboxing, auditing, and rate-limiting Python calls.
|
|
21
|
+
- **Nexus** provides direct coding functions for explanation, structured parsing, project agents, reviews, test generation, refactoring, complexity, and security analysis.
|
|
22
|
+
- **Aether** provides resilience primitives for timeouts, circuits, offline queues, fallback providers, health checks, persistent caches, and degraded operation.
|
|
23
|
+
- **Apex** connects godai to pytest, pre-commit, GitHub Actions, web frameworks, CLI workflows, dashboards, metrics, tenants, and on-premise deployments.
|
|
24
|
+
|
|
25
|
+
The package is authored by **Ayush Giri**. The verified repository is [github.com/ayushgiriai21-cmd/God](https://github.com/ayushgiriai21-cmd/God). No separate project website URL is configured in the repository metadata; the static documentation site lives in [`docs/`](docs/).
|
|
26
|
+
|
|
27
|
+
## Dependencies
|
|
28
|
+
|
|
29
|
+
`pip install godaix` installs these dependencies together. They are normal project dependencies, not optional extras.
|
|
30
|
+
|
|
31
|
+
| Dependency | Purpose |
|
|
32
|
+
| --- | --- |
|
|
33
|
+
| `rich>=13.7` | Rich terminal output for CLI-oriented integrations. |
|
|
34
|
+
| `requests>=2.31` | HTTP transport for provider and integration calls. |
|
|
35
|
+
| `python-dotenv>=1.0` | Loading provider configuration from `.env` files. |
|
|
36
|
+
| `pydantic>=2.0` | Input/output schemas and structured parsing. |
|
|
37
|
+
| `openai>=1.0` | OpenAI SDK compatibility. |
|
|
38
|
+
| `anthropic>=0.30` | Anthropic Claude integration. |
|
|
39
|
+
| `google-generativeai>=0.8` | Google Gemini integration. |
|
|
40
|
+
| `groq>=0.6` | Groq fast-inference integration. |
|
|
41
|
+
| `flask>=3.0` | Flask middleware integration. |
|
|
42
|
+
| `fastapi>=0.110` | FastAPI middleware integration. |
|
|
43
|
+
| `uvicorn>=0.29` | ASGI serving for FastAPI-based tooling. |
|
|
44
|
+
| `pytest>=7.0` | The Apex pytest plugin and test-oriented tooling. |
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
### Normal environments
|
|
49
|
+
|
|
50
|
+
Use a virtual environment, especially on Linux distributions that enforce PEP 668:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
python3 -m venv .venv
|
|
54
|
+
source .venv/bin/activate
|
|
55
|
+
python -m pip install --upgrade pip
|
|
56
|
+
python -m pip install godaix
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Windows PowerShell equivalent:
|
|
60
|
+
|
|
61
|
+
```powershell
|
|
62
|
+
py -m venv .venv
|
|
63
|
+
.venv\Scripts\Activate.ps1
|
|
64
|
+
python -m pip install godaix
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Installing on Termux (Android)
|
|
68
|
+
|
|
69
|
+
Installing directly in Termux is expected to fail when `pydantic-core` has no matching Android wheel and falls back to a Rust/maturin build. Errors commonly include `Unsupported Android architecture`. Use Ubuntu inside `proot-distro` instead:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pkg install proot-distro
|
|
73
|
+
proot-distro install ubuntu
|
|
74
|
+
proot-distro login ubuntu
|
|
75
|
+
apt update && apt upgrade -y
|
|
76
|
+
apt install -y python3 python3-pip python3-venv
|
|
77
|
+
python3 -m venv godenv
|
|
78
|
+
source godenv/bin/activate
|
|
79
|
+
pip install godaix
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
During `apt upgrade`, `tzdata` may show a timezone prompt. Select your geographic area and city when prompted. On a non-interactive setup, set `DEBIAN_FRONTEND=noninteractive` and `TZ=UTC` before the upgrade, or run `dpkg-reconfigure tzdata` later.
|
|
83
|
+
|
|
84
|
+
## Known Environment Issues
|
|
85
|
+
|
|
86
|
+
### Termux / Android
|
|
87
|
+
|
|
88
|
+
`pydantic-core` is a Rust extension and Android/Termux may not have a compatible prebuilt wheel. Maturin can report `Unsupported Android architecture`. Install through Ubuntu in `proot-distro` using the steps above; do not try to work around it by removing a required dependency.
|
|
89
|
+
|
|
90
|
+
### iSH / iPadOS terminal apps
|
|
91
|
+
|
|
92
|
+
iSH uses an Alpine/musl-based environment and often runs under x86 emulation. A matching `pydantic-core` wheel may not exist, and a usable Rust toolchain may not be available. Use a proper Linux VM/container or a cloud development environment such as GitHub Codespaces or Replit on iPad instead of installing this package directly in iSH.
|
|
93
|
+
|
|
94
|
+
### `externally-managed-environment` / PEP 668
|
|
95
|
+
|
|
96
|
+
Newer Debian and Ubuntu installations may reject system-wide pip writes. Create and activate a virtual environment first:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
python3 -m venv .venv
|
|
100
|
+
source .venv/bin/activate
|
|
101
|
+
python -m pip install godaix
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Do not remove the distribution's `EXTERNALLY-MANAGED` marker. `pip install --break-system-packages` is a last-resort system choice, not the recommended installation path.
|
|
105
|
+
|
|
106
|
+
### Rust, maturin, or missing wheel errors
|
|
107
|
+
|
|
108
|
+
On unsupported Python/platform combinations, pip may attempt to compile `pydantic-core` and fail with `cargo`, `rustc`, or `maturin` errors. Use a supported CPython release with a compatible wheel, preferably Python 3.10 or newer, and upgrade pip before retrying. The package metadata allows Python 3.9, but current `pydantic-core` releases declare Python 3.10+; Python 3.9 users may need a compatible dependency resolution or should use Python 3.10+.
|
|
109
|
+
|
|
110
|
+
### Dependency resolution conflicts
|
|
111
|
+
|
|
112
|
+
If pip reports `ResolutionImpossible`, inspect the first conflicting requirement and update pip in a fresh environment. Do not mix unrelated global packages into the install:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
python -m venv .venv
|
|
116
|
+
source .venv/bin/activate
|
|
117
|
+
python -m pip install --upgrade pip setuptools wheel
|
|
118
|
+
python -m pip install godaix
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Alpine, musl, emulated, or unusual architectures
|
|
122
|
+
|
|
123
|
+
Alpine's musl libc, iSH's emulated x86 environment, and less common CPU
|
|
124
|
+
architectures can all lack a compatible `pydantic-core` wheel. In that case
|
|
125
|
+
pip falls back to a native build even when the Python version is supported.
|
|
126
|
+
Prefer a glibc-based Ubuntu environment with CPython 3.10+ and a matching
|
|
127
|
+
wheel. If you must retry the build, make the build tools explicit first:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
python -m pip install --upgrade pip setuptools wheel
|
|
131
|
+
python -m pip install godai
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Termux package maintainers sometimes ship Rust-backed extensions as separate
|
|
135
|
+
native packages, but that does not make arbitrary pip builds on Android
|
|
136
|
+
reliable; the Ubuntu `proot-distro` route above remains the supported setup.
|
|
137
|
+
|
|
138
|
+
### TLS certificate failures
|
|
139
|
+
|
|
140
|
+
`SSLCertVerificationError`, `CERTIFICATE_VERIFY_FAILED`, and similar errors usually mean the host Python or corporate proxy lacks a trusted CA bundle. Update the operating-system CA certificates, configure the organization’s CA bundle as documented by its proxy, and retry in a fresh environment. Avoid disabling TLS verification.
|
|
141
|
+
|
|
142
|
+
### Missing provider or system dependency
|
|
143
|
+
|
|
144
|
+
Provider SDKs are installed by default, but an environment can still have a broken or incomplete installation. godai’s dependency helper raises a clear `ImportError` naming the exact command, such as `python -m pip install torch`, rather than hiding the problem behind a raw traceback. Install the named package in the active virtual environment and retry.
|
|
145
|
+
|
|
146
|
+
## Examples
|
|
147
|
+
|
|
148
|
+
Run examples from the repository root, inside an activated environment where godai is installed:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
python3 examples/aura_examples.py
|
|
152
|
+
python3 examples/nexus_examples.py
|
|
153
|
+
python3 examples/aether_examples.py
|
|
154
|
+
python3 examples/apex_examples.py
|
|
155
|
+
python3 examples/combined_examples.py
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
All five files use offline or local paths and run without an API key. The combined workflow touches all 60 public members.
|
|
159
|
+
|
|
160
|
+
## Quick Start
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
from godai import aura, nexus, aether, apex
|
|
164
|
+
|
|
165
|
+
@aura.trace
|
|
166
|
+
@aura.heal(retries=1)
|
|
167
|
+
def add(left: int, right: int) -> int:
|
|
168
|
+
return left + right
|
|
169
|
+
|
|
170
|
+
print(add(2, 3))
|
|
171
|
+
print(nexus.explain(KeyError("name")))
|
|
172
|
+
print(aether.heuristics(ZeroDivisionError()))
|
|
173
|
+
print(apex.redact("api_key=do-not-send-this"))
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## API Reference
|
|
177
|
+
|
|
178
|
+
Every public member is listed below. The static site in [`docs/`](docs/) expands each entry with an executable example taken from the repository’s example files.
|
|
179
|
+
|
|
180
|
+
### Aura
|
|
181
|
+
|
|
182
|
+
| Member | Description |
|
|
183
|
+
| --- | --- |
|
|
184
|
+
| `heal` | Diagnoses runtime exceptions, logs an explanation, retries, and re-raises after failures. |
|
|
185
|
+
| `patch` | Requests corrected Python, strips fences, validates with `ast.parse()`, and executes the replacement in a controlled namespace. |
|
|
186
|
+
| `retry` | Retries transient/network errors with exponential backoff and fails fast on logic errors. |
|
|
187
|
+
| `validate` | Validates inputs and outputs against a Pydantic model or dictionary schema. |
|
|
188
|
+
| `trace` | Logs arguments, return value, exceptions, and elapsed time. |
|
|
189
|
+
| `cache` | Memoizes results with optional whitespace-normalized semantic caching. |
|
|
190
|
+
| `async_heal` | Async-compatible healing decorator for coroutine functions. |
|
|
191
|
+
| `sandbox` | Runs a decorated function with a restricted builtins mapping. |
|
|
192
|
+
| `explain` | Adds a plain-English explanation note to raised exceptions. |
|
|
193
|
+
| `benchmark` | Measures and logs function execution timing and wrapper overhead. |
|
|
194
|
+
| `guard` | Blocks execution with a clear message when environment variables or packages are missing. |
|
|
195
|
+
| `dry_run` | Logs configured side-effect interception for safe test paths. |
|
|
196
|
+
| `audit` | Writes calls, successes, and exceptions to a JSON-lines audit file. |
|
|
197
|
+
| `fallback` | Returns a fallback function result or default after a failure. |
|
|
198
|
+
| `rate_limit` | Uses a token bucket to throttle calls and cap provider cost. |
|
|
199
|
+
|
|
200
|
+
### Nexus
|
|
201
|
+
|
|
202
|
+
| Member | Description |
|
|
203
|
+
| --- | --- |
|
|
204
|
+
| `explain` | Produces a plain-English diagnosis for an exception or traceback. |
|
|
205
|
+
| `parse` | Extracts schema-shaped values from text and validates a Pydantic model. |
|
|
206
|
+
| `agent` | Inspects a project directory and gates edits behind `allow_edits`. |
|
|
207
|
+
| `summarize` | Summarizes functions, classes, and the public shape of Python code. |
|
|
208
|
+
| `review` | Flags risky patterns in a unified diff. |
|
|
209
|
+
| `test_gen` | Generates a runnable pytest skeleton for a callable. |
|
|
210
|
+
| `docstring` | Generates a concise docstring from a function signature. |
|
|
211
|
+
| `translate` | Requests a behavior-preserving translation to another language. |
|
|
212
|
+
| `refactor` | Requests a refactor toward a stated goal after syntax validation. |
|
|
213
|
+
| `complexity` | Estimates cyclomatic complexity offline using `ast`. |
|
|
214
|
+
| `security_scan` | Flags `eval`, `exec`, and likely hardcoded secrets offline. |
|
|
215
|
+
| `dependency_check` | Finds imports and suggests non-stdlib requirements entries. |
|
|
216
|
+
| `commit_message` | Generates a conventional commit subject from a diff. |
|
|
217
|
+
| `changelog` | Formats commit subjects into a changelog entry. |
|
|
218
|
+
| `ask` | Answers a question scoped to supplied code context. |
|
|
219
|
+
|
|
220
|
+
### Aether
|
|
221
|
+
|
|
222
|
+
| Member | Description |
|
|
223
|
+
| --- | --- |
|
|
224
|
+
| `timeout` | Enforces a hard deadline and raises `TimeoutError` promptly. |
|
|
225
|
+
| `circuit_breaker` | Tracks provider failures, opens a circuit, and fails fast during cooldown. |
|
|
226
|
+
| `offline_queue` | Persists failed JSON requests in SQLite for later replay. |
|
|
227
|
+
| `heuristics` | Diagnoses common Python exceptions without network access. |
|
|
228
|
+
| `fallback_provider` | Tries configured providers in order and returns the first success. |
|
|
229
|
+
| `degraded_mode` | Detects unavailable networking and logs an offline-mode warning. |
|
|
230
|
+
| `lazy_load` | Imports a heavy module only at first actual use. |
|
|
231
|
+
| `zero_overhead` | Benchmarks decorated fast-path overhead. |
|
|
232
|
+
| `network_probe` | Measures connection quality and recommends timeout/retry values. |
|
|
233
|
+
| `missing_dependency_helper` | Raises an exact pip command for an unavailable dependency. |
|
|
234
|
+
| `cache_store` | Provides bounded TTL disk-and-memory caching. |
|
|
235
|
+
| `debounce` | Suppresses repeated identical calls during a configured window. |
|
|
236
|
+
| `status` | Reports online, offline, degraded, or circuit-open health. |
|
|
237
|
+
| `rust_core` | Uses a future compiled extension when present and a Python reference otherwise. |
|
|
238
|
+
| `config` | Centralizes timeout, retry, circuit, and cache settings. |
|
|
239
|
+
|
|
240
|
+
### Apex
|
|
241
|
+
|
|
242
|
+
| Member | Description |
|
|
243
|
+
| --- | --- |
|
|
244
|
+
| `pytest_plugin` | Returns a pytest hook plugin that diagnoses failed tests. |
|
|
245
|
+
| `pre_commit_hook` | Reviews staged Python diffs and returns a hook status code. |
|
|
246
|
+
| `github_action` | Posts suggested fixes to GitHub using `GITHUB_TOKEN`. |
|
|
247
|
+
| `django_middleware` | Captures and diagnoses unhandled Django exceptions with guarded imports. |
|
|
248
|
+
| `flask_middleware` | Registers a Flask exception diagnosis handler. |
|
|
249
|
+
| `fastapi_middleware` | Adds FastAPI middleware that observes unhandled failures. |
|
|
250
|
+
| `cli` | Provides `godai fix`, `godai explain`, and `godai agent` commands. |
|
|
251
|
+
| `vscode_extension` | Serves a documented local JSON-RPC-style editor endpoint. |
|
|
252
|
+
| `redact` | Removes likely secrets and PII before code leaves the process. |
|
|
253
|
+
| `on_prem` | Describes self-hosted OpenAI-compatible endpoint configuration. |
|
|
254
|
+
| `multi_tenant` | Stores tenant keys, quotas, and usage counters. |
|
|
255
|
+
| `shared_cache` | Exposes a shared-backend cache adapter. |
|
|
256
|
+
| `metrics` | Produces Prometheus-compatible call counters. |
|
|
257
|
+
| `dashboard` | Renders an HTML history view from audit events. |
|
|
258
|
+
| `docker_ready` | Validates required environment variables without prompting. |
|
|
259
|
+
|
|
260
|
+
## Supported LLM Providers
|
|
261
|
+
|
|
262
|
+
Set the provider and its credential before making an online call. `offline` and `local` are safe defaults for examples.
|
|
263
|
+
|
|
264
|
+
| Provider | Environment variables |
|
|
265
|
+
| --- | --- |
|
|
266
|
+
| Anthropic Claude | `GODAI_PROVIDER=anthropic`, `ANTHROPIC_API_KEY=...` |
|
|
267
|
+
| OpenAI GPT | `GODAI_PROVIDER=openai`, `OPENAI_API_KEY=...` |
|
|
268
|
+
| Google Gemini | `GODAI_PROVIDER=gemini`, `GOOGLE_API_KEY=...` |
|
|
269
|
+
| Groq | `GODAI_PROVIDER=groq`, `GROQ_API_KEY=...` |
|
|
270
|
+
| xAI Grok | `GODAI_PROVIDER=xai`, `XAI_API_KEY=...` |
|
|
271
|
+
| Ollama | `GODAI_PROVIDER=ollama`, `OLLAMA_BASE_URL=http://localhost:11434` |
|
|
272
|
+
| Qwen | `GODAI_PROVIDER=qwen`, `DASHSCOPE_API_KEY=...` |
|
|
273
|
+
| OpenRouter | `GODAI_PROVIDER=openrouter`, `OPENROUTER_API_KEY=...` |
|
|
274
|
+
| Generic OpenAI-compatible | `GODAI_PROVIDER=openai_compatible`, `GODAI_BASE_URL=https://host/v1`, `GODAI_API_KEY=...` |
|
|
275
|
+
|
|
276
|
+
For the provider-specific cloud entries, set the provider-specific key shown
|
|
277
|
+
above. The low-level OpenAI-compatible transport sends `GODAI_API_KEY` as its
|
|
278
|
+
Bearer token, so set that shared variable as well when using `openai`, `groq`,
|
|
279
|
+
`xai`, `qwen`, or `openrouter` with the built-in HTTP transport.
|
|
280
|
+
|
|
281
|
+
Optional model and resilience settings use `GODAI_MODEL`, `GODAI_TIMEOUT`, `GODAI_RETRIES`, `GODAI_CIRCUIT_THRESHOLD`, and `GODAI_CACHE_TTL`.
|
|
282
|
+
|
|
283
|
+
## License
|
|
284
|
+
|
|
285
|
+
godai is released under the [MIT License](LICENSE).
|
|
286
|
+
|
|
287
|
+
## Contributing
|
|
288
|
+
|
|
289
|
+
Open an issue or pull request on [ayushgiriai21-cmd/God](https://github.com/ayushgiriai21-cmd/God). Keep changes focused, add or update runnable examples for public behavior, and run the offline example suite before requesting review.
|
|
290
|
+
|
|
291
|
+
## About the Author
|
|
292
|
+
|
|
293
|
+
**Ayush Giri** · GitHub: [@ayushgiriai21-cmd](https://github.com/ayushgiriai21-cmd) · Repository: [github.com/ayushgiriai21-cmd/God](https://github.com/ayushgiriai21-cmd/God)
|
|
294
|
+
|
|
295
|
+
The repository does not currently declare a separate project website URL. The local documentation website is available from [`docs/index.html`](docs/index.html).
|