@empiricalrun/llm
Advanced tools
Comparing version 0.9.6 to 0.9.9
# @empiricalrun/llm | ||
## 0.9.9 | ||
### Patch Changes | ||
- b5379b8: feat: added capability to select model in vision api's | ||
## 0.9.8 | ||
### Patch Changes | ||
- e33656e: test: added structural output tests in vision | ||
## 0.9.7 | ||
### Patch Changes | ||
- cf1740a: fix: move bbox to separate export path | ||
## 0.9.6 | ||
@@ -4,0 +22,0 @@ |
@@ -1,2 +0,1 @@ | ||
export { getBoundingBox } from "./bbox"; | ||
export { solveRecaptchaGrid } from "./captcha"; | ||
@@ -3,0 +2,0 @@ export { query } from "./query"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.imageFormatForProvider = exports.query = exports.solveRecaptchaGrid = exports.getBoundingBox = void 0; | ||
var bbox_1 = require("./bbox"); | ||
Object.defineProperty(exports, "getBoundingBox", { enumerable: true, get: function () { return bbox_1.getBoundingBox; } }); | ||
exports.imageFormatForProvider = exports.query = exports.solveRecaptchaGrid = void 0; | ||
var captcha_1 = require("./captcha"); | ||
@@ -7,0 +5,0 @@ Object.defineProperty(exports, "solveRecaptchaGrid", { enumerable: true, get: function () { return captcha_1.solveRecaptchaGrid; } }); |
import { z, ZodType } from "zod"; | ||
import { LLMModel } from "../.."; | ||
type ExtractType<T> = T extends ZodType ? z.infer<T> : never; | ||
export declare function query<T extends z.ZodType>(base64Image: string, instruction: string, responseFormat?: T): Promise<ExtractType<T>>; | ||
export declare function query<T extends z.ZodType>(base64Image: string, instruction: string, options?: { | ||
responseFormat?: T; | ||
model?: LLMModel; | ||
}): Promise<ExtractType<T>>; | ||
export {}; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -8,3 +8,7 @@ "use strict"; | ||
const utils_1 = require("../utils"); | ||
async function query(base64Image, instruction, responseFormat = zod_2.z.string()) { | ||
async function query(base64Image, instruction, options = { | ||
responseFormat: zod_2.z.string(), | ||
model: "gpt-4o-mini", | ||
}) { | ||
const { responseFormat = zod_2.z.string(), model = "gpt-4o-mini" } = options; | ||
const llm = new __1.LLM({ | ||
@@ -52,3 +56,3 @@ provider: "openai", | ||
], | ||
model: "gpt-4o-mini", | ||
model, | ||
modelParameters: { | ||
@@ -55,0 +59,0 @@ temperature: 0.5, |
{ | ||
"name": "@empiricalrun/llm", | ||
"version": "0.9.6", | ||
"version": "0.9.9", | ||
"main": "dist/index.js", | ||
@@ -13,2 +13,6 @@ "exports": { | ||
"default": "./dist/vision/index.js" | ||
}, | ||
"./vision/bbox": { | ||
"types": "./dist/vision/bbox/index.d.ts", | ||
"default": "./dist/vision/bbox/index.js" | ||
} | ||
@@ -15,0 +19,0 @@ }, |
@@ -29,6 +29,7 @@ # llm | ||
// With Appium | ||
const data = await driver.saveScreenshot('dummy.png'); | ||
const instruction = "Extract number of ATOM tokens from the image. Return only the number."; | ||
const data = await driver.saveScreenshot("dummy.png"); | ||
const instruction = | ||
"Extract number of ATOM tokens from the image. Return only the number."; | ||
const text = await query(data.toString('base64'), instruction); | ||
const text = await query(data.toString("base64"), instruction); | ||
// Example response: "0.01" | ||
@@ -40,10 +41,11 @@ ``` | ||
```ts | ||
import { getBoundingBox } from "@empiricalrun/llm/vision"; | ||
import { getBoundingBox } from "@empiricalrun/llm/vision/bbox"; | ||
// With Appium | ||
const data = await driver.saveScreenshot('dummy.png'); | ||
const data = await driver.saveScreenshot("dummy.png"); | ||
// Give a line describing the screen and then the element that you want to find | ||
const instruction = "This screenshot shows a screen to send crypto tokens. What is the bounding box for the dropdown to select the token?"; | ||
const instruction = | ||
"This screenshot shows a screen to send crypto tokens. What is the bounding box for the dropdown to select the token?"; | ||
const bbox = await getBoundingBox(data.toString('base64'), instruction); | ||
const bbox = await getBoundingBox(data.toString("base64"), instruction); | ||
const centerToTap = bbox.center; // { x: 342, y: 450 } | ||
@@ -59,3 +61,5 @@ | ||
```ts | ||
const bbox = await getBoundingBox(data.toString('base64'), instruction, { debug: true }); | ||
const bbox = await getBoundingBox(data.toString("base64"), instruction, { | ||
debug: true, | ||
}); | ||
console.log(bbox.annotatedImage); | ||
@@ -62,0 +66,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1037329
34
544
70