Skip to content

Commit

Permalink
Merge branch 'main' into split-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Jan 2, 2025
2 parents 495f2e0 + 3c304ff commit d34ea7a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/binding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
1 change: 1 addition & 0 deletions test/__snapshots__/index.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
Expand Down

0 comments on commit d34ea7a

Please sign in to comment.