Azure OpenAI Function Calling

Introduction

The latest versions of gpt-35-turbo and gpt-4 have been fine-tuned to work with functions and are able to both determine when and how a function should be called. If one or more functions are included in your request, the model will then determine if any of the functions should be called based on the context of the prompt. When the model determines that a function should be called, it will then respond with a JSON object including the arguments for the function.

At a high level you can break down working with functions into three steps:

  1. Call the chat completions API with your functions and the user’s input
  2. Use the model’s response to call your API or function
  3. Call the chat completions API again, including the response from your function to get a final response.

Procedure

Clone the following GitHub Repository in your Visual Studio Code editor and then complete the tutorial by watching the video given below.

github repository URL: https://github.com/kuljotSB/cSharpCorner