Skip to content

Commit

Permalink
upgrading deps (#486)
Browse files Browse the repository at this point in the history
* weekly dep update

* updated yarn.lock

* import console from node

* import node console

* restore global objects after prompt run
  • Loading branch information
pelikhan authored May 29, 2024
1 parent a39e506 commit f6bed69
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 49 deletions.
6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
},
"dependencies": {
"@astrojs/check": "^0.7.0",
"@astrojs/starlight": "^0.23.1",
"astro": "^4.8.6",
"@astrojs/starlight": "^0.23.2",
"astro": "^4.9.2",
"typescript": "5.4.5"
},
"devDependencies": {
"zx": "^8.1.0"
"zx": "^8.1.2"
}
}
2 changes: 1 addition & 1 deletion docs/src/content/docs/reference/cli/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Options:
-td, --test-delay <string> delay between tests in seconds
--no-cache disable LLM result cache
-v, --verbose verbose output
-pv, --promptfoo-version [version] propmtfoo version, default is ^0.59.1
-pv, --promptfoo-version [version] propmtfoo version, default is ^0.60.0
-os, --out-summary <file> append output summary in file
-h, --help display help for command
```
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
}
},
"devDependencies": {
"glob": "^10.3.15",
"glob": "^10.4.1",
"vitest": "^1.6.0",
"zx": "^8.1.0"
"zx": "^8.1.2"
}
}
12 changes: 6 additions & 6 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"license": "MIT",
"dependencies": {
"pdfjs-dist": "4.0.379",
"promptfoo": "^0.59.1",
"promptfoo": "^0.60.0",
"tree-sitter-wasms": "^0.1.11",
"typescript": "5.4.5",
"web-tree-sitter": "^0.22.2"
Expand All @@ -47,27 +47,27 @@
"@types/replace-ext": "^2.0.2",
"@types/semver": "^7.5.8",
"@types/ws": "^8.5.10",
"commander": "^12.0.0",
"commander": "^12.1.0",
"dockerode": "^4.0.2",
"dotenv": "^16.4.5",
"esbuild": "^0.21.3",
"esbuild": "^0.21.4",
"execa": "^9.1.0",
"file-type": "^19.0.0",
"fs-extra": "^11.2.0",
"genaiscript-core": "*",
"get-stdin": "^9.0.0",
"glob": "^10.3.15",
"glob": "^10.4.1",
"mammoth": "^1.7.2",
"memorystream": "^0.3.1",
"node-sarif-builder": "^3.1.0",
"openai": "^4.47.1",
"openai": "^4.47.2",
"ora": "^8.0.1",
"pretty-bytes": "^6.1.1",
"prompts": "^2.4.2",
"replace-ext": "^2.0.0",
"semver": "^7.6.2",
"tsx": "^4.10.3",
"zx": "^8.1.0"
"zx": "^8.1.2"
},
"scripts": {
"compile": "esbuild src/main.ts --bundle --platform=node --target=node20 --outfile=built/genaiscript.cjs --external:ssh2 --external:pdfjs-dist --external:llamaindex --external:web-tree-sitter --external:tree-sitter-wasms --external:promptfoo && node ../../scripts/patch-cli.mjs",
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import { modelInfo, systemInfo } from "./info"
import { scriptTestsView, scriptsTest } from "./test"
import { emptyDir } from "fs-extra"
import { join } from "path"
import "node:console"

async function cacheClear(name: string) {
let dir = dotGenaiscriptPath("cache")
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/log.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { stdout } from "node:process"
import console from "node:console"

export const info = console.error

Expand Down
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
"@types/ini": "^4.1.0",
"@types/mime-types": "^2.1.4",
"@types/node": "^20.12.12",
"ajv": "^8.13.0",
"ajv": "^8.14.0",
"cross-fetch": "^4.0.0",
"csv-parse": "^5.5.6",
"dotenv": "^16.4.5",
"esbuild": "^0.21.3",
"esbuild": "^0.21.4",
"fast-xml-parser": "^4.4.0",
"fetch-retry": "^6.0.0",
"fflate": "^0.8.2",
Expand All @@ -36,7 +36,7 @@
"html-escaper": "^3.0.3",
"html-to-text": "^9.0.5",
"inflection": "^3.0.0",
"ini": "^4.1.2",
"ini": "^4.1.3",
"json5": "^2.2.3",
"jsonrepair": "^3.8.0",
"magic-string": "^0.30.10",
Expand All @@ -46,7 +46,7 @@
"mime-types": "^2.1.35",
"minimatch": "^9.0.4",
"minisearch": "^6.3.0",
"openai": "^4.47.1",
"openai": "^4.47.2",
"prettier": "^3.2.5",
"pretty-bytes": "^6.1.1",
"serialize-error": "^11.0.3",
Expand Down
3 changes: 1 addition & 2 deletions packages/core/src/evalprompt.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { LogLevel, host } from "./host"
import { host } from "./host"
import MagicString from "magic-string"
import { consoleLogFormat } from "./logging"

export async function evalPrompt(
ctx0: PromptContext,
Expand Down
14 changes: 12 additions & 2 deletions packages/core/src/importprompt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,19 @@ export async function importPrompt(
const { filename } = r
if (!filename) throw new Error("filename is required")

const oldGlb: any = {}
const glb: any = resolveGlobal()
try {
// override global context
for (const field of Object.keys(ctx0)) {
assert(!glb[field])
oldGlb[field] = glb[field]
glb[field] = (ctx0 as any)[field]
}

const modulePath = filename.startsWith("/") ? filename : host.path.join(host.projectFolder(), filename)
const modulePath = filename.startsWith("/")
? filename
: host.path.join(host.projectFolder(), filename)
const module = await import(modulePath)
const main = module.default
if (!main) throw new Error("default import function missing")
Expand All @@ -38,6 +43,11 @@ export async function importPrompt(
logError(err)
throw err
} finally {
for (const field of Object.keys(ctx0)) delete glb[field]
// restore global context
for (const field of Object.keys(oldGlb)) {
const v = oldGlb[field]
if (v === undefined) delete glb[field]
else glb[field] = oldGlb[field]
}
}
}
1 change: 1 addition & 0 deletions packages/sample/genaisrc/summarize-import.genai.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
script({
title: "summarize all files using import",
model: "openai:gpt-3.5-turbo",
tests: {
files: ["src/rag/markdown.md"],
keywords: "markdown",
Expand Down
4 changes: 2 additions & 2 deletions packages/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -323,15 +323,15 @@
"@vscode/vsce": "^2.25.0",
"assert": "^2.1.0",
"dotenv": "^16.4.5",
"eslint": "^9.2.0",
"eslint": "^9.3.0",
"mocha": "^10.4.0",
"process": "^0.11.10",
"ts-loader": "^9.5.1",
"typescript": "5.4.5",
"vscode-uri": "^3.0.8",
"webfont": "^11.2.26",
"websocket-polyfill": "0.0.3",
"zx": "^8.1.0"
"zx": "^8.1.2"
},
"dependencies": {
"mammoth": "^1.7.2",
Expand Down
2 changes: 1 addition & 1 deletion slides/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
"vue": "^3.4.27"
},
"devDependencies": {
"zx": "^8.1.0"
"zx": "^8.1.2"
}
}
Loading

0 comments on commit f6bed69

Please sign in to comment.