Well, that was a sneaky detour I took you on in the last one.
I hope you enjoyed it though, and I hope you found it satisfying and that you're playing around with
that week.
4.5 day 4.5 right now.
But back to the main plan, which was that we were going to talk about Lang chain expression language,
which is the way that you can set up your chains in Lang chain, which is how Lang Chain thinks about
the different steps in the puzzle that are glued together to solve your pipeline.
And you can do that by putting together a file that expresses, in a declarative style what it is that
you're looking to achieve.
So this LCL lang chain expression language can be used to lay out what you want to do.
It's in the form of a YAML file.
If you're familiar with YAML files and it looks like this.
And if we look if we read through this, you can see that we've got here we're specifying a model with
a temperature with a directory that, that um, that will be the persistent directory for our vector
database.
And then we have these different components the LM which is of type chat, open AI.
We have the conversation memory.
We have the open AI embeddings, the chroma vector store, the retriever and the chain and the output.
So hopefully you see how this maps very closely indeed to the Python code that we wrote.
And you can imagine that these kinds of declarative models can be put together to solve all sorts of
problems.
So it's a very powerful language, and it's by people who have spent time with it.
I think it's it's very productive at this point.
My personal preference is to stick with Python code and use that to put this together, to put together
our workflows as we did before.
But if this interests you, you could look more at this and consider this as an alternative.
And if you come across this in some other project, you hopefully won't be perturbed by it.
It maps pretty closely to the Python code, so the next thing I wanted to do was just talk a little
bit about how Lang Chain works behind the scenes, but hopefully at this point you've got a pretty good
intuition into that already.
Uh Langshan isn't doing a ton of magic.
It's just very convenient indeed.
But really, it is just making the right calls to the different underlying components like chroma or
Feis.
It's retrieving the right, uh, documents, and then it is stitching them into the prompt.
So I'm going to show you in a second how we can use things called callbacks to get langshan to tell
us what actually was the prompt that it is sending to OpenAI.
At the end of the day, after it's done this lookup, and we can use that to diagnose a common problem
that happens, which is what happens if, for whatever reason, the right chunks aren't sent to the
to the model, or at least not the chunk that we really wanted, so that it doesn't provide us with
the kind of answer we wanted.
Well, then fix that problem, and we'll end with some thoughts on just demystifying the whole, uh,
infrastructure that Langshan provides us.
And with that, we'll head back to JupyterLab for the real day five this time.