Text Generation
Transformers.js
ONNX
llama
webgpu
q4f16
gptq
tool-calling
experimental
conversational
Instructions to use webbrain-one/webbrain-compass-tiny-v2.1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use webbrain-one/webbrain-compass-tiny-v2.1 with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('text-generation', 'webbrain-one/webbrain-compass-tiny-v2.1');
| // Portable CPU-only checks for the separately audited optional helper. | |
| import test from 'node:test'; | |
| import assert from 'node:assert/strict'; | |
| import {parseMiniCpmParamValue as parse, parseMiniCpmToolCalls as calls} from './minicpm5-tool-parser.mjs'; | |
| const tools = [{type: 'function', function: {name: 'save_labels', parameters: { | |
| type: 'object', properties: {labels: {type: 'array', items: {type: 'string'}}, enabled: {type: 'boolean'}}, | |
| }}}]; | |
| const xml = '<function name="save_labels"><param name="labels">[\'green\', \'amber\']</param><param name="enabled">False</param></function>'; | |
| test('v24 native list and boolean keep their argument types', () => { | |
| assert.deepEqual(JSON.parse(calls(xml, tools)[0].function.arguments), {labels: ['green', 'amber'], enabled: false}); | |
| }); | |
| test('CDATA URL and string-typed JSON stay strings', () => { | |
| assert.equal(parse('<![CDATA[https://example.net/find?name=blue&sort=recent]]>', {type: 'string'}), 'https://example.net/find?name=blue&sort=recent'); | |
| assert.equal(parse('{"message":""}', {type: 'string'}), '{"message":""}'); | |
| }); | |
| test('unknown tool names and mixed unknown batches are rejected', () => { | |
| const unknown = '<function name="unprovided_tool"></function>'; | |
| assert.deepEqual(calls(unknown, tools), []); | |
| assert.deepEqual(calls(xml + unknown, tools), []); | |
| assert.deepEqual(calls(xml, []), []); | |
| }); | |
| test('malformed and duplicate native fields are not repaired', () => { | |
| assert.deepEqual(calls(xml.replace('</function>', ''), tools), []); | |
| assert.deepEqual(calls(xml.replace('</function>', '<param name="enabled">True</param></function>'), tools), []); | |
| assert.deepEqual(calls(xml + 'garbage', tools), []); | |
| }); | |
| test('nested literals do not evaluate code or pollute prototypes', () => { | |
| assert.deepEqual(parse("{'flag': True, 'next': None, 'xs': [1, 2.5]}"), {flag: true, next: null, xs: [1, 2.5]}); | |
| assert.equal(parse("['x', dangerous()]"), "['x', dangerous()]"); | |
| assert.equal(parse('True + exec()'), 'True + exec()'); | |
| parse("{'__proto__': {'polluted': True}}"); | |
| assert.equal(Object.prototype.polluted, undefined); | |
| }); | |
| test('zero-argument native functions remain valid', () => { | |
| const result = calls('<function name="get_accessibility_tree"></function>', new Set(['get_accessibility_tree'])); | |
| assert.equal(result.length, 1); | |
| assert.deepEqual(JSON.parse(result[0].function.arguments), {}); | |
| }); | |