Skip to content

Commit

Permalink
fix: add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
joschkabraun committed Feb 1, 2024
1 parent 49e9631 commit 275c4fc
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/utils/wrap_openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ function wrapMethod(method: Function, idxArgs: number = 0) {

try {
response = await method.apply(this, args);
console.log('response in try', response);
if (idxArgs > 0) {
await args[0].logger.info(`response in try: ${response}`);
}
traceInsert(traceId, {
output: getOutput(response),
input_tokens: response.usage.prompt_tokens,
Expand All @@ -72,8 +74,10 @@ function wrapMethod(method: Function, idxArgs: number = 0) {
latency: (endTimestamp.getTime() - startTimestamp.getTime()) / 1000,
status: status,
});
console.log('traceLog in finally', traceLog);
console.log('pareaLogger in finally', pareaLogger);
if (idxArgs > 0) {
await args[0].logger.info(`'traceLog in finally: ${traceLog}`);
await args[0].logger.info(`pareaLogger in finally: ${pareaLogger}`);
}
await pareaLogger.recordLog(traceLog);
}

Expand Down

0 comments on commit 275c4fc

Please sign in to comment.