omp packages

pi-jevisual0.1.0

Pi extension: classify images independently with TypeSafe's Jev (choice, score, yes/no and bounding-box questions).

piotradamm Published 22 days ago MIT ~466 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-jevisual

A pi extension for classifying images with TypeSafe's Jev model (typesafe/jev-latest). Each image is judged independently against the same set of named questions.

Install

pi install npm:pi-jevisual

Requires a TypeSafe API key, either in the TYPESAFE_API_KEY environment variable or stored in pi for the typesafe provider. Without a key the tool stays registered but its calls fail with an error.

Tool: independently_classify_visuals

Parameter Description
images One local image path or an array of paths, relative to the working directory or absolute.
captions Optional caption per image, in the same order ("" for none).
state Optional shared JSON context for the questions.
questions Named questions, each with type, instructions and, depending on the type, criteria.

Question types:

  • choice: pick one of several named criteria, e.g. { "keep": "…", "discard": "…" }.
  • score: a list of at least two criteria, giving a score.
  • noul: yes/no, with criteria: { "true": "…", "false": "…" }.
  • box: a bounding box, instructions only.

The result has one entry per image, identified by its resolved path, with the answer to every question. Images Jev cannot take (for example animated or multi-page images) are returned with unclassified and the reason. Images are sent in batches of up to 24 MB.

The tool does not compare images with each other or classify them jointly.

API for other extensions

import { createClient, independentlyClassifyVisuals } from "pi-jevisual/api";

const results = await independentlyClassifyVisuals({
  images: [buffer, "/path/to/figure.png"], // paths or image bytes
  captions: ["Figure 1: wiring", undefined],
  state: { task: "…" },
  questions: { relevant: { type: "noul", instructions: "…", criteria: { true: "…", false: "…" } } },
  client: createClient(apiKey), // optional; defaults to the client set up at session start
  signal, // optional AbortSignal
});

Results come back in input order. Path inputs are identified by path, byte inputs by index. pi-out-classify uses this API to classify images in tool outputs.

Importing the API does not register the tool. To get the tool, install the package in pi as above.

Privacy

The images, captions and state are sent to TypeSafe's API.