📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

Getting Started with LangSmith (2/7): Playground

LangChain3:15

Transcription

In this video, we're going to talk about the playground interface inside of Lsmith. The playground is a sandbox where you can quickly iterate on and test out different prompts from your application. The playground is accessible from the left-hand side pane here, but I actually want to start out in our project where we've already logged a few traces.

If I click into this runnable sequence here, we can see a few different steps. And if I click on the chat OpenAI step in particular, we can see our actual messages that we passed to the model. Our system prompt contains a few facts and instructions for our parent named Poly. We have a human question, and we can see what the model responded with. We can also see here that the model we used was GPT-4 0 mini.

What we can do now is click on this playground button in the upper right-hand side. And this is a great way to jump from an actual iteration of your app straight into the playground where everything is, by default, copied over. But now you can edit and tweak and see how things uh work with different prompts. So, as you can see, we have the same system prompt, the same human prompt, and the same default AI message. If I run this again, it's going to run again with GPT-4 0 mini, and we'll see the same message pop back up.

Let's go ahead and try editing our system prompt. Maybe I add here a fifth fact that says Poly loves pickleball. And if I run this, uh, we can see that it's been reflected in the prompt. Obviously, this is a very toy example, but you can imagine tweaking different things about your prompts. For example, Poly, you are French; you can only respond in French. Um, there's a lot of test and iteration that you can do here.

Cool. Let's go ahead and show off another feature where we can test out different prompts side by side. In our case, uh, you can actually change one of the prompts for them to be different, but we're going to actually swap the model provider here. I can go ahead and, because we're using 40 mini, maybe we test it against Claude 3.5 Sonet. Uh, and if I run this prompt with both, we can see we get two responses side by side. And we can see that Sonet's response here actually isn't great, for whatever reason. And so we probably want to stick with 40 mini. These are insights that you can get pretty quickly when iterating in the playground as opposed to running uh your entire application over again.

We've just scratched the surface of what we can do in the playground, but there are a few other things that I want to call out in terms of configurability. You can actually change the overall um list of messages that we're passing to the model. You can also ask the model to return a particular structured output schema, and you can also ask the model to call a particular tool.

Cool. Thanks for exploring the playground with me.