Skip to content

Commit

Permalink
Added logging only after the response feeds in in order to cut down o…
Browse files Browse the repository at this point in the history
…n loggly
  • Loading branch information
justinfarrelldev committed Aug 29, 2024
1 parent 77f119e commit e004cff
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions app/routes/_index/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,6 @@ export async function action({
}

const initialTimestamp = new Date().getTime();

log(
'info',
`[${initialTimestamp}] A user asked the LLM this question: "${userInput.toString()}"`
);

const completion = await openai.chat.completions.create({
messages: [
{ role: 'system', content: wrapWithPrompt(userInput.toString()) },
Expand All @@ -65,7 +59,7 @@ export async function action({

log(
'info',
`[${initialTimestamp}] The LLM responded with the following response: "${completion.choices[0].message.content!}"`
`[${initialTimestamp}] User question: "${userInput.toString()}". The LLM responded with the following response: "${completion.choices[0].message.content!}"`
);

return { role: 'llm', message: completion.choices[0].message.content! };
Expand Down

0 comments on commit e004cff

Please sign in to comment.