Views
No views yet
.wasm compile needed.1import { CreateMLCEngine } from "@mlc-ai/web-llm";
2
3const appConfig = {
4 model_list: [{
5 model: "https://huggingface.co/LJTSG/xLAM-2-3b-fc-r-q4f16_1-MLC",
6 model_id: "xLAM-2-3b-fc-r-q4f16_1-MLC",
7 model_lib:
8 "https://raw.githubusercontent.com/mlc-ai/binary-mlc-llm-libs/main/web-llm-models/" +
9 "v0_2_84/base/Qwen2.5-3B-Instruct-q4f16_1_cs1k-webgpu.wasm",
10 }],
11};
12
13const engine = await CreateMLCEngine("xLAM-2-3b-fc-r-q4f16_1-MLC", { appConfig });
14
15// xLAM is trained for tool-calling — pass tools and it emits structured calls:
16const res = await engine.chat.completions.create({
17 messages: [{ role: "user", content: "What's the weather in Paris?" }],
18 tools: [{ type: "function", function: {
19 name: "get_weather",
20 parameters: { type: "object", properties: { city: { type: "string" } }, required: ["city"] },
21 }}],
22 tool_choice: "auto",
23});mlc_llm convert_weight + gen_config --conv-template qwen2, built from source (matched TVM-unity + mlc-llm)