Skip to content

Commit

Permalink
Plurals
Browse files Browse the repository at this point in the history
  • Loading branch information
kinyoklion committed Nov 5, 2024
1 parent fb05b7e commit a4ce22e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/sdk/server-ai/src/LDAIConfigTrackerImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ export class LDAIConfigTrackerImpl implements LDAIConfigTracker {
TRes extends {
usage?: {
total_tokens?: number;
prompt_token?: number;
completion_token?: number;
prompt_tokens?: number;
completion_tokens?: number;
};
},
>(func: () => Promise<TRes>): Promise<TRes> {
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/server-ai/src/api/config/LDAIConfigTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export interface LDAIConfigTracker {
TRes extends {
usage?: {
total_tokens?: number;
prompt_token?: number;
completion_token?: number;
prompt_tokens?: number;
completion_tokens?: number;
};
},
>(
Expand Down
8 changes: 4 additions & 4 deletions packages/sdk/server-ai/src/api/metrics/OpenAiUsage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { LDTokenUsage } from './LDTokenUsage';

export function createOpenAiUsage(data: {
total_tokens?: number;
prompt_token?: number;
completion_token?: number;
prompt_tokens?: number;
completion_tokens?: number;
}): LDTokenUsage {
return {
total: data.total_tokens ?? 0,
input: data.prompt_token ?? 0,
output: data.completion_token ?? 0,
input: data.prompt_tokens ?? 0,
output: data.completion_tokens ?? 0,
};
}

0 comments on commit a4ce22e

Please sign in to comment.