gizdb/ml/pgml
The SQL surface of PostgresML 2.10 in GizDB: CREATE EXTENSION pgml, and the native routines that its functions are. The algorithms are the SDK's (gizai/ml); this module only moves values between SQL and them.
import * as Pgml from "gizdb/ml/pgml";Types
ServerPgml
type ServerPgml = { models: string; }A server's PostgresML (Server.Options.pgml, a PgmlLink): each loop makes its own over the models in MODELS (embed.giz modelsFolder) and the model API the environment names.
models:string
Functions
pgmlInstall
function pgmlInstall(self: mut Conn, e: mut Engine, ifNotExists: bool, backing: mut StatementBacking): bool throws DbErrorCREATE EXTENSION pgml: PostgresML's schema, run as SQL, and the extension's catalog entry.
Effects: fail, read, write, console, io, alloc.
pgmlCall
function pgmlCall(self: mut Conn, held: Ref<PgmlState>, e: mut Engine, name: string, a: Vec<Value>, backing: mut StatementBacking): Rows throws DbErrorThe native routine name of language native in schema pgml, called with a: its rows (one row of one value for a
scalar function).
Effects: fail, read, write, console, io, alloc.
nativeRow
function nativeRow(self: Conn, e: Engine, name: string): stringThe routine body of a prediction that a query computes for each row (predict, predict_proba, predict_joint, decompose), or "": Conn.rowCalls reads its models once for the statement.
Effects: fail, read, write, console, io, alloc.
pgml
function pgml(models: Option<Models>, api: Option<OpenAi.ModelApi>): PgmlPostgresML for a Conn (Conn.pgml): its operations over one state, with the models of models and the model API
api. A server gives the same one to each of its sessions, so they share the loaded models.
Effects: fail, write, alloc.
Methods
ServerPgml.make
function ServerPgml.make(self: ServerPgml): PgmlThe SQL operations of a serving loop, with this server's model folder and the environment's model API.
Effects: fail, read, write, console, io, alloc.