Metadata-Version: 2.4
Name: offlineai-local
Version: 0.1.0
Summary: Offline local-LLM helper (llama.cpp + GGUF) with Python API and CLI.
Author: offlineai-local
License-Expression: MIT
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# offlineai-local
Small Python package to run a local GGUF model (via `llama-server`) with:
- Python API: `get_answer(prompt, instruction="")`
- CLI: `offlineai ask ...`
- Bootstrap and bundle helpers to avoid copying many loose files.

## Publish to PyPI (Windows, D drive only)
1. Tao token tren `https://pypi.org/manage/account/token/`.
2. Mo PowerShell trong `D:\AI_LOCAL_SYSTEM`.
3. Gan token:
```powershell
$env:PYPI_TOKEN = "pypi-xxxxxxxxxxxxxxxx"
```
4. Build + upload:
```powershell
.\publish_to_pypi.ps1
```
Neu muon build wheel moi truoc khi upload:
```powershell
.\publish_to_pypi.ps1 -BuildWheel
```

## Jupyter localhost test from pip
Trong notebook:
```python
%pip install offlineai-local
```

Khoi tao data local (1 lan):
```python
from offlineai import bootstrap_from_zip
bootstrap_from_zip(r"D:\path\offlineai_bundle.zip")
```

Hoi:
```python
from offlineai import get_answer
get_answer("Ban co the noi tieng Viet khong?")
get_answer(
    "Viet ham Python doc JSON an toan",
    "chi dua code python khong giai thich",
)
```

## Quick start
1. Install package:
```bash
pip install .
```

2. Put runtime/model in one of these:
- `%USERPROFILE%\.offlineai\runtime` and `%USERPROFILE%\.offlineai\models`
- or bootstrap from a project folder / bundle zip

3. Check:
```bash
offlineai doctor
```

4. Ask:
```bash
offlineai ask "ban co the noi tieng viet khong"
offlineai ask "viet ham python doc json an toan" --code-only
```

## Bootstrap from current project folder
If your project already has `runtime/` and `models/`:
```bash
offlineai bootstrap-dir D:\AI_LOCAL_SYSTEM
```

## Create a single portable bundle zip
```bash
offlineai pack --source D:\AI_LOCAL_SYSTEM --output D:\AI_LOCAL_SYSTEM\offlineai_bundle.zip
```

Then on a new machine:
```bash
pip install offlineai-local-0.1.0-py3-none-any.whl
offlineai bootstrap-zip D:\path\offlineai_bundle.zip
offlineai doctor
```

## Notes
- This package does not train anything before each use.
- It calls local model directly (API-style).
- Model quality is high for size, but no model guarantees 100% correctness for all questions.
