Clip transcript
the messages, and we have a tool, and we're we're asking the LLM to solve this problem using a tool. Now, here's the here's the catch. LLMs can't do anything. All they can do is give us the next word with a high probability. Amazingly, we can now have these conversations it, but they can't do anything. But, we can give it a tool, and we can give it what we want, and say, "How do you think this tool can help us get what we want?" And then the LLM will set up the parameters, and come back to us, and say, "Okay, here's my response. I can't execute this tool, but I know what the input parameters are. I know what your context is. I know what your prompt is. So, here is the call that you need to make of the tool, because I can't do it. I'm the LLM. I'm just locked in this box. Okay? So, the second box the second chunk is stop reason. So, stop reason means the LLM has stopped for some reason. The The reason here is that it can't do anything, and if the reason is tool use, ah, now it's time. Let's go execute that tool. So, that second line, get tool. It takes the response, which is formulating the the parameters, and triggering the action. Okay. Now, I have this stuff in red here. This is where I think the LLMs and other uh I'm sorry, not LLMs. The ontologies and stuff can come in. So, if you look down there, after the the tool is called, it said tool runs. This is where ontologies could come in. The tool's going to give us information. We put the information in a form that our our our our validator can use, and think about the validator as operating with this these ontologies about our domain, then we can make some sense of whether the response of the LLM is reasonable. So, this is the loop. Call a tool, check the stop reason. If it's a reasonable result, then let's go with it. If it's not reasonable, go back to the LLM. Say, "Oh, this is this is not working." Or get a human in the loop. But the idea is to surround the input with checks. Now, I've got this something that you that you should be at least taking a look at if you're doing some of this coding is something called Pydantic. Pydantic is a way to specify the types of what you want the types of the parameters to be. Those of you who who do know Python, know Python is a unstructured type language. So, you can have a variable x = 20, x = hello, no problem. There's no typing. Pydantic adds typing to that. So, you want to check your types with Pydantic and then check your results with the ontology. So, Pydantic at the door, ontology at the ledger, and pure agents and by the way, your agents should try to have no side effects. That helps the whole logic. Meaning, they're not running off doing something that they're they're changing they're changing things in the database not yet. You want to run them through the ontology first and make sure that works.