@qvac/llm-llamacpp 0.58.0 → 0.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -0
- package/index.d.ts +15 -0
- package/package.json +1 -1
- package/prebuilds/android-arm64/qvac__llm-llamacpp.bare +0 -0
- package/prebuilds/darwin-arm64/qvac__llm-llamacpp.bare +0 -0
- package/prebuilds/darwin-arm64/qvac__llm-llamacpp.bare.exports +1 -1
- package/prebuilds/darwin-x64/qvac__llm-llamacpp.bare +0 -0
- package/prebuilds/darwin-x64/qvac__llm-llamacpp.bare.exports +1 -1
- package/prebuilds/ios-arm64/qvac__llm-llamacpp.bare +0 -0
- package/prebuilds/ios-arm64/qvac__llm-llamacpp.bare.exports +1 -1
- package/prebuilds/ios-arm64-simulator/qvac__llm-llamacpp.bare +0 -0
- package/prebuilds/ios-arm64-simulator/qvac__llm-llamacpp.bare.exports +1 -1
- package/prebuilds/ios-x64-simulator/qvac__llm-llamacpp.bare +0 -0
- package/prebuilds/ios-x64-simulator/qvac__llm-llamacpp.bare.exports +1 -1
- package/prebuilds/linux-arm64/qvac__llm-llamacpp.bare +0 -0
- package/prebuilds/linux-x64/qvac__llm-llamacpp.bare +0 -0
- package/prebuilds/win32-x64/qvac__llm-llamacpp.bare +0 -0
- package/prebuilds/win32-x64/qvac__llm-llamacpp.bare.exports +0 -0
package/README.md
CHANGED
|
@@ -14,6 +14,8 @@ This native C++ addon, built using the `Bare` Runtime, simplifies running Large
|
|
|
14
14
|
- [4. Create Model Instance](#4-create-model-instance)
|
|
15
15
|
- [5. Load Model](#5-load-model)
|
|
16
16
|
- [6. Run Inference](#6-run-inference)
|
|
17
|
+
- [Tool calling](#tool-calling)
|
|
18
|
+
- [Batch inference](#batch-inference)
|
|
17
19
|
- [7. Release Resources](#7-release-resources)
|
|
18
20
|
- [API behavior by state](#api-behavior-by-state)
|
|
19
21
|
- [Assessing fit](#assessing-fit)
|
|
@@ -295,6 +297,26 @@ try {
|
|
|
295
297
|
|
|
296
298
|
When `opts.stats` is enabled, `response.stats` includes runtime metrics such as `TTFT`, `TPS`, token counters, and `backendDevice` (`"cpu"` or `"gpu"`). `backendDevice` reflects the resolved device used at runtime after backend selection/fallback logic, not only the requested config.
|
|
297
299
|
|
|
300
|
+
#### Tool calling
|
|
301
|
+
|
|
302
|
+
Load with `config.tools: 'true'` and declare tools as `{ type: 'function', ... }` entries in the message array. The model answers a tool request with a tool-call block in its own format (`<tool_call>` for Qwen). To continue the conversation, put the call on an assistant turn as `tool_calls` and the result on a `tool` turn; the chat template renders both natively, so neither needs to be written into `content`.
|
|
303
|
+
|
|
304
|
+
```javascript
|
|
305
|
+
const response = await model.run([
|
|
306
|
+
{
|
|
307
|
+
type: 'function',
|
|
308
|
+
name: 'get_weather',
|
|
309
|
+
description: 'Get the weather for a city',
|
|
310
|
+
parameters: { type: 'object', properties: { city: { type: 'string' } }, required: ['city'] }
|
|
311
|
+
},
|
|
312
|
+
{ role: 'user', content: 'Weather in Paris?' },
|
|
313
|
+
{ role: 'assistant', content: '', tool_calls: [{ id: 'call_1', name: 'get_weather', arguments: { city: 'Paris' } }] },
|
|
314
|
+
{ role: 'tool', content: '18C', tool_call_id: 'call_1', name: 'get_weather' }
|
|
315
|
+
])
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
`arguments` is an object or the text of a JSON object, and `content` may be empty on the assistant turn. A malformed tool turn is rejected with `InvalidInputFormat`. [`examples/toolCalling.js`](./examples/toolCalling.js) shows a full round trip.
|
|
319
|
+
|
|
298
320
|
#### Batch inference
|
|
299
321
|
|
|
300
322
|
Load the model with `parallel >= 2`, then pass an array of prompts. Each chunk arrives tagged with the id of the sequence that produced it; `await()` returns results in input order.
|
package/index.d.ts
CHANGED
|
@@ -375,8 +375,23 @@ declare namespace LlmLlamacpp {
|
|
|
375
375
|
*/
|
|
376
376
|
reasoning_content?: string;
|
|
377
377
|
type?: undefined;
|
|
378
|
+
/**
|
|
379
|
+
* Tool calls this assistant turn made, rendered by the chat template in
|
|
380
|
+
* the model's own tool-call format. `arguments` is an object or the text
|
|
381
|
+
* of a JSON object. `content` may be empty on such a turn.
|
|
382
|
+
*/
|
|
383
|
+
tool_calls?: ToolCallTurn[];
|
|
384
|
+
/** On a `tool` turn: the id of the call this result answers. */
|
|
385
|
+
tool_call_id?: string;
|
|
386
|
+
/** On a `tool` turn: the name of the tool that produced the result. */
|
|
387
|
+
name?: string;
|
|
378
388
|
[key: string]: any;
|
|
379
389
|
}
|
|
390
|
+
interface ToolCallTurn {
|
|
391
|
+
id?: string;
|
|
392
|
+
name: string;
|
|
393
|
+
arguments?: string | Record<string, unknown>;
|
|
394
|
+
}
|
|
380
395
|
interface UserMediaMessage {
|
|
381
396
|
role: "user";
|
|
382
397
|
type: "media";
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|