|
16 | 16 | "After completing this lesson you will know how to and understand: \n",
|
17 | 17 | "\n",
|
18 | 18 | "- The purpose of using function calling \n",
|
19 |
| - "- Setup Function Call using the Open AI Service \n", |
| 19 | + "- Setup Function Call using the OpenAI Service \n", |
20 | 20 | "- Design effective function calls for your applications use case "
|
21 | 21 | ]
|
22 | 22 | },
|
|
29 | 29 | "For this lesson, we want to build a feature for our education startup that allows users to use a chatbot to find technical courses. We will recommend courses that fit their skill level, current role and technology of interest. \n",
|
30 | 30 | "\n",
|
31 | 31 | "To complete this we will use a combination of: \n",
|
32 |
| - " - `Open AI` to create a chat experience for the user\n", |
| 32 | + " - `OpenAI` to create a chat experience for the user\n", |
33 | 33 | " - `Microsoft Learn Catalog API` to help users find courses based on the request of the user \n",
|
34 | 34 | " - `Function Calling` to take the user's query and send it to a function to make the API request. \n",
|
35 | 35 | "\n",
|
|
59 | 59 | "\n",
|
60 | 60 | "If you have completed any other lesson in this course, you probably understand the power of using Large Language Models (LLMs). Hopefully you can also see some of their limitations as well. \n",
|
61 | 61 | "\n",
|
62 |
| - "Function Calling is a feature of the Open AI Service to overcome to the following limitations: \n", |
63 |
| - "1) Consistent response format \n", |
64 |
| - "2) Ability to use data from other sources of an application in a chat context \n", |
| 62 | + "Function Calling is a feature of the OpenAI Service designed to address the following challenges:\n", |
65 | 63 | "\n",
|
66 |
| - "Before function calling, responses from an LLM were unstructured and inconsistent. Developers were required to write complex validation code to make sure they are able to handle each variation of a response. \n", |
| 64 | + "Inconsistent Response Formatting:\n", |
| 65 | + "- Before function calling, responses from a large language model were unstructured and inconsistent. Developers had to write complex validation code to handle each variation in the output.\n", |
67 | 66 | "\n",
|
68 |
| - "Users could not get answers like \"What is the current weather in Stockholm?\". This is because models were limited to the time the data was trained on. \n", |
| 67 | + "Limited Integration with External Data:\n", |
| 68 | + "- Prior to this feature, it was difficult to incorporate data from other parts of an application into a chat context.\n", |
| 69 | + "\n", |
| 70 | + "By standardizing response formats and enabling seamless integration with external data, function calling simplifies development and reduces the need for additional validation logic.\n", |
| 71 | + "\n", |
| 72 | + "Users could not get answers like \"What is the current weather in Stockholm?\". This is because models were limited to the time the data was trained on. \n", |
69 | 73 | "\n",
|
70 | 74 | "Let's look at the example below that illustrates this problem: \n",
|
71 | 75 | "\n",
|
|
363 | 367 | "source": [
|
364 | 368 | "**Definitions** \n",
|
365 | 369 | "\n",
|
| 370 | + "The function definition structure has multiple levels, each with its own properties. Here's a breakdown of the nested structure:\n", |
| 371 | + "\n", |
| 372 | + "**Top Level Function Properties:**\n", |
| 373 | + "\n", |
366 | 374 | "`name` - The name of the function that we want to have called. \n",
|
367 | 375 | "\n",
|
368 | 376 | "`description` - This is the description of how the function works. Here it's important to be specific and clear \n",
|
369 | 377 | "\n",
|
370 | 378 | "`parameters` - A list of values and format that you want the model to produce in its response \n",
|
371 | 379 | "\n",
|
| 380 | + "**Parameters Object Properties:**\n", |
372 | 381 | "\n",
|
373 |
| - "`type` - The data type of the properties will be stored in \n", |
| 382 | + "`type` - The data type of the parameters object (usually \"object\")\n", |
374 | 383 | "\n",
|
375 | 384 | "`properties` - List of the specific values that the model will use for its response \n",
|
376 | 385 | "\n",
|
| 386 | + "**Individual Parameter Properties:**\n", |
377 | 387 | "\n",
|
378 |
| - "`name` - the name of the property that the model will use in its formatted response \n", |
379 |
| - "\n", |
380 |
| - "`type` - The data type of the this property \n", |
| 388 | + "`name` - Implicitly defined by the property key (e.g., \"role\", \"product\", \"level\")\n", |
381 | 389 | "\n",
|
382 |
| - "`description` - Description of the specific property \n", |
| 390 | + "`type` - The data type of this specific parameter (e.g., \"string\", \"number\", \"boolean\") \n", |
383 | 391 | "\n",
|
| 392 | + "`description` - Description of the specific parameter \n", |
384 | 393 | "\n",
|
385 |
| - "**Optional**\n", |
| 394 | + "**Optional Properties:**\n", |
386 | 395 | "\n",
|
387 |
| - "`required` - required property for the function call to be completed \n" |
| 396 | + "`required` - An array listing which parameters are required for the function call to be completed \n" |
388 | 397 | ]
|
389 | 398 | },
|
390 | 399 | {
|
|
441 | 450 | "\n",
|
442 | 451 | "To integrate this into our application, let's take the following steps: \n",
|
443 | 452 | "\n",
|
444 |
| - "First, let's make the call to the Open AI services and store the message in a variable called `response_message`. " |
| 453 | + "First, let's make the call to the OpenAI services and store the message in a variable called `response_message`. " |
445 | 454 | ]
|
446 | 455 | },
|
447 | 456 | {
|
|
581 | 590 | "source": [
|
582 | 591 | "## Code Challenge \n",
|
583 | 592 | "\n",
|
584 |
| - "Great work! To continue your learning of Open AI Function Calling you can build: https://learn.microsoft.com/training/support/catalog-api-developer-reference?WT.mc_id=academic-105485-koreyst \n", |
| 593 | + "Great work! To continue your learning of OpenAI Function Calling you can build: https://learn.microsoft.com/training/support/catalog-api-developer-reference?WT.mc_id=academic-105485-koreyst \n", |
585 | 594 | " - More parameters of the function that might help learners find more courses. You can find the available API parameters here: \n",
|
586 | 595 | " - Create another function call that takes more information from the learner like their native language \n",
|
587 | 596 | " - Create error handling when the function call and/or API call does not return any suitable courses "
|
|
0 commit comments