Using Semantic Kernel to connect to AI services
To complete this section, you must have an API key. The process to obtain an API key was described at the beginning of this chapter.
In the upcoming subsections, we are only going to connect to the OpenAI text models GPT-3.5 and GPT-4. If you have access to the OpenAI models through Azure, you will need to make minor modifications to your code.
Although it would be simpler to connect to a single model, we are already going to show a simple but powerful Microsoft Semantic Kernel feature: we’re going to connect to two different models and run a simple prompt using the simpler but less expensive model, GPT-3.5, and a more complex prompt on the more advanced but also more expensive model, GPT-4.
This process of sending simpler requests to simpler models and more complex requests to more complex models is something that you will frequently do when creating your own applications. This approach is called LLM cascade, and it was...