From the course: AI Toolkit Essentials for Visual Studio Code

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

Running a prompt template

Running a prompt template

- [Instructor] In the last video, we started with our hotel concierge prompt template, asking about a city. We created the prompt chain, exported it to a Python script, received a city as a script parameter and replaced all references to Los Angeles with a token in the string. A last thing we need to do is to modify our script to replace the tokens with the parameter passed into the script. And there's a couple ways to do this in Python. We're going to use one that should work on most versions, and that's the format function. The format function is an extension function that we can use to replace all tokens of a particular name with a specified value. In this case, we're going to replace the city token with the city name variable we set from the parameter passed into the script. So we're going to look for "city." All right, and any string we see like this that has this "city" in it, we're going to go to the end of the string and do "dot format." And we're going to replace out..…

Contents