5 Empowering agents with actions

 

This chapter covers

  • How an agent acts outside of itself using actions
  • Defining and using OpenAI functions
  • The Semantic Kernel and how to use semantic functions
  • Synergizing semantic and native functions
  • Instantiating a GPT interface with Semantic Kernel

In this chapter, we explore actions through the use of functions and how agents can use them as well. We’ll start by looking at OpenAI function calling and then quickly move on to another project from Microsoft called Semantic Kernel (SK), which we’ll use to build and manage skills and functions for agents or as agents.

We’ll finish the chapter using SK to host our first agent system. This will be a complete chapter with plenty of annotated code examples.

5.1 Defining agent actions

ChatGPT plugins were first introduced to provide a session with abilities, skills, or tools. With a plugin, you can search the web or create spreadsheets or graphs. Plugins provide ChatGPT with the means to extend the platform.

Figure 5.1 shows how a ChatGPT plugin works. In this example, a new movie recommender plugin has been installed in ChatGPT. When a user asks ChatGPT to recommend a new movie, the large language model (LLM) recognizes that it has a plugin to manage that action. It then breaks down the user request into actionable parameters, which it passes to the new movie recommender.

5.2 Executing OpenAI functions

5.2.1 Adding functions to LLM API calls

5.2.2 Actioning function calls

5.3 Introducing Semantic Kernel

5.3.1 Getting started with SK semantic functions

5.3.2 Semantic functions and context variables

5.4 Synergizing semantic and native functions

5.4.1 Creating and registering a semantic skill/plugin

5.4.2 Applying native functions

5.4.3 Embedding native functions within semantic functions

5.5 Semantic Kernel as an interactive service agent

5.5.1 Building a semantic GPT interface

5.5.2 Testing semantic services

5.5.3 Interactive chat with the semantic service layer