Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Building AI Applications with Microsoft Semantic Kernel

You're reading from   Building AI Applications with Microsoft Semantic Kernel Easily integrate generative AI capabilities and copilot experiences into your applications

Arrow left icon
Product type Paperback
Published in Jun 2024
Publisher Packt
ISBN-13 9781835463703
Length 252 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Lucas A. Meyer Lucas A. Meyer
Author Profile Icon Lucas A. Meyer
Lucas A. Meyer
Arrow right icon
View More author details
Toc

Table of Contents (14) Chapters Close

Preface 1. Part 1:Introduction to Generative AI and Microsoft Semantic Kernel FREE CHAPTER
2. Chapter 1: Introducing Microsoft Semantic Kernel 3. Chapter 2: Creating Better Prompts 4. Part 2: Creating AI Applications with Semantic Kernel
5. Chapter 3: Extending Semantic Kernel 6. Chapter 4: Performing Complex Actions by Chaining Functions 7. Chapter 5: Programming with Planners 8. Chapter 6: Adding Memories to Your AI Application 9. Part 3: Real-World Use Cases
10. Chapter 7: Real-World Use Case – Retrieval-Augmented Generation 11. Chapter 8: Real-World Use Case – Making Your Application Available on ChatGPT 12. Index 13. Other Books You May Enjoy

Technical requirements

To complete this chapter, you will need to have a recent, supported version of your preferred Python or C# development environment:

  • For Python, the minimum supported version is Python 3.10, and the recommended version is Python 3.11
  • For C#, the minimum supported version is .NET 8

Important note

The examples are presented in C# and Python, and you can choose to only read the examples of your preferred language. Occasionally, a feature is available in only one of the languages. In such cases, we provide an alternative in the other language for how to achieve the same objectives.

In this chapter, we will call OpenAI services. Given the amount that companies spend on training these large language models (LLMs), it’s no surprise that using these services is not free. You will need an OpenAI API key, obtained either directly through OpenAI or Microsoft, via the Azure OpenAI service.

Important: Using the OpenAI services is not free

The examples that we will run throughout this book will call the OpenAI API. These calls require a paid subscription, and each call will incur a cost. The costs are usually small per request (for example, GPT-4 costs up to $0.12 per 1,000 tokens), but they can add up. In addition, note that different models have different prices, with GPT-3.5 being 30 times less expensive per token than GPT-4.

OpenAI pricing information can be found here: https://openai.com/pricing

Azure OpenAI pricing information can be found here: https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service/

If you use .NET, the code for this chapter is at https://github.com/PacktPublishing/Building-AI-Applications-with-Microsoft-Semantic-Kernel/tree/main/dotnet/ch1.

If you use Python, the code for this chapter is at https://github.com/PacktPublishing/Building-AI-Applications-with-Microsoft-Semantic-Kernel/tree/main/python/ch1.

You can install the required packages by going to the GitHub repository and using the following: pip install -r requirements.txt.

Obtaining an OpenAI API key

  1. Go to the OpenAI Platform website (https://platform.openai.com).
  2. Sign up for a new account or sign in with an existing account. You can use your email or an existing Microsoft, Google, or Apple account.
  3. On the left sidebar menu, select API keys.
  4. On the Project API keys screen, click the button labeled + Create new secret key (optionally, give it a name).

Important

You have to copy and save the key immediately. It will disappear as soon as you click Done. If you didn’t copy the key or if you lost it, you need to generate a new one. There’s no cost to generate a new key. Remember to delete old keys.

Obtaining an Azure OpenAI API key

Currently, you need to submit an application to obtain access to the Azure OpenAI Service. To apply for access, you need to complete a form at https://aka.ms/oai/access.

The instructions to obtain an Azure OpenAI API key are available at https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime