Skip to content

Commit

Permalink
added time to first token manual logger (#3363)
Browse files Browse the repository at this point in the history
  • Loading branch information
chitalian authored Mar 3, 2025
1 parent d331f43 commit 1d6785f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion docs/guides/cookbooks/manual-logger-streaming.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,10 @@ await helicone.logSingleRequest(

## Advanced Usage: Tracking Time to First Token

The `logStream` method automatically tracks the time to first token, which is a valuable metric for understanding LLM response latency:
The `logStream` and `logSingleStream` methods automatically track the time to first token, which is a valuable metric for understanding LLM response latency:

```typescript
// Using logStream
helicone.logStream(
requestBody,
async (resultRecorder) => {
Expand All @@ -342,6 +343,9 @@ helicone.logStream(
},
{ "Helicone-User-Id": userId }
);

// Using logSingleStream
helicone.logSingleStream(requestBody, stream, { "Helicone-User-Id": userId });
```

This timing information will be available in your Helicone dashboard, allowing you to monitor and optimize your LLM response times.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class HeliconeManualLogger {
startTime,
endTime: Date.now(),
additionalHeaders,
timeToFirstToken: firstChunkTimeUnix ? firstChunkTimeUnix - startTime : undefined,
});
}

Expand Down
2 changes: 1 addition & 1 deletion sdk/typescript/helpers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@helicone/helpers",
"version": "1.0.5",
"version": "1.0.6",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"description": "A Node.js wrapper for some of Helicone's common functionalities",
Expand Down

0 comments on commit 1d6785f

Please sign in to comment.