Skip to main content

Offline local-LLM helper (llama.cpp + GGUF) with Python API and CLI.

Project description

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:
$env:PYPI_TOKEN = "pypi-xxxxxxxxxxxxxxxx"
  1. Build + upload:
.\publish_to_pypi.ps1

Neu muon build wheel moi truoc khi upload:

.\publish_to_pypi.ps1 -BuildWheel

Jupyter localhost test from pip

Trong notebook:

%pip install offlineai-local

Khoi tao data local (1 lan):

from offlineai import bootstrap_from_zip
bootstrap_from_zip(r"D:\path\offlineai_bundle.zip")

Hoi:

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:
pip install .
  1. Put runtime/model in one of these:
  • %USERPROFILE%\.offlineai\runtime and %USERPROFILE%\.offlineai\models
  • or bootstrap from a project folder / bundle zip
  1. Check:
offlineai doctor
  1. Ask:
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/:

offlineai bootstrap-dir D:\AI_LOCAL_SYSTEM

Create a single portable bundle zip

offlineai pack --source D:\AI_LOCAL_SYSTEM --output D:\AI_LOCAL_SYSTEM\offlineai_bundle.zip

Then on a new machine:

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

offlineai_local-0.1.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file offlineai_local-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for offlineai_local-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 10644d89098db3d89d51008ba21e5d10e829899eb7e1444143da7a45afe20ba4
MD5 f181f0a69cfda03b9c47f77025abde44
BLAKE2b-256 f3fef9c93717cc9ef084b9bf1a1eb6c8573f15eab2b4fd211b0a74615455c32f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page