Skip to content

Commit

Permalink
Linting
Browse files Browse the repository at this point in the history
  • Loading branch information
kinyoklion committed Dec 17, 2024
1 parent dfe140e commit f307d45
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ it('tracks error when OpenAI metrics function throws', async () => {
await expect(
tracker.trackOpenAIMetrics(async () => {
throw error;
})
}),
).rejects.toThrow(error);

expect(mockTrack).toHaveBeenCalledWith(
Expand Down Expand Up @@ -357,7 +357,7 @@ it('tracks duration when async function throws', async () => {
await expect(
tracker.trackDurationOf(async () => {
throw error;
})
}),
).rejects.toThrow(error);

expect(mockTrack).toHaveBeenCalledWith(
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/server-ai/src/LDAIConfigTrackerImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class LDAIConfigTrackerImpl implements LDAIConfigTracker {
this.trackTokens(createOpenAiUsage(result.usage));
}
return result;
} catch(err) {
} catch (err) {
this.trackError();
throw err;
}
Expand Down
12 changes: 6 additions & 6 deletions packages/sdk/server-ai/src/api/config/LDAIConfigTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,22 @@ export interface LDAIConfigTracker {

/**
* Track the duration of execution of the provided function.
*
*
* If the provided function throws, then this method will also throw.
* In the case the provided function throws, this function will still record the duration.
*
*
* This function does not automatically record an error when the function throws.
*
*
* @param func The function to track the duration of.
* @returns The result of the function.
*/
trackDurationOf(func: () => Promise<any>): Promise<any>;

/**
* Track an OpenAI operation.
*
*
* This function will track the duration of the operation, the token usage, and the success or error status.
*
*
* If the provided function throws, then this method will also throw.
* In the case the provided function throws, this function will record the duration and an error.
* A failed operation will not have any token usage data.
Expand All @@ -101,7 +101,7 @@ export interface LDAIConfigTracker {

/**
* Track an operation which uses Bedrock.
*
*
* This function will track the duration of the operation, the token usage, and the success or error status.
*
* @param res The result of the Bedrock operation.
Expand Down

0 comments on commit f307d45

Please sign in to comment.