Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@empiricalrun/llm

Package Overview
Dependencies
Maintainers
0
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@empiricalrun/llm - npm Package Compare versions

Comparing version 0.9.14 to 0.9.15

dist/vision/point/cache.d.ts

6

CHANGELOG.md
# @empiricalrun/llm
## 0.9.15
### Patch Changes
- 76e979c: feat: add basic cache option on point method
## 0.9.14

@@ -4,0 +10,0 @@

9

dist/vision/point/index.d.ts
import { Coordinates, Point } from "../types";
export declare function getCoordinatesFor(prompt: string, base64Image: string): Promise<Coordinates>;
/**
* Call the vision model to get the coordinates for a prompt. Set `useCache` to
* true if you are clicking on a fixed UI element multiple times. Caching uses `prompt`
* and dimensions of the `base64Image` to store the coordinates.
*/
export declare function getCoordinatesFor(prompt: string, base64Image: string, options?: {
useCache?: boolean;
}): Promise<Coordinates>;
export declare function extractTapCoordinateFromString(inputString: string): Point;
//# sourceMappingURL=index.d.ts.map

@@ -5,7 +5,27 @@ "use strict";

const image_1 = require("../image");
const cache_1 = require("./cache");
const API_BASE_URL = process.env.VISION_MODEL_ENDPOINT;
async function getCoordinatesFor(prompt, base64Image) {
const llmResponse = await getLlmResponse(base64Image, prompt);
const pointFromLlm = extractTapCoordinateFromString(llmResponse);
const scaledPoint = scaleForImage(pointFromLlm, base64Image);
/**
* Call the vision model to get the coordinates for a prompt. Set `useCache` to
* true if you are clicking on a fixed UI element multiple times. Caching uses `prompt`
* and dimensions of the `base64Image` to store the coordinates.
*/
async function getCoordinatesFor(prompt, base64Image, options) {
let scaledPoint;
if (options?.useCache) {
const cachedPoint = (0, cache_1.getFromCache)(prompt, base64Image);
if (cachedPoint) {
// Cache works if prompt and image dimensions are the same
console.log(`Cache hit for prompt: ${prompt}`);
scaledPoint = cachedPoint;
}
}
if (!scaledPoint) {
const llmResponse = await getLlmResponse(base64Image, prompt);
const pointFromLlm = extractTapCoordinateFromString(llmResponse);
scaledPoint = scaleForImage(pointFromLlm, base64Image);
if (options?.useCache) {
(0, cache_1.setInCache)(prompt, base64Image, scaledPoint);
}
}
const annotatedImage = await (0, image_1.drawRedDotAtPoint)(base64Image, scaledPoint);

@@ -12,0 +32,0 @@ const dims = (0, image_1.dimensions)(base64Image);

2

package.json
{
"name": "@empiricalrun/llm",
"version": "0.9.14",
"version": "0.9.15",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "exports": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc