-
Notifications
You must be signed in to change notification settings - Fork 2
Feat/data hub #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/data hub #59
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@scrawn/analytics": patch | ||
| --- | ||
|
|
||
| fix: broken analytics layer | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,6 +2,7 @@ import * as ai from "ai"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { google } from "@ai-sdk/google"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { biller } from "./scrawn/biller.js"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { config } from "dotenv"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { mul, outputTokens } from "@scrawn/core"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| config({ path: ".env.local" }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async function main() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -16,6 +17,19 @@ async function main() { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| prompt: "Write a 2 sentence story about a robot.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const result1 = await ai.streamText({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| model: google("gemini-2.5-flash"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| prompt: "Write a 2 sentence story about a robot.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onFinish: (event) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| biller.trackAI({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| userId: "c0971bcb-b901-4c3e-a191-c9a97871c39f", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| event, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| inputDebit: biller.tag("PREMIUM_CALL"), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| outputDebit: mul(outputTokens(), 0.0001), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log(`Generated: "${await result.text}"\n`); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+20
to
33
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| import { BaseEventBuilder } from "./base.js"; | ||
| import type { GrpcClient } from "@scrawn/core"; | ||
| import { basicUsageFields } from "./fields.js"; | ||
|
|
||
| export class BasicUsageBuilder extends BaseEventBuilder< | ||
| typeof basicUsageFields | ||
| > { | ||
| constructor(grpc: GrpcClient, apiKey: string) { | ||
| super(basicUsageFields, "BASIC_USAGE", grpc, apiKey); | ||
| } | ||
| } |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
patch, but removingsdkEventfrom the publicly exportedEventQueriesinterface and replacing it withbasicUsageis a breaking change for any consumer currently callinganalytics.query.sdkEvent. Per semver, dropping a named property from a published interface requires at minimum aminorbump, and strictly amajorif the package is >= 1.0. Existing user code that destructuressdkEventwill fail at runtime with no compile-time warning until they update.