Skip to content

Python package gqi

The gqi package is the easiest way to start: a scikit-learn-style estimator that makes input→number prediction feel like any other sklearn model. It runs free and local out of the box; for the larger hosted model, import from gqi.cloud and pass your API key — same class name, same methods.

Pre-release — not on PyPI yet

This page previews the package interface; it isn't publicly installable yet. Today, use the copy-paste playground or the hosted API directly — the package wraps the same endpoints, so code you write against them carries over.

Install

pip install gqi          # pre-release: not yet published

The sklearn surface

gqi exposes an estimator that follows the scikit-learn contract: a hyperparameters-only constructor, fit(X, y) that returns self, and predict(X). If you've used an sklearn regressor, you already know the shape.

from gqi import GQI

reg = GQI(method="lora", model="small")   # method: "few_shot" | "lora" | "full"
reg.fit(["cannot log in, urgent!", "typo on the about page"], [9.0, 2.0])
y_hat, y_std = reg.predict(["payment failing for all users"], return_std=True)
# y_hat -> [8.6]   y_std -> [1.1]   (number + calibrated uncertainty)
  • few_shot stores your (X, y) examples and conditions on them at predict time — no training step.
  • lora / full train an adapter for your dataset (locally on your own hardware in free mode, or as a hosted job with gqi.cloud).
  • predict(return_std=True) returns the calibrated number and its uncertainty — the first-class differentiator.

Tuning knobs are optional

lora_r, lora_alpha, learning_rate, epochs all have sensible defaults — ignore them to start; reach for them only when you're tuning a specific dataset.

Pick a method by dataset size

Start with few_shot for a handful of examples, move to lora for most real datasets, and reach for full only when you have enough data to justify fine-tuning the whole model.

Local (free) vs. hosted (paid)

The same estimator runs in two modes. The only thing that changes is whether an API key is present.

Local (free) Hosted (paid)
Model Compact open-weights model Larger managed model
Runs on Your own CPU or GPU GQI Cloud
Auth No key API key
Best for Prototyping, offline use, full control Scale and accuracy without managing infra

The local model is small enough to run on a CPU or an 8–16 GB GPU, which makes it a quick way to prototype. The larger hosted model is available through the API and is not downloaded to your machine — you access it with a key.

Model names, across surfaces

The package's model="small" is GQI Lite; the larger hosted model is GQI Pro. The hosted API refers to them by tag — t270m_general_stageB (Lite) and GQI_1B_v0 (Pro).

One interface, two import paths

Local and hosted GQI share the same class name, constructor, and method semantics. The only difference is the import path:

from gqi import GQI       # runs in-process on your CPU/GPU

reg = GQI(method="lora", model="small")
reg.fit(X, y)
y_hat, y_std = reg.predict(X2, return_std=True)
from gqi.cloud import GQI  # SAME class + signature, runs in GQI Cloud

reg = GQI(method="lora", model="small", api_key="YOUR_KEY")
reg.fit(X, y)
y_hat, y_std = reg.predict(X2, return_std=True)

Moving from local prototyping to hosted production is a one-line import change — no code rewrite, no new mental model. Under the hood the local path runs the model in-process and the cloud path talks to the hosted API, but the estimator surface you write against is identical.