diff --git a/lib/binding.ts b/lib/binding.ts index 2f0afe8..b8ef394 100644 --- a/lib/binding.ts +++ b/lib/binding.ts @@ -53,6 +53,16 @@ export type LlamaCompletionResult = { tokens_predicted: number tokens_evaluated: number truncated: boolean + timings: { + prompt_n: number + prompt_ms: number + prompt_per_token_ms: number + prompt_per_second: number + predicted_n: number + predicted_ms: number + predicted_per_token_ms: number + predicted_per_second: number + } } export type LlamaCompletionToken = { diff --git a/test/__snapshots__/index.test.ts.snap b/test/__snapshots__/index.test.ts.snap index 7ec4d5d..e97995e 100644 --- a/test/__snapshots__/index.test.ts.snap +++ b/test/__snapshots__/index.test.ts.snap @@ -416,6 +416,7 @@ exports[`tokeneize 3`] = ` exports[`work fine 1`] = ` { "text": " swochadoorter scientific WindowsCa occupiedrå alta", + "timings": "Timings: (8) keys", "tokens_evaluated": 18, "tokens_predicted": 10, "truncated": false, diff --git a/test/index.test.ts b/test/index.test.ts index b881462..9519a95 100644 --- a/test/index.test.ts +++ b/test/index.test.ts @@ -18,7 +18,10 @@ it('work fine', async () => { expect(data).toMatchObject({ token: expect.any(String) }) tokens += data.token }) - expect(result).toMatchSnapshot() + expect({ + ...result, + timings: `Timings: (${Object.keys(result.timings).length}) keys` + }).toMatchSnapshot() await waitForExpect(() => { expect(tokens).toBe(result.text) })