Skip to content

Commit

Permalink
upgrade skia to 2.0 (#908)
Browse files Browse the repository at this point in the history
* upgrade skia to 2.0

* upgrade deps

* chore: πŸ”§ update dependencies in package.json files

* feat: ✨ add token counting to TransformersCompletion

* refactor: πŸ“ shorten statistical summary output
  • Loading branch information
pelikhan authored Dec 4, 2024
1 parent 50f1392 commit 6d481ae
Show file tree
Hide file tree
Showing 11 changed files with 547 additions and 822 deletions.
427 changes: 78 additions & 349 deletions THIRD_PARTY_LICENSES.md

Large diffs are not rendered by default.

296 changes: 148 additions & 148 deletions docs/yarn.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"@inquirer/prompts": "^7.1.0",
"glob": "^11.0.0",
"npm-check-updates": "^17.1.11",
"prettier": "^3.4.1",
"prettier": "^3.4.2",
"zx": "^8.2.4"
}
}
18 changes: 9 additions & 9 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"dependencies": {
"@azure/identity": "^4.5.0",
"@inquirer/prompts": "^7.1.0",
"@modelcontextprotocol/sdk": "^1.0.1",
"@modelcontextprotocol/sdk": "^1.0.3",
"@octokit/plugin-paginate-rest": "^11.3.6",
"@octokit/plugin-retry": "^7.1.2",
"@octokit/plugin-throttling": "^9.3.2",
Expand All @@ -54,11 +54,11 @@
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz"
},
"optionalDependencies": {
"@huggingface/transformers": "^3.1.0",
"@huggingface/transformers": "^3.1.1",
"@lvce-editor/ripgrep": "^1.4.0",
"pdfjs-dist": "4.8.69",
"pdfjs-dist": "4.9.124",
"playwright": "^1.49.0",
"skia-canvas": "^1.0.2",
"skia-canvas": "^2.0.0",
"tree-sitter-wasms": "^0.1.11",
"web-tree-sitter": "0.22.2"
},
Expand All @@ -73,23 +73,23 @@
"@types/dockerode": "^3.3.32",
"@types/fs-extra": "^11.0.4",
"@types/memorystream": "^0.3.4",
"@types/node": "^20.14.12",
"@types/node": "^22.10.1",
"@types/papaparse": "^5.3.15",
"@types/prompts": "^2.4.9",
"@types/replace-ext": "^2.0.2",
"@types/ws": "^8.5.12",
"@types/ws": "^8.5.13",
"commander": "^12.1.0",
"diff": "^7.0.0",
"dotenv": "^16.4.5",
"es-toolkit": "^1.27.0",
"dotenv": "^16.4.7",
"es-toolkit": "^1.29.0",
"esbuild": "^0.24.0",
"execa": "^9.5.1",
"fs-extra": "^11.2.0",
"glob": "^11.0.0",
"memorystream": "^0.3.1",
"node-sarif-builder": "^3.2.0",
"octokit": "^4.0.2",
"openai": "^4.73.1",
"openai": "^4.75.0",
"pretty-bytes": "^6.1.1",
"replace-ext": "^2.0.0",
"ws": "^8.18.0",
Expand Down
20 changes: 10 additions & 10 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
},
"optionalDependencies": {
"@lvce-editor/ripgrep": "^1.4.0",
"pdfjs-dist": "4.8.69",
"skia-canvas": "^1.0.2",
"pdfjs-dist": "4.9.124",
"skia-canvas": "^2.0.0",
"web-tree-sitter": "0.22.2"
},
"devDependencies": {
"@anthropic-ai/sdk": "^0.32.1",
"@azure/identity": "^4.5.0",
"@huggingface/jinja": "^0.3.2",
"@huggingface/transformers": "^3.1.0",
"@modelcontextprotocol/sdk": "^1.0.1",
"@huggingface/transformers": "^3.1.1",
"@modelcontextprotocol/sdk": "^1.0.3",
"@octokit/plugin-paginate-rest": "^11.3.6",
"@octokit/plugin-retry": "^7.1.2",
"@octokit/plugin-throttling": "^9.3.2",
Expand All @@ -35,7 +35,7 @@
"@types/ini": "^4.1.1",
"@types/mime-types": "^2.1.4",
"@types/mustache": "^4.2.5",
"@types/node": "^20.14.12",
"@types/node": "^22.10.1",
"@types/object-inspect": "^1.13.0",
"@types/semver": "^7.5.8",
"@types/shell-quote": "^1.7.5",
Expand All @@ -44,8 +44,8 @@
"csv-parse": "^5.6.0",
"csv-stringify": "^6.5.2",
"diff": "^7.0.0",
"dotenv": "^16.4.5",
"es-toolkit": "^1.27.0",
"dotenv": "^16.4.7",
"es-toolkit": "^1.29.0",
"esbuild": "^0.24.0",
"fast-xml-parser": "^4.5.0",
"fetch-retry": "^6.0.0",
Expand All @@ -60,7 +60,7 @@
"ini": "^5.0.0",
"jimp": "^1.6.0",
"json5": "^2.2.3",
"jsonrepair": "^3.11.0",
"jsonrepair": "^3.11.1",
"magic-string": "^0.30.14",
"mammoth": "^1.8.0",
"mathjs": "^14.0.0",
Expand All @@ -70,10 +70,10 @@
"minisearch": "^7.1.1",
"mustache": "^4.2.0",
"object-inspect": "^1.13.3",
"openai": "^4.73.1",
"openai": "^4.75.0",
"p-limit": "^6.1.0",
"parse-diff": "^0.11.1",
"prettier": "^3.4.1",
"prettier": "^3.4.2",
"pretty-bytes": "^6.1.1",
"sanitize-html": "^2.13.1",
"semver": "^7.6.3",
Expand Down
4 changes: 3 additions & 1 deletion packages/core/src/transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,14 @@ export const TransformersCompletion: ChatCompletionHandler = async (

const { TextStreamer } = await import("@huggingface/transformers")
let chatResp = ""
let tokensSoFar = 0
const streamer = new TextStreamer(tokenizer, {
skip_prompt: true,
callback_function: (text: string) => {
chatResp += text
tokensSoFar += tokenizer(text).length
partialCb?.({
tokensSoFar: tokenizer(chatResp),
tokensSoFar,
responseSoFar: chatResp,
responseChunk: text,
responseTokens: [{ token: text, logprob: Number.NaN } satisfies Logprob],
Expand Down
2 changes: 1 addition & 1 deletion packages/sample/genaisrc/browse-text.genai.mts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ const html = await table.innerHTML()
const csv = (await HTML.convertTablesToJSON("<table>" + html + "</table>"))[0]
csv.forEach((row) => delete row[Object.keys(row)[0]]) // remove the first column
defData("DATA", csv)
$`Analyze DATA and provide a statistical summary.`
$`Analyze DATA and provide a short statistical summary. Use one paragraph.`
6 changes: 3 additions & 3 deletions packages/sample/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
"@agentic/core": "^7.2.0",
"@agentic/weather": "^7.2.0",
"@azure/identity": "^4.5.0",
"@azure/storage-blob": "^12.25.0",
"@huggingface/transformers": "^3.1.0",
"@modelcontextprotocol/sdk": "^1.0.1",
"@azure/storage-blob": "^12.26.0",
"@huggingface/transformers": "^3.1.1",
"@modelcontextprotocol/sdk": "^1.0.3",
"@tidyjs/tidy": "^2.5.2",
"p-all": "^5.0.0",
"vectorstore": "^0.0.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@
"@types/vscode": "^1.95.0",
"@vscode/vsce": "^3.2.1",
"assert": "^2.1.0",
"es-toolkit": "^1.27.0",
"es-toolkit": "^1.29.0",
"markdown-it-github-alerts": "^0.3.0",
"process": "^0.11.10",
"typescript": "5.7.2",
Expand Down
Loading

0 comments on commit 6d481ae

Please sign in to comment.