{
  "url": "https://paul.kinlan.me/projects/transformerjs-breadboard-kit/",
  "title": "transformerjs-breadboard-kit",
  "byline": "Paul Kinlan",
  "siteName": "Modern Web Development with Chrome",
  "leadImage": "https://paul.kinlan.me/api/card?title=transformerjs-breadboard-kit",
  "wordCount": 116,
  "readingTimeMinutes": 1,
  "cacheStatus": "HIT",
  "markdown": "# transformerjs-breadboard-kit\n\nA lot of the tools that I build that interact with LLMs are built with Breadboard. I needed to be able to run a number of tasks on the device that I have the board without using an LLM in the cloud. [TransformerJS](https://huggingface.co/docs/transformers.js/en/index) is a great API for JS developers to work with a number of different models that are hosted on HuggingFace. To get this working with breadboard I needed to create a Kit.... so here we are.\n\nYou can find the [code here](https://github.com/PaulKinlan/transformerjs-breadboard-kit) and if you are using breadboard you can install it as `npm i @paulkinlan/transformerjs-breadboard-kit`\n\nTo create an Breadboard agent you can do it as follows:\n\n```fallback\nimport { board } from \"@google-labs/breadboard\";\nimport { sentiment } from \"@paulkinlan/transformerjs-breadboard-kit\"\n\nexport default await board(({ text, model }) => {\n    text.isString();\n    model.isString();\n\n    const summarynode = transformersjs.summarize({\n      $id: \"summary\",\n      input: text,\n      model,\n    });\n\n    return summarynode.to(base.output());\n  }).serialize({\n  title: \"Summary board\",\n  description: \"Runs the summarization analysis with transformer JS\",\n  version: \"0.0.2\",\n});\n```",
  "html": "<h1>transformerjs-breadboard-kit</h1>\n<p>A lot of the tools that I build that interact with LLMs are built with Breadboard. I needed to be able to run a number of tasks on the device that I have the board without using an LLM in the cloud. <a href=\"https://huggingface.co/docs/transformers.js/en/index\">TransformerJS</a> is a great API for JS developers to work with a number of different models that are hosted on HuggingFace. To get this working with breadboard I needed to create a Kit.... so here we are.</p>\n<p>You can find the <a href=\"https://github.com/PaulKinlan/transformerjs-breadboard-kit\">code here</a> and if you are using breadboard you can install it as <code>npm i @paulkinlan/transformerjs-breadboard-kit</code></p>\n<p>To create an Breadboard agent you can do it as follows:</p>\n<pre><code class=\"language-fallback\">import { board } from \"@google-labs/breadboard\";\nimport { sentiment } from \"@paulkinlan/transformerjs-breadboard-kit\"\n\nexport default await board(({ text, model }) =&gt; {\n    text.isString();\n    model.isString();\n\n    const summarynode = transformersjs.summarize({\n      $id: \"summary\",\n      input: text,\n      model,\n    });\n\n    return summarynode.to(base.output());\n  }).serialize({\n  title: \"Summary board\",\n  description: \"Runs the summarization analysis with transformer JS\",\n  version: \"0.0.2\",\n});\n</code></pre>\n"
}