npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pi-accurate-vision

v0.1.4

Published

Accurate spatial reasoning over images — vision model extracts bounding boxes, LLM calculates exact distances

Readme

pi-accurate-vision

Accurate spatial reasoning over images — vision model extracts bounding boxes, LLM calculates exact distances.

Vision models are great at describing what's in an image, but terrible at spatial reasoning. They get confused by visual elements like connecting lines, colors, and layout patterns. pi-accurate-vision solves this by separating perception from reasoning: a vision model extracts precise bounding-box coordinates, then an LLM performs mathematical spatial analysis.

Why Primitives Matter

The Problem

Given this scientist relationship network diagram:

Ask any vision model: "Ignoring the connecting lines, which text box is physically closest to 居里夫人 (Marie Curie)?"

They all get it wrong — answering 郎之万 (Langevin), likely influenced by the connecting lines or historical knowledge rather than actual spatial distance.

Without Primitives

The vision model gives only a text description — no coordinates:

An LLM receiving this can only guess based on historical knowledge:

"郎之万 is closest — they had a famous personal relationship..."

Result: ❌ Wrong — spatial reasoning replaced by knowledge-based guessing.

With Primitives

The vision model returns bounding-box coordinates for every detected object:

An LLM receiving this can calculate exact edge-to-edge distances:

居里夫人:  [661, 450, 779, 508]  ← target
皮卡尔德:  [784, 375, 885, 428]  ← dx=5,  dy=22  → dist = 22.6 ✅ CLOSEST
亨利厄特:  [739, 555, 849, 605]  ← dx=0,  dy=47  → dist = 47.0
古伊:      [538, 385, 614, 435]  ← dx=47, dy=15  → dist = 49.3
郎之万:    [627, 565, 719, 618]  ← dx=0,  dy=57  → dist = 57.0  ← vision model's "answer"

Result: ✅ Correct — 皮卡尔德 (Piccard) is 22.6 units away, the true nearest.

Even GPT Gets It Wrong

GPT-4o looking directly at the same image also answers 郎之万 — influenced by the connecting lines, not actual spatial distance:

No matter how powerful the LLM, without precise coordinates, spatial reasoning over images is just guessing.

Benchmark Summary

| Approach | Answer | Correct? | |:---|:---|:---| | Vision model (qwen3.5-omni-plus) alone | 郎之万 | ❌ | | GPT-4o (direct image analysis) | 郎之万 | ❌ | | Vision model + no primitives → LLM | 郎之万 | ❌ | | Vision model + primitives → LLM | 皮卡尔德 | ✅ |

Install

npm install pi-accurate-vision

CLI Usage

# Analyze an image (reads config from ~/.deepseek/config.toml)
npx accurate-vision photo.png "What's in this image?"

# Output raw JSON
npx accurate-vision screenshot.png --json

# Disable bounding-box primitives
npx accurate-vision photo.png --no-primitives

# Override model/API
npx accurate-vision photo.png --model gpt-4o --api-key sk-xxx --base-url https://api.openai.com/v1

Library Usage

import { analyzeImage, resolveVisionConfig } from "pi-accurate-vision";

const config = resolveVisionConfig();
const result = await analyzeImage("./photo.png", config, "Describe the objects");
console.log(result.analysis);

Config

Reads from environment variables or a .env file in the current directory:

# .env
VISION_MODEL=qwen3.5-omni-plus-2026-03-15
VISION_API_KEY=your-api-key
VISION_BASE_URL=https://dashscope.aliyuncs.com/compatible-mode/v1
VISION_PRIMITIVES=true

Priority: CLI flags > environment variables > .env file > defaults.

API

runVisionAnalysis(params)

Core function. Sends image to vision model, returns VisionAnalysis with:

  • note: structured description (overview, visible text, layout, charts, etc.)
  • primitives: array of detected objects with bounding boxes (0–1000 normalised coordinates)

parseAnalysisResponse(raw)

Parse a vision model's JSON response. Handles multiple field name conventions.

formatVisionContext(analysis)

Format analysis as structured XML-like text for downstream LLM consumption.

resolveVisionConfig(overrides?)

Read and merge vision config from .env file + environment variables + explicit overrides.

Test

npx tsx --test src/vision/bridge.test.ts

License

MIT