diff --git a/README.md b/README.md index 90308301..5e380b1b 100644 --- a/README.md +++ b/README.md @@ -370,7 +370,7 @@ npm install npm run build ``` -Then, to test the effects of your code change in an example, inside `examples/get-started/package.json`, change from `"@mlc-ai/web-llm": "^0.2.67"` to `"@mlc-ai/web-llm": ../..`. +Then, to test the effects of your code change in an example, inside `examples/get-started/package.json`, change from `"@mlc-ai/web-llm": "^0.2.68"` to `"@mlc-ai/web-llm": ../..`. Then run: diff --git a/examples/abort-reload/package.json b/examples/abort-reload/package.json index be85f6d5..92a408ac 100644 --- a/examples/abort-reload/package.json +++ b/examples/abort-reload/package.json @@ -15,6 +15,6 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67" + "@mlc-ai/web-llm": "^0.2.68" } } diff --git a/examples/cache-usage/package.json b/examples/cache-usage/package.json index 72d46b51..18c58899 100644 --- a/examples/cache-usage/package.json +++ b/examples/cache-usage/package.json @@ -15,6 +15,6 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67" + "@mlc-ai/web-llm": "^0.2.68" } } diff --git a/examples/chrome-extension-webgpu-service-worker/package.json b/examples/chrome-extension-webgpu-service-worker/package.json index 331d261d..7d7c96c4 100644 --- a/examples/chrome-extension-webgpu-service-worker/package.json +++ b/examples/chrome-extension-webgpu-service-worker/package.json @@ -17,7 +17,7 @@ "url": "^0.11.1" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67", + "@mlc-ai/web-llm": "^0.2.68", "progressbar.js": "^1.1.0" } } diff --git a/examples/chrome-extension/package.json b/examples/chrome-extension/package.json index 4765d206..d68f157e 100644 --- a/examples/chrome-extension/package.json +++ b/examples/chrome-extension/package.json @@ -17,7 +17,7 @@ "url": "^0.11.1" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67", + "@mlc-ai/web-llm": "^0.2.68", "progressbar.js": "^1.1.0" } } diff --git a/examples/embeddings/package.json b/examples/embeddings/package.json index f54dba0b..9362d527 100644 --- a/examples/embeddings/package.json +++ b/examples/embeddings/package.json @@ -15,7 +15,7 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67", + "@mlc-ai/web-llm": "^0.2.68", "langchain": "0.2.15" } } diff --git a/examples/function-calling/function-calling-manual/package.json b/examples/function-calling/function-calling-manual/package.json index e31bf651..029b58a4 100644 --- a/examples/function-calling/function-calling-manual/package.json +++ b/examples/function-calling/function-calling-manual/package.json @@ -15,6 +15,6 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67" + "@mlc-ai/web-llm": "^0.2.68" } } diff --git a/examples/function-calling/function-calling-openai/package.json b/examples/function-calling/function-calling-openai/package.json index fccc1978..16851cba 100644 --- a/examples/function-calling/function-calling-openai/package.json +++ b/examples/function-calling/function-calling-openai/package.json @@ -15,6 +15,6 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67" + "@mlc-ai/web-llm": "^0.2.68" } } diff --git a/examples/get-started-web-worker/package.json b/examples/get-started-web-worker/package.json index 33be15e5..4efbc08b 100644 --- a/examples/get-started-web-worker/package.json +++ b/examples/get-started-web-worker/package.json @@ -15,6 +15,6 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67" + "@mlc-ai/web-llm": "^0.2.68" } } diff --git a/examples/get-started/package.json b/examples/get-started/package.json index 0fa82d77..a98ee9f3 100644 --- a/examples/get-started/package.json +++ b/examples/get-started/package.json @@ -15,6 +15,6 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67" + "@mlc-ai/web-llm": "^0.2.68" } } diff --git a/examples/json-mode/package.json b/examples/json-mode/package.json index d276d693..13d7d380 100644 --- a/examples/json-mode/package.json +++ b/examples/json-mode/package.json @@ -15,6 +15,6 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67" + "@mlc-ai/web-llm": "^0.2.68" } } diff --git a/examples/json-schema/package.json b/examples/json-schema/package.json index 275d5dca..e79a0f5e 100644 --- a/examples/json-schema/package.json +++ b/examples/json-schema/package.json @@ -15,6 +15,6 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67" + "@mlc-ai/web-llm": "^0.2.68" } } diff --git a/examples/logit-processor/package.json b/examples/logit-processor/package.json index 562c3676..7d46344b 100644 --- a/examples/logit-processor/package.json +++ b/examples/logit-processor/package.json @@ -15,6 +15,6 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67" + "@mlc-ai/web-llm": "^0.2.68" } } diff --git a/examples/multi-models/package.json b/examples/multi-models/package.json index b65bb5db..95b55384 100644 --- a/examples/multi-models/package.json +++ b/examples/multi-models/package.json @@ -15,6 +15,6 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67" + "@mlc-ai/web-llm": "^0.2.68" } } diff --git a/examples/multi-round-chat/package.json b/examples/multi-round-chat/package.json index 0de18f1d..f6c6276b 100644 --- a/examples/multi-round-chat/package.json +++ b/examples/multi-round-chat/package.json @@ -15,6 +15,6 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67" + "@mlc-ai/web-llm": "^0.2.68" } } diff --git a/examples/next-simple-chat/package.json b/examples/next-simple-chat/package.json index 56c11f24..019fd775 100644 --- a/examples/next-simple-chat/package.json +++ b/examples/next-simple-chat/package.json @@ -9,7 +9,7 @@ "lint": "next lint" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67", + "@mlc-ai/web-llm": "^0.2.68", "@types/node": "20.3.3", "@types/react": "18.2.14", "@types/react-dom": "18.2.6", diff --git a/examples/seed-to-reproduce/package.json b/examples/seed-to-reproduce/package.json index 1fa08314..efb900dc 100644 --- a/examples/seed-to-reproduce/package.json +++ b/examples/seed-to-reproduce/package.json @@ -15,6 +15,6 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67" + "@mlc-ai/web-llm": "^0.2.68" } } diff --git a/examples/service-worker/package.json b/examples/service-worker/package.json index ceccf777..bdbb1685 100644 --- a/examples/service-worker/package.json +++ b/examples/service-worker/package.json @@ -15,6 +15,6 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67" + "@mlc-ai/web-llm": "^0.2.68" } } diff --git a/examples/simple-chat-ts/package.json b/examples/simple-chat-ts/package.json index 41766507..5a9fc0d7 100644 --- a/examples/simple-chat-ts/package.json +++ b/examples/simple-chat-ts/package.json @@ -15,6 +15,6 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67" + "@mlc-ai/web-llm": "^0.2.68" } } diff --git a/examples/streaming/package.json b/examples/streaming/package.json index c5a6ff70..39196bec 100644 --- a/examples/streaming/package.json +++ b/examples/streaming/package.json @@ -15,6 +15,6 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67" + "@mlc-ai/web-llm": "^0.2.68" } } diff --git a/examples/text-completion/package.json b/examples/text-completion/package.json index 607f0b16..5e16ef67 100644 --- a/examples/text-completion/package.json +++ b/examples/text-completion/package.json @@ -15,6 +15,6 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67" + "@mlc-ai/web-llm": "^0.2.68" } } diff --git a/examples/vision-model/package.json b/examples/vision-model/package.json index 169d7820..2050f8f3 100644 --- a/examples/vision-model/package.json +++ b/examples/vision-model/package.json @@ -15,6 +15,6 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67" + "@mlc-ai/web-llm": "^0.2.68" } } diff --git a/examples/vision-model/src/vision_model.ts b/examples/vision-model/src/vision_model.ts index 27228c0a..78518a48 100644 --- a/examples/vision-model/src/vision_model.ts +++ b/examples/vision-model/src/vision_model.ts @@ -9,7 +9,7 @@ function setLabel(id: string, text: string) { label.innerText = text; } -const USE_WEB_WORKER = false; +const USE_WEB_WORKER = true; const proxyUrl = "https://cors-anywhere.herokuapp.com/"; const url_https_street = "https://www.ilankelman.org/stopsigns/australia.jpg"; @@ -45,7 +45,7 @@ async function main() { ) : await webllm.CreateMLCEngine(selectedModel, engineConfig, chatOpts); - // 1. Single image input (with choices) + // 1. Prefill two images const messages: webllm.ChatCompletionMessageParam[] = [ { role: "user", @@ -89,7 +89,7 @@ async function main() { console.log(replyMessage1); console.log(reply1.usage); - // 3. A follow up multi-image question + // 3. A follow up single-image question messages.push({ role: "assistant", content: replyMessage1 }); messages.push({ role: "user", diff --git a/examples/vision-model/src/worker.ts b/examples/vision-model/src/worker.ts new file mode 100644 index 00000000..cc8f6242 --- /dev/null +++ b/examples/vision-model/src/worker.ts @@ -0,0 +1,7 @@ +import { WebWorkerMLCEngineHandler } from "@mlc-ai/web-llm"; + +const handler = new WebWorkerMLCEngineHandler(); + +self.onmessage = (msg: MessageEvent) => { + handler.onmessage(msg); +}; diff --git a/package-lock.json b/package-lock.json index 4ddd0190..57b90765 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@mlc-ai/web-llm", - "version": "0.2.67", + "version": "0.2.68", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@mlc-ai/web-llm", - "version": "0.2.67", + "version": "0.2.68", "license": "Apache-2.0", "dependencies": { "loglevel": "^1.9.1" diff --git a/package.json b/package.json index 916cf449..7836bf34 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@mlc-ai/web-llm", - "version": "0.2.67", + "version": "0.2.68", "description": "Hardware accelerated language model chats on browsers", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/utils/vram_requirements/package.json b/utils/vram_requirements/package.json index 90fb7497..0c3df563 100644 --- a/utils/vram_requirements/package.json +++ b/utils/vram_requirements/package.json @@ -19,7 +19,7 @@ "url": "^0.11.3" }, "dependencies": { - "@mlc-ai/web-llm": "^0.2.67", + "@mlc-ai/web-llm": "^0.2.68", "@mlc-ai/web-runtime": "0.18.0-dev0" } }