Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
machineuser commited on
Commit ·
ca548dc
1
Parent(s): 803a700
Sync widgets demo
Browse filesFiles changed (11)
- packages/inference/README.md+15
- packages/inference/package.json+1-1
- packages/inference/src/lib/makeRequestOptions.ts+19-11
- packages/inference/src/tasks/custom/streamingRequest.ts+1-1
- packages/jinja/package.json+1-1
- packages/jinja/src/ast.ts+8-1
- packages/jinja/src/parser.ts+25-6
- packages/jinja/src/runtime.ts+52-1
- packages/jinja/test/e2e.test.js+40
- packages/jinja/test/templates.test.js+126
- packages/tasks/src/model-libraries.ts+3-3
505 unmodified lines506507508509510511512513514515516517518519520521522523524525526505 unmodified linesconst { generated_text } = await gpt2.textGeneration({inputs: 'The answer to the universe is'});```
By default, all calls to the inference endpoint will wait until the model isloaded. When [scaling to0](https://huggingface.co/docs/inference-endpoints/en/autoscaling#scaling-to-0)is enabled on the endpoint, this can result in non-trivial waiting time. Ifyou'd rather disable this behavior and handle the endpoint's returned 500 HTTPerrors yourself, you can do so like so:
```typescriptconst gpt2 = hf.endpoint('https://xyz.eu-west-1.aws.endpoints.huggingface.cloud/gpt2');const { generated_text } = await gpt2.textGeneration( {inputs: 'The answer to the universe is'}, {retry_on_error: false},);```
## Running tests
```console1233456{ "name": "@huggingface/inference", "version": "2.6.4", "version": "2.6.6", "packageManager": "pnpm@8.10.5", "license": "MIT", "author": "Tim Mikeladze <tim.mikeladze@gmail.com>",26 unmodified lines2728293030313233343536373839404123 unmodified lines656667606162636465666768696869707172737475767778798026 unmodified lines // eslint-disable-next-line @typescript-eslint/no-unused-vars const { accessToken, model: _model, ...otherArgs } = args; let { model } = args; const { forceTask: task, includeCredentials, taskHint, ...otherOptions } = options ?? {}; const { forceTask: task, includeCredentials, taskHint, wait_for_model, use_cache, dont_load_model, ...otherOptions } = options ?? {};
const headers: Record<string, string> = {}; if (accessToken) {23 unmodified lines
if (!binary) { headers["Content-Type"] = "application/json"; } else { if (options?.wait_for_model) { headers["X-Wait-For-Model"] = "true"; } if (options?.use_cache === false) { headers["X-Use-Cache"] = "false"; } if (options?.dont_load_model) { headers["X-Load-Model"] = "0"; } }
if (wait_for_model) { headers["X-Wait-For-Model"] = "true"; } if (use_cache === false) { headers["X-Use-Cache"] = "false"; } if (dont_load_model) { headers["X-Load-Model"] = "0"; }
const url = (() => {18 unmodified lines192021222223242518 unmodified lines const response = await (options?.fetch ?? fetch)(url, info);
if (options?.retry_on_error !== false && response.status === 503 && !options?.wait_for_model) { return streamingRequest(args, { return yield* streamingRequest(args, { ...options, wait_for_model: true, });12344567{ "name": "@huggingface/jinja", "packageManager": "pnpm@8.10.5", "version": "0.2.1", "version": "0.2.2", "description": "A minimalistic JavaScript implementation of the Jinja templating engine, specifically designed for parsing and rendering ML chat templates.", "repository": "https://github.com/huggingface/huggingface.js.git", "publishConfig": {33 unmodified lines343536373738394095 unmodified lines13613713813914014114214314414514614714833 unmodified lines override type = "For";
constructor( public loopvar: Identifier, public loopvar: Identifier | TupleLiteral, public iterable: Expression, public body: Statement[] ) {95 unmodified lines override type = "ArrayLiteral";}
/** * Represents a tuple literal in the template. */export class TupleLiteral extends Literal<Expression[]> { override type = "TupleLiteral";}
/** * Represents an object literal in the template. */19 unmodified lines20212223242526146 unmodified lines17317417517617717817918018118218318418518618718818919019117717817919219319419519619719818419920020120211 unmodified lines214215216217218219220221222223259 unmodified lines48348448546748648746948848949049119 unmodified lines UnaryExpression, SliceExpression, KeywordArgumentExpression, TupleLiteral,} from "./ast";
/**146 unmodified lines return new If(test, body, alternate); }
function parseExpressionSequence(primary = false): Statement { const fn = primary ? parsePrimaryExpression : parseExpression; const expressions = [fn()]; const isTuple = is(TOKEN_TYPES.Comma); while (isTuple) { ++current; // consume comma expressions.push(fn()); if (!is(TOKEN_TYPES.Comma)) { break; } } return isTuple ? new TupleLiteral(expressions) : expressions[0]; }
function parseForStatement(): For { // e.g., `message` in `for message in messages` const loopVariable = parsePrimaryExpression(); // should be an identifier if (!(loopVariable instanceof Identifier)) { throw new SyntaxError(`Expected identifier for the loop variable`); const loopVariable = parseExpressionSequence(true); // should be an identifier if (!(loopVariable instanceof Identifier || loopVariable instanceof TupleLiteral)) { throw new SyntaxError(`Expected identifier/tuple for the loop variable, got ${loopVariable.type} instead`); }
expect(TOKEN_TYPES.In, "Expected `in` keyword following loop variable");
// messages in `for message in messages` // `messages` in `for message in messages` const iterable = parseExpression();
expect(TOKEN_TYPES.CloseStatement, "Expected closing statement token");11 unmodified lines
function parseExpression(): Statement { // Choose parse function with lowest precedence return parseTernaryExpression(); }
function parseTernaryExpression(): Statement { const a = parseLogicalOrExpression(); if (is(TOKEN_TYPES.If)) { // Ternary expression259 unmodified lines return new Identifier(token.value); case TOKEN_TYPES.OpenParen: { ++current; // consume opening parenthesis const expression = parseExpression(); const expression = parseExpressionSequence(); if (tokens[current].type !== TOKEN_TYPES.CloseParen) { throw new SyntaxError("Expected closing parenthesis"); throw new SyntaxError(`Expected closing parenthesis, got ${tokens[current].type} instead`); } ++current; // consume closing parenthesis return expression;17 unmodified lines18192021222324114 unmodified lines13914014114214314414514614714814915015115217 unmodified lines170171172173174175176177178179180181182183333 unmodified lines517518519520521522523524525526527528529530531532533257 unmodified lines79179279379479579676779779879980080180280380480580680780880981081181281381481581681781881928 unmodified lines84884985085185285385485517 unmodified lines SliceExpression, KeywordArgumentExpression, ObjectLiteral, TupleLiteral,} from "./ast";import { slice, titleCase } from "./utils";
114 unmodified lines return this.value.get(key.value) ?? defaultValue ?? new NullValue(); }), ], [ "items", new FunctionValue(() => { return new ArrayValue( Array.from(this.value.entries()).map(([key, value]) => new ArrayValue([new StringValue(key), value])) ); }), ], ]);}
17 unmodified lines }}
/** * Represents a Tuple value at runtime. * NOTE: We extend ArrayValue since JavaScript does not have a built-in Tuple type. */export class TupleValue extends ArrayValue { override type = "TupleValue";}
/** * Represents a Function value at runtime. */333 unmodified lines default: throw new Error(`Unknown NumericValue filter: ${filter.value}`); } } else if (operand instanceof ObjectValue) { switch (filter.value) { case "items": return new ArrayValue( Array.from(operand.value.entries()).map(([key, value]) => new ArrayValue([new StringValue(key), value])) ); case "length": return new NumericValue(operand.value.size); default: throw new Error(`Unknown ObjectValue filter: ${filter.value}`); } } throw new Error(`Cannot apply filter "${filter.value}" to type: ${operand.type}`); } else if (node.filter.type === "CallExpression") {257 unmodified lines
scope.setVariable("loop", new ObjectValue(loop));
const current = iterable.value[i];
// For this iteration, set the loop variable to the current element scope.setVariable(node.loopvar.value, iterable.value[i]); if (node.loopvar.type === "Identifier") { scope.setVariable((node.loopvar as Identifier).value, current); } else if (node.loopvar.type === "TupleLiteral") { const loopvar = node.loopvar as TupleLiteral; if (current.type !== "ArrayValue") { throw new Error(`Cannot unpack non-iterable type: ${current.type}`); } const c = current as ArrayValue;
// check if too few or many items to unpack if (loopvar.value.length !== c.value.length) { throw new Error(`Too ${loopvar.value.length > c.value.length ? "few" : "many"} items to unpack`); } for (let j = 0; j < loopvar.value.length; ++j) { if (loopvar.value[j].type !== "Identifier") { throw new Error(`Cannot unpack non-identifier type: ${loopvar.value[j].type}`); } scope.setVariable((loopvar.value[j] as Identifier).value, c.value[j]); } }
// Evaluate the body of the for loop const evaluated = this.evaluateBlock(node.body, scope);28 unmodified lines return new BooleanValue((statement as BooleanLiteral).value); case "ArrayLiteral": return new ArrayValue((statement as ArrayLiteral).value.map((x) => this.evaluate(x, environment))); case "TupleLiteral": return new TupleValue((statement as TupleLiteral).value.map((x) => this.evaluate(x, environment))); case "ObjectLiteral": { const mapping = new Map(); for (const [key, value] of (statement as ObjectLiteral).value) {375 unmodified lines376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421375 unmodified lines // to be repeated twice. We replicate this behaviour here. target: `You are a friendly chatbot who always responds in the style of a pirateYou are a friendly chatbot who always responds in the style of a pirate### Instruction: Hello, how are you?### Response: I'm doing great. How can I help you today?### Instruction: I'd like to show off how chat templating works!`, }, "CohereForAI/c4ai-command-r-v01": { chat_template: `{{ bos_token }}{% if messages[0]['role'] == 'system' %}{% set loop_messages = messages[1:] %}{% set system_message = messages[0]['content'] %}{% else %}{% set loop_messages = messages %}{% set system_message = '## Task and Context\\nYou help people answer their questions and other requests interactively. You will be asked a very wide array of requests on all kinds of topics. You will be equipped with a wide range of search engines or similar tools to help you, which you use to research your answer. You should focus on serving the user\\'s needs as best you can, which will be wide-ranging.\\n\\n## Style Guide\\nUnless the user asks for a different style of answer, you should answer in full sentences, using proper grammar and spelling.' %}{% endif %}` + `{{ '<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>' }}{{ '# Safety Preamble' }}{{ '\nThe instructions in this section override those in the task description and style guide sections. Don\\'t answer questions that are harmful or immoral.' }}{{ '\n\n# System Preamble' }}{{ '\n## Basic Rules' }}{{ '\nYou are a powerful conversational AI trained by Cohere to help people. You are augmented by a number of tools, and your job is to use and consume the output of these tools to best help the user. You will see a conversation history between yourself and a user, ending with an utterance from the user. You will then see a specific instruction instructing you what kind of response to generate. When you answer the user\\'s requests, you cite your sources in your answers, according to those instructions.' }}` + `{{ '\n\n# User Preamble' }}{{ '\n' + system_message }}` + `{{'\n\n## Available Tools\nHere is a list of tools that you have available to you:\n\n'}}{% for tool in tools %}{% if loop.index0 != 0 %}{{ '\n\n'}}{% endif %}{{'\`\`\`python\ndef ' + tool.name + '('}}{% for param_name, param_fields in tool.parameter_definitions.items() %}{% if loop.index0 != 0 %}{{ ', '}}{% endif %}{{param_name}}: {% if not param_fields.required %}{{'Optional[' + param_fields.type + '] = None'}}{% else %}{{ param_fields.type }}{% endif %}{% endfor %}{{ ') -> List[Dict]:\n """'}}{{ tool.description }}{% if tool.parameter_definitions|length != 0 %}{{ '\n\n Args:\n '}}{% for param_name, param_fields in tool.parameter_definitions.items() %}{% if loop.index0 != 0 %}{{ '\n ' }}{% endif %}{{ param_name + ' ('}}{% if not param_fields.required %}{{'Optional[' + param_fields.type + ']'}}{% else %}{{ param_fields.type }}{% endif %}{{ '): ' + param_fields.description }}{% endfor %}{% endif %}{{ '\n """\n pass\n\`\`\`' }}{% endfor %}{{ '<|END_OF_TURN_TOKEN|>'}}` + `{% for message in loop_messages %}{% set content = message['content'] %}{% if message['role'] == 'user' %}{{ '<|START_OF_TURN_TOKEN|><|USER_TOKEN|>' + content.strip() + '<|END_OF_TURN_TOKEN|>' }}{% elif message['role'] == 'system' %}{{ '<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>' + content.strip() + '<|END_OF_TURN_TOKEN|>' }}{% elif message['role'] == 'assistant' %}{{ '<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>' + content.strip() + '<|END_OF_TURN_TOKEN|>' }}{% endif %}{% endfor %}` + `{{'<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>Write \\'Action:\\' followed by a json-formatted list of actions that you want to perform in order to produce a good response to the user\\'s last input. You can use any of the supplied tools any number of times, but you should aim to execute the minimum number of necessary actions for the input. You should use the \`directly-answer\` tool if calling the other tools is unnecessary. The list of actions you want to call should be formatted as a list of json objects, for example:\n\`\`\`json\n[\n {\n "tool_name": title of the tool in the specification,\n "parameters": a dict of parameters to input into the tool as they are defined in the specs, or {} if it takes no parameters\n }\n]\`\`\`<|END_OF_TURN_TOKEN|>'}}{% if add_generation_prompt %}{{ '<|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>' }}{% endif %}`,
data: { messages: [{ role: "user", content: "Whats the biggest penguin in the world?" }], tools: [ { name: "internet_search", description: "Returns a list of relevant document snippets for a textual query retrieved from the internet", parameter_definitions: { query: { description: "Query to search the internet with", type: "str", required: true, }, }, }, { name: "directly_answer", description: "Calls a standard (un-augmented) AI chatbot to generate a response given the conversation history", parameter_definitions: {}, }, ], bos_token: "<BOS_TOKEN>", add_generation_prompt: true, }, target: "<BOS_TOKEN><|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|># Safety Preamble\nThe instructions in this section override those in the task description and style guide sections. Don't answer questions that are harmful or immoral.\n\n# System Preamble\n## Basic Rules\nYou are a powerful conversational AI trained by Cohere to help people. You are augmented by a number of tools, and your job is to use and consume the output of these tools to best help the user. You will see a conversation history between yourself and a user, ending with an utterance from the user. You will then see a specific instruction instructing you what kind of response to generate. When you answer the user's requests, you cite your sources in your answers, according to those instructions." + "\n\n# User Preamble\n## Task and Context\nYou help people answer their questions and other requests interactively. You will be asked a very wide array of requests on all kinds of topics. You will be equipped with a wide range of search engines or similar tools to help you, which you use to research your answer. You should focus on serving the user's needs as best you can, which will be wide-ranging.\n\n## Style Guide\nUnless the user asks for a different style of answer, you should answer in full sentences, using proper grammar and spelling." + '\n\n## Available Tools\nHere is a list of tools that you have available to you:\n\n```python\ndef internet_search(query: str) -> List[Dict]:\n """Returns a list of relevant document snippets for a textual query retrieved from the internet\n\n Args:\n query (str): Query to search the internet with\n """\n pass\n```\n\n```python\ndef directly_answer() -> List[Dict]:\n """Calls a standard (un-augmented) AI chatbot to generate a response given the conversation history\n """\n pass\n```<|END_OF_TURN_TOKEN|>' + "<|START_OF_TURN_TOKEN|><|USER_TOKEN|>Whats the biggest penguin in the world?<|END_OF_TURN_TOKEN|>" + '<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>Write \'Action:\' followed by a json-formatted list of actions that you want to perform in order to produce a good response to the user\'s last input. You can use any of the supplied tools any number of times, but you should aim to execute the minimum number of necessary actions for the input. You should use the `directly-answer` tool if calling the other tools is unnecessary. The list of actions you want to call should be formatted as a list of json objects, for example:\n```json\n[\n {\n "tool_name": title of the tool in the specification,\n "parameters": a dict of parameters to input into the tool as they are defined in the specs, or {} if it takes no parameters\n }\n]```<|END_OF_TURN_TOKEN|><|START_OF_TURN_TOKEN|><|CHATBOT_TOKEN|>', },});
describe("End-to-end tests", () => {26 unmodified lines2728293031323343 unmodified lines7778798081828321 unmodified lines1051061071081091101119 unmodified lines121122123124125126127128129396 unmodified lines526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567817 unmodified lines13851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413603 unmodified lines2017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050174 unmodified lines2225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224779 unmodified lines232723282329233023312332233381 unmodified lines24152416241724182419242024212422242333 unmodified lines2457245824592460246124622463246424659 unmodified lines24752476247724782479248024812482248326 unmodified lines251025112512251325142515251643 unmodified lines256025612562256325642565256621 unmodified lines25882589259025912592259325949 unmodified lines26042605260626072608260926102611261226 unmodified lines
// For loops FOR_LOOP: `{% for message in messages %}{{ message['content'] }}{% endfor %}`, FOR_LOOP_UNPACKING: `|{% for x, y in [ [1, 2], [3, 4] ] %}|{{ x + ' ' + y }}|{% endfor %}|`,
// Set variables VARIABLES: `{% set x = 'Hello' %}{% set y = 'World' %}{{ x + ' ' + y }}`,43 unmodified lines FILTER_OPERATOR_3: `|{{ -1 | abs }}|{{ 1 | abs }}|`, FILTER_OPERATOR_4: `{{ items | selectattr('key') | length }}`, FILTER_OPERATOR_5: `{{ messages | selectattr('role', 'equalto', 'system') | length }}`, FILTER_OPERATOR_6: `|{{ obj | length }}|{{ (obj | items)[1:] | length }}|`,
// Logical operators between non-Booleans BOOLEAN_NUMERICAL: `|{{ 1 and 2 }}|{{ 1 and 0 }}|{{ 0 and 1 }}|{{ 0 and 0 }}|{{ 1 or 2 }}|{{ 1 or 0 }}|{{ 0 or 1 }}|{{ 0 or 0 }}|{{ not 1 }}|{{ not 0 }}|`,21 unmodified lines // Object operators OBJECT_OPERATORS: `|{{ 'known' in obj }}|{{ 'known' not in obj }}|{{ 'unknown' in obj }}|{{ 'unknown' not in obj }}|`, OBJECT_OPERATORS_1: `|{{ obj.get('known') }}|{{ obj.get('unknown') is none }}|{{ obj.get('unknown') is defined }}|`, OBJECT_OPERATORS_2: `|{% for x, y in obj.items() %}|{{ x + ' ' + y }}|{% endfor %}|`,
// Scope SCOPE: `{% set ns = namespace(found=false) %}{% for num in nums %}{% if num == 1 %}{{ 'found=' }}{% set ns.found = true %}{% endif %}{% endfor %}{{ ns.found }}`,9 unmodified lines // Array literals ARRAY_LITERALS: `{{ [1, true, 'hello', [1, 2, 3, 4], var] | length }}`,
// Tuple literals TUPLE_LITERALS: `{{ (1, (1, 2)) | length }}`,
// Object literals OBJECT_LITERALS: `{{ { 'key': 'value', key: 'value2', "key3": [1, {'foo': 'bar'} ] }['key'] }}`,
396 unmodified lines { value: "endfor", type: "EndFor" }, { value: "%}", type: "CloseStatement" }, ], FOR_LOOP_UNPACKING: [ { value: "|", type: "Text" }, { value: "{%", type: "OpenStatement" }, { value: "for", type: "For" }, { value: "x", type: "Identifier" }, { value: ",", type: "Comma" }, { value: "y", type: "Identifier" }, { value: "in", type: "In" }, { value: "[", type: "OpenSquareBracket" }, { value: "[", type: "OpenSquareBracket" }, { value: "1", type: "NumericLiteral" }, { value: ",", type: "Comma" }, { value: "2", type: "NumericLiteral" }, { value: "]", type: "CloseSquareBracket" }, { value: ",", type: "Comma" }, { value: "[", type: "OpenSquareBracket" }, { value: "3", type: "NumericLiteral" }, { value: ",", type: "Comma" }, { value: "4", type: "NumericLiteral" }, { value: "]", type: "CloseSquareBracket" }, { value: "]", type: "CloseSquareBracket" }, { value: "%}", type: "CloseStatement" }, { value: "|", type: "Text" }, { value: "{{", type: "OpenExpression" }, { value: "x", type: "Identifier" }, { value: "+", type: "AdditiveBinaryOperator" }, { value: " ", type: "StringLiteral" }, { value: "+", type: "AdditiveBinaryOperator" }, { value: "y", type: "Identifier" }, { value: "}}", type: "CloseExpression" }, { value: "|", type: "Text" }, { value: "{%", type: "OpenStatement" }, { value: "endfor", type: "EndFor" }, { value: "%}", type: "CloseStatement" }, { value: "|", type: "Text" }, ],
// Set variables VARIABLES: [817 unmodified lines { value: "length", type: "Identifier" }, { value: "}}", type: "CloseExpression" }, ], FILTER_OPERATOR_6: [ { value: "|", type: "Text" }, { value: "{{", type: "OpenExpression" }, { value: "obj", type: "Identifier" }, { value: "|", type: "Pipe" }, { value: "length", type: "Identifier" }, { value: "}}", type: "CloseExpression" }, { value: "|", type: "Text" }, { value: "{{", type: "OpenExpression" }, { value: "(", type: "OpenParen" }, { value: "obj", type: "Identifier" }, { value: "|", type: "Pipe" }, { value: "items", type: "Identifier" }, { value: ")", type: "CloseParen" }, { value: "[", type: "OpenSquareBracket" }, { value: "1", type: "NumericLiteral" }, { value: ":", type: "Colon" }, { value: "]", type: "CloseSquareBracket" }, { value: "|", type: "Pipe" }, { value: "length", type: "Identifier" }, { value: "}}", type: "CloseExpression" }, { value: "|", type: "Text" }, ],
// Logical operators between non-Booleans BOOLEAN_NUMERICAL: [603 unmodified lines { value: "}}", type: "CloseExpression" }, { value: "|", type: "Text" }, ], OBJECT_OPERATORS_2: [ { value: "|", type: "Text" }, { value: "{%", type: "OpenStatement" }, { value: "for", type: "For" }, { value: "x", type: "Identifier" }, { value: ",", type: "Comma" }, { value: "y", type: "Identifier" }, { value: "in", type: "In" }, { value: "obj", type: "Identifier" }, { value: ".", type: "Dot" }, { value: "items", type: "Identifier" }, { value: "(", type: "OpenParen" }, { value: ")", type: "CloseParen" }, { value: "%}", type: "CloseStatement" }, { value: "|", type: "Text" }, { value: "{{", type: "OpenExpression" }, { value: "x", type: "Identifier" }, { value: "+", type: "AdditiveBinaryOperator" }, { value: " ", type: "StringLiteral" }, { value: "+", type: "AdditiveBinaryOperator" }, { value: "y", type: "Identifier" }, { value: "}}", type: "CloseExpression" }, { value: "|", type: "Text" }, { value: "{%", type: "OpenStatement" }, { value: "endfor", type: "EndFor" }, { value: "%}", type: "CloseStatement" }, { value: "|", type: "Text" }, ],
// Scope SCOPE: [174 unmodified lines { value: "}}", type: "CloseExpression" }, ],
// Tuple literals TUPLE_LITERALS: [ { value: "{{", type: "OpenExpression" }, { value: "(", type: "OpenParen" }, { value: "1", type: "NumericLiteral" }, { value: ",", type: "Comma" }, { value: "(", type: "OpenParen" }, { value: "1", type: "NumericLiteral" }, { value: ",", type: "Comma" }, { value: "2", type: "NumericLiteral" }, { value: ")", type: "CloseParen" }, { value: ")", type: "CloseParen" }, { value: "|", type: "Pipe" }, { value: "length", type: "Identifier" }, { value: "}}", type: "CloseExpression" }, ],
// Object literals OBJECT_LITERALS: [ { value: "{{", type: "OpenExpression" },79 unmodified lines { role: "user", content: "C" }, ], }, FOR_LOOP_UNPACKING: {},
// Set variables VARIABLES: {},81 unmodified lines FILTER_OPERATOR_5: { messages: [{ role: "system" }, { role: "user" }, { role: "assistant" }], }, FILTER_OPERATOR_6: { obj: { a: 1, b: 2, c: 3 }, },
// Logical operators between non-Booleans BOOLEAN_NUMERICAL: {},33 unmodified lines known: true, }, }, OBJECT_OPERATORS_2: { obj: { a: 1, b: 2, c: 3 }, },
// Scope SCOPE: { nums: [1, 2, 3] },9 unmodified lines // Array literals ARRAY_LITERALS: { var: true },
// Tuple literals TUPLE_LITERALS: {},
// Object literals OBJECT_LITERALS: { key: "key2",26 unmodified lines
// For loops FOR_LOOP: "ABC", FOR_LOOP_UNPACKING: "||1 2||3 4||",
// Set variables VARIABLES: "Hello World",43 unmodified lines FILTER_OPERATOR_3: `|1|1|`, FILTER_OPERATOR_4: `2`, FILTER_OPERATOR_5: `1`, FILTER_OPERATOR_6: `|3|2|`,
// Logical operators between non-Booleans BOOLEAN_NUMERICAL: `|2|0|0|0|1|1|1|0|false|true|`,21 unmodified lines // Object operators OBJECT_OPERATORS: `|true|false|false|true|`, OBJECT_OPERATORS_1: `|true|true|true|`, OBJECT_OPERATORS_2: `||a 1||b 2||c 3||`,
// Scope SCOPE: `found=true`,9 unmodified lines // Array literals ARRAY_LITERALS: `5`,
// Tuple literals TUPLE_LITERALS: `2`,
// Object literals OBJECT_LITERALS: `value`,
201 unmodified lines202203204205206205206207208209209210211212201 unmodified lines snippets: snippets.mlx, filter: true, }, mlxim: { prettyLabel: "mlxim", "mlx-image": { prettyLabel: "mlx-image", repoName: "mlx-image", repoUrl: "https://github.com/riccardomusmeci/mlx-image", docsUrl: "https://huggingface.co/docs/hub/mlxim", docsUrl: "https://huggingface.co/docs/hub/mlx-image", snippets: snippets.mlxim, filter: false, countDownloads: { term: { path: "model.safetensors" } },packages/inference/README.md+15
packages/inference/package.json+1-1
packages/inference/src/lib/makeRequestOptions.ts+19-11
packages/inference/src/tasks/custom/streamingRequest.ts+1-1
packages/jinja/package.json+1-1
packages/jinja/src/ast.ts+8-1
packages/jinja/src/parser.ts+25-6
packages/jinja/src/runtime.ts+52-1
packages/jinja/test/e2e.test.js+40
packages/jinja/test/templates.test.js+126
packages/tasks/src/model-libraries.ts+3-3