Okay, and let's ask our system, when is the next React Query release? It produces an answer, lovely, and it gives us a title of React Query Release. This one above is just a test I did before I started filming.
Now I can go into Langfuse here, go to my project, Matt Pocock demo. I can see two traces.
One trace is that one I did before but the new trace if I go into tracing here it's sorted by timestamp so the top one is the most recent one. We can already see that there's an input here and an output of React Query Release. If I click into here I can see a breakdown of this trace and I'll just make it full screen there.
I'm gonna toggle on the timeline view too so I can see when things happened.
We can see that two processes were kicked off here: chat, which took 2.2 seconds, and title-generation that took 0.45 seconds. Both of them cost an incredibly small amount of money.
If we look at title-generation here, we can see the input and the output, the entire prompt that I gave it and the output it produced. We can even see the latency, 0.45 seconds. The chat took a little bit longer, it took 2.2 seconds.
And we can see the user input and the assistant message that came out. It even does markdown formatting for us which is really nice.
Now this hopefully gives you a little taste for what Langfuse can do. There's a button here called
add to datasets
for instance which allows you to take a chat and just pump it directly into a dataset that you can then run evals on. You can manage your prompts from within Langfuse, which allows non-code contributors to contribute prompts.
You can track user feedback in production. And all of this is described in their docs. Having an observability platform like this is I think the essential thing you need to do before going to production. Even more than evals I have to say, observability is the one indispensable thing you need. And whether you choose Langfuse or Braintrust or any other platform that's on the market, you absolutely have to have one.
So hopefully this exercise has given you a taste of how you might trace your code in production.
Nice work, and I will see you in the next one.