-
Notifications
You must be signed in to change notification settings - Fork 31
feat: AI Tracking to AI SDK #652
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
84 commits
Select commit
Hold shift + click to select a range
6895509
chore: Build releases in dependency order. (#563)
kinyoklion 7064b07
chore: release main (#560)
github-actions[bot] fcb821e
chore: Build RN example with detox. (#558)
kinyoklion 3130c1c
chore: Standardize test organization. (#565)
kinyoklion 4792391
feat: Add support for localStorage for the browser platform. (#566)
kinyoklion 907d08b
fix: Correctly handle null values in JSON variations. (#569)
kinyoklion 4932525
chore: Remove unused skip field. (#571)
kinyoklion ed7b27a
chore: release main (#570)
github-actions[bot] fca4d92
fix: Flag store should not access values from prototype. (#567)
kinyoklion 9248035
feat: Add platform support for async hashing. (#573)
kinyoklion e763e5d
feat: Implement browser crypto and encoding. (#574)
kinyoklion a2f4398
feat: Add browser info. (#576)
kinyoklion fe82500
feat: Add support for conditional event source capabilities. (#577)
kinyoklion 887548a
feat: Implement support for browser requests. (#578)
kinyoklion ed5a206
feat: Allow using custom user-agent name. (#580)
kinyoklion d11224c
fix: Use flag value whenever provided even if variaiton is null or un…
kinyoklion 0848ab7
feat: Scaffold browser client. (#579)
kinyoklion 38f081e
feat: Add support for browser contract tests. (#582)
kinyoklion a55be06
chore(deps): bump next from 14.1.2 to 14.2.10 in /packages/sdk/vercel…
dependabot[bot] 916b724
feat: Adds support for REPORT. (#575)
tanderson-ld fd38a8f
feat: Implement goals for client-side SDKs. (#585)
kinyoklion 9d93d2d
chore(deps): bump next from 14.1.2 to 14.2.10 in /packages/sdk/vercel…
dependabot[bot] 7131e69
feat: Add URLs for custom events and URL filtering. (#587)
kinyoklion 7dfb14d
fix: Ensure browser contract tests run during top-level build. (#589)
kinyoklion 53f5bb8
feat: Refactor data source connection handling. (#591)
kinyoklion b6ff2a6
fix: Multi-kind context containing only 1 kind conveted incorrectly. …
kinyoklion dc4eb30
chore: release main (#572)
github-actions[bot] 79d0b3f
chore: Update common version for browser SDK. (#595)
kinyoklion f2e5cbf
feat: Browser-SDK Automatically start streaming based on event handle…
kinyoklion 9e00eb6
chore: Remove unused function in common client-side LDClientImpl. (#597)
kinyoklion 980e4da
fix: Ensure client logger is always wrapped in a safe logger. (#599)
kinyoklion 6f26204
feat: adds datasource status to sdk-client (#590)
tanderson-ld 9ad25bd
chore: Remove shared mocks package. (#601)
kinyoklion 3389983
feat: Add basic secure mode support for browser SDK. (#598)
kinyoklion 8cd0cdc
feat: Add ESM support for common and common-client (rollup) (#604)
kinyoklion 4e5dbee
feat: Add bootstrap support. (#600)
kinyoklion da31436
feat: adds support for individual flag change listeners (#608)
tanderson-ld 04d347b
feat: Add support for hooks. (#605)
kinyoklion 819a311
feat: Add visibility handling to allow proactive event flushing. (#607)
kinyoklion 35fa033
fix: Use flagVersion in analytics events. (#611)
kinyoklion 35ec8d1
fix: Fix base64 encoding of unicode characters. (#613)
kinyoklion 9ef20a5
chore: release main (#596)
github-actions[bot] 7b68c71
chore: Update common client version for browser package. (#614)
kinyoklion 8b967a5
chore: Prepare for browser client releases. (#612)
kinyoklion fdce875
chore: Update pre-release browser config. (#616)
kinyoklion c31ac36
chore: release main (#615)
github-actions[bot] e97f478
chore: Remove release-as version for browser SDK. (#617)
kinyoklion 794dbfc
chore: Float browser contract test dependency. (#618)
kinyoklion 3e6d404
feat: Apply private property naming standard. Mangle browser private …
kinyoklion f6fc40b
fix: Do not mangle _meta. (#622)
kinyoklion a986478
feat: Add support for inspectors. (#625)
kinyoklion 8c84e01
feat: Add support for client-side prerequisite events. (#606)
kinyoklion dee53af
feat: adds ping stream support (#624)
tanderson-ld 2d2accd
fix: Fix common package to work with node16 module resolution. (#627)
kinyoklion 70cf3c3
fix: Prerequisites should not trigger hooks. (#628)
kinyoklion e061811
fix: Update sdk-client rollup configuration to match common (#630)
kinyoklion ae2b5bb
chore: release main (#621)
github-actions[bot] 9f78679
Update tracking methods
da3024f
whitespace changes
9ce1049
fix file organization
48cac54
chore: Change testing to use cjs. (#636)
kinyoklion 8e3120e
chore: Enable polling report contract tests. (#639)
kinyoklion 44a2237
feat: Add a module for increased backward compatibility. (#637)
kinyoklion ec4377c
feat: Refine CJS/ESM build configuration for browser SDK. (#640)
kinyoklion 6cbf4f9
chore: release main (#638)
github-actions[bot] 67b8cb8
chore: Package size reports. (#642)
kinyoklion 2a9a0de
fix: Fix incompatibility with @types/node release. (#646)
kinyoklion 473e0cb
chore: Revert - Fix incompatibility with @types/node release. (#649)
kinyoklion 21670c4
feat: Enhance basic logger destination support. (#650)
kinyoklion 7c5c585
fix accessor style based on feedback
9c6fdd3
fix Bedrock usage
7f58b2a
fix: Export LDInspection interface. (#653)
kinyoklion a543d7e
chore(deps): update reactivecircus/android-emulator-runner digest to …
renovate[bot] 773d02c
chore: Revert "chore(deps): update reactivecircus/android-emulator-ru…
kinyoklion b8a2331
chore: No package-size comments on forks. (#654)
kinyoklion 008dcf0
fix: Export required types from compat. (#645)
kinyoklion aee09c8
feat: Implement jest mocks for react-native. (#535)
professorice 5899e9d
PR feedback
788612c
WIP: Refactoring
kinyoklion 898e61d
WIP: More change.
kinyoklion f95775b
Merge branch 'main' into dob/modelConfig
kinyoklion 9d22b8f
Merge branch 'dob/modelConfig' into feat/dob/aiTracking
kinyoklion 7d489b3
WIP: Comments and organization.
kinyoklion 6c30975
Basic functionality implemented.
kinyoklion File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,17 @@ | ||
| import { BedrockTokenUsage, FeedbackKind, TokenUsage, UnderscoreTokenUsage } from '../metrics'; | ||
| import { FeedbackKind, TokenUsage, UnderscoreTokenUsage } from '../metrics'; | ||
|
|
||
| export interface LDAIConfigTracker { | ||
| trackDuration: (duration: number) => void; | ||
| trackTokens: (tokens: TokenUsage | UnderscoreTokenUsage | BedrockTokenUsage) => void; | ||
| trackTokens: ( | ||
| tokens: | ||
| | TokenUsage | ||
| | UnderscoreTokenUsage | ||
| | { totalTokens: number; inputTokens: number; outputTokens: number }, | ||
| ) => void; | ||
| trackError: (error: number) => void; | ||
| trackGeneration: (generation: number) => void; | ||
| trackFeedback: (feedback: { kind: FeedbackKind }) => void; | ||
| trackDurationOf: (func: (...args: any[]) => Promise<any>, ...args: any[]) => Promise<any>; | ||
| trackOpenAI: (func: Function, ...args: any[]) => any; | ||
| trackBedrockConverse: (res: any) => any; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| export * from './LDAIConfig'; | ||
| export * from './LDAIConfigTracker'; | ||
| export { LDAIConfigTracker } from './LDAIConfigTracker'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,11 @@ | ||
| export interface BedrockTokenUsage { | ||
| export function createBedrockTokenUsage(data: { | ||
| totalTokens: number; | ||
| inputTokens: number; | ||
| outputTokens: number; | ||
| totalTokens: number; | ||
| }) { | ||
| return { | ||
| total: data.totalTokens || 0, | ||
| input: data.inputTokens || 0, | ||
| output: data.outputTokens || 0, | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| export class OpenAITokenUsage { | ||
| total_tokens: number; | ||
| prompt_tokens: number; | ||
| completion_tokens: number; | ||
|
|
||
| constructor(data: any) { | ||
| this.total_tokens = data.total_tokens; | ||
| this.prompt_tokens = data.prompt_tokens; | ||
| this.completion_tokens = data.completion_tokens; | ||
| } | ||
|
|
||
| toMetrics() { | ||
| return { | ||
| total: this.total_tokens, | ||
| input: this.prompt_tokens, | ||
| output: this.completion_tokens, | ||
| }; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,19 @@ | ||
| export interface TokenUsage { | ||
| completionTokens?: number; | ||
| promptTokens?: number; | ||
| totalTokens?: number; | ||
| export class TokenUsage { | ||
| totalTokens: number; | ||
| promptTokens: number; | ||
| completionTokens: number; | ||
|
|
||
| constructor(data: any) { | ||
| this.totalTokens = data.total_tokens || 0; | ||
| this.promptTokens = data.prompt_tokens || 0; | ||
| this.completionTokens = data.completion_tokens || 0; | ||
| } | ||
|
|
||
| toMetrics() { | ||
| return { | ||
| total: this.totalTokens, | ||
| input: this.promptTokens, | ||
| output: this.completionTokens, | ||
| }; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,19 @@ | ||
| export interface UnderscoreTokenUsage { | ||
| completion_tokens?: number; | ||
| prompt_tokens?: number; | ||
| total_tokens?: number; | ||
| export class UnderscoreTokenUsage { | ||
| total_tokens: number; | ||
| prompt_tokens: number; | ||
| completion_tokens: number; | ||
|
|
||
| constructor(data: any) { | ||
| this.total_tokens = data.total_tokens || 0; | ||
| this.prompt_tokens = data.prompt_tokens || 0; | ||
| this.completion_tokens = data.completion_tokens || 0; | ||
| } | ||
|
|
||
| toMetrics() { | ||
| return { | ||
| total: this.total_tokens, | ||
| input: this.prompt_tokens, | ||
| output: this.completion_tokens, | ||
| }; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| export * from './BedrockTokenUsage'; | ||
| export * from './FeedbackKind'; | ||
| export * from './OpenAITokenUsage'; | ||
| export * from './TokenMetrics'; | ||
| export * from './TokenUsage'; | ||
| export * from './UnderScoreTokenUsage'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "extends": "./tsconfig.json", | ||
| "include": ["/**/*.ts"], | ||
| "exclude": ["node_modules"] | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Does this defaultValue line have a typo?
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.
Yeah, there were a number of problems here, but they are updated now. I am going to merge this to the feature PR and work from there.