Skip to content

Commit

Permalink
chore: Add modelName, sessionId, requestId usage (#5670)
Browse files Browse the repository at this point in the history
https://linear.app/thirdweb/issue/DASH-574/add-nebula-usage-tracker-events

<!-- start pr-codex -->

---

## PR-Codex overview
This PR introduces additional properties to the `usageEventSchema` in the `service-utils` package, enhancing the tracking of usage events by including identifiers for the model, session, and request.

### Detailed summary
- Added `modelName`, `sessionId`, and `requestId` as optional string fields to the `usageEventSchema` in `packages/service-utils/src/core/usage.ts`.

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`

<!-- end pr-codex -->
  • Loading branch information
arcoraven committed Dec 10, 2024
1 parent 3b53732 commit e702490
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/gold-gorillas-clap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@thirdweb-dev/service-utils": patch
---

Add modelName, sessionId, requestId to usage
3 changes: 3 additions & 0 deletions packages/service-utils/src/core/usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,8 @@ export const usageEventSchema = z.object({
providerIp: z.string().optional(),
promptTokens: z.number().int().nonnegative().optional(),
completionTokens: z.number().int().nonnegative().optional(),
modelName: z.string().optional(),
sessionId: z.string().optional(),
requestId: z.string().optional(),
});
export type UsageEvent = z.infer<typeof usageEventSchema>;

0 comments on commit e702490

Please sign in to comment.