Skip to content

Commit

Permalink
fix: 11 notebook typos and grammar
Browse files Browse the repository at this point in the history
  • Loading branch information
john0isaac authored Nov 3, 2023
1 parent 0de5734 commit bf81d86
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions 11-integrating-with-function-calling/Lesson11-FunctionCalling.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
"metadata": {},
"source": [
"\n",
"We want send this to an LLM to parse the data. This can later be used in our an application to send this to an API or store into a database. \n",
"We want to send this to an LLM to parse the data. This can later be used in our application to send this to an API or store it in a database. \n",
"\n",
"Let's create two identical prompts that we instruct the LLM on what information that we are interested in: "
]
Expand All @@ -82,7 +82,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"We want send this to an LLM to parse the parts that are important to our product. So we can create two identical prompts to instruct the LLM: "
"We want to send this to an LLM to parse the parts that are important to our product. So we can create two identical prompts to instruct the LLM: "
]
},
{
Expand Down Expand Up @@ -145,7 +145,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we can send both requests to the LLM and examine the reponse we receive. "
"Now we can send both requests to the LLM and examine the response we receive. "
]
},
{
Expand Down Expand Up @@ -205,13 +205,13 @@
"metadata": {},
"source": [
"\n",
"Even though the prompts are the same and the descriptions are similar, we can different formats of the `Grades` property. \n",
"Even though the prompts are the same and the descriptions are similar, we can get different formats of the `Grades` property. \n",
"\n",
"If you run the above cell multiple times, the format can be `3.7` or `3.7 GPA`. \n",
"\n",
"This is because the LLM takes unstructured data in the form of the written prompt and returns also unstructured data. We need to have structured format so that we know what to expect when storing or using this dat\n",
"This is because the LLM takes unstructured data in the form of the written prompt and returns also unstructured data. We need to have a structured format so that we know what to expect when storing or using this data\n",
"\n",
"By using functional calling, we can make sure that we receive structured data back. When using function calling, the LLM does not actual call or run any functions. Instead, we create a structure for the LLM to follow for its responses. We then use those structured responses to know what function to run in our applications. \n",
"By using functional calling, we can make sure that we receive structured data back. When using function calling, the LLM does not actually call or run any functions. Instead, we create a structure for the LLM to follow for its responses. We then use those structured responses to know what function to run in our applications. \n",
" "
]
},
Expand Down Expand Up @@ -240,11 +240,11 @@
"\n",
"\n",
"**Create API or Database Queries**\n",
"Users can find information using natural language that gets converted into a formatted query or API request. An example of this could be a teacher that request \"Who are the students that completed the last assignment\" which could call a function named `get_completed(student_name: string, assignment: int, current_status: string)`\n",
"Users can find information using natural language that gets converted into a formatted query or API request. An example of this could be a teacher who requests \"Who are the students that completed the last assignment\" which could call a function named `get_completed(student_name: string, assignment: int, current_status: string)`\n",
"\n",
"\n",
"**Creating Structured Data**\n",
"Users can take the a block of text or CSV and use the LLM to extract important information from it. For example, a student can convert Wikipedia article about peace agreements to create AI flash cards. This can be done by using a function called `get_important_facts(agreement_name: string, date_signed: string, parties_involved: list)`"
"Users can take a block of text or CSV and use the LLM to extract important information from it. For example, a student can convert a Wikipedia article about peace agreements to create AI flash cards. This can be done by using a function called `get_important_facts(agreement_name: string, date_signed: string, parties_involved: list)`"
]
},
{
Expand Down Expand Up @@ -274,9 +274,9 @@
"\n",
"#### Users Input \n",
"\n",
"The first step is to create a user message. This can be dynamically assigned by take the value of a text input or you can assign a value here. If this is your first time working with the Chat Completions API, we need to define the `role` and the `content` of the message. \n",
"The first step is to create a user message. This can be dynamically assigned by taking the value of a text input or you can assign a value here. If this is your first time working with the Chat Completions API, we need to define the `role` and the `content` of the message. \n",
"\n",
"The `role` can be either `system` (creating rules) , `assistant` (the model) or `user` (the end-user). For function calling, we will assign this as `user` and an example question. "
"The `role` can be either `system` (creating rules), `assistant` (the model) or `user` (the end-user). For function calling, we will assign this as `user` and an example question. "
]
},
{
Expand All @@ -285,7 +285,7 @@
"metadata": {},
"outputs": [],
"source": [
"messages= [ {\"role\": \"user\", \"content\": \"Find me a good course for a beginner students to learn Azure.\"} ]"
"messages= [ {\"role\": \"user\", \"content\": \"Find me a good course for a beginner student to learn Azure.\"} ]"
]
},
{
Expand All @@ -294,9 +294,9 @@
"source": [
"### Creating functions. \n",
"\n",
"Next we will can define a function and their parameters of that function. We will use just one function here called `search_courses` but you can create multiple functions.\n",
"Next we will define a function and the parameters of that function. We will use just one function here called `search_courses` but you can create multiple functions.\n",
"\n",
"**Important** : Functions are included in thee system message to the LLM and will be included in the amount of available tokens you have available. "
"**Important** : Functions are included in the system message to the LLM and will be included in the amount of available tokens you have available. "
]
},
{
Expand Down Expand Up @@ -341,7 +341,7 @@
"\n",
"`name` - The name of the function that we want to have called. \n",
"\n",
"`description` - This is the description of how the function works. Here its important to be specific and clear \n",
"`description` - This is the description of how the function works. Here it's important to be specific and clear \n",
"\n",
"`parameters` - A list of values and format that you want the model to produce in its response \n",
"\n",
Expand All @@ -351,7 +351,7 @@
"`properties` - List of the specific values that the model will use for its response \n",
"\n",
"\n",
"`name` - the name of the property that model will use in its formatted response \n",
"`name` - the name of the property that the model will use in its formatted response \n",
"\n",
"`type` - The data type of the this property \n",
"\n",
Expand All @@ -368,7 +368,7 @@
"metadata": {},
"source": [
"### Making the function call \n",
"After defining a function, we now need to include it in the call to the Chat Completion API. We do this by adding `functions` to the request. In this case `functions=functions` . \n",
"After defining a function, we now need to include it in the call to the Chat Completion API. We do this by adding `functions` to the request. In this case `functions=functions`. \n",
"\n",
"There is also an option to set `function_call` to `auto`. This means we will let the LLM decide which function should be called based on the user message rather than assigning it ourselves."
]
Expand Down Expand Up @@ -417,7 +417,7 @@
"\n",
"To integrate this into our application, let's take the following steps: \n",
"\n",
"First, lets make the call to the Open AI services and store the message in a variable called `response_message`. "
"First, let's make the call to the Open AI services and store the message in a variable called `response_message`. "
]
},
{
Expand Down Expand Up @@ -466,7 +466,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"As a best practice, we will then see if the model wants to call a function. After that, we will create a of the available functions and match it to the function that is being called. \n",
"As a best practice, we will then see if the model wants to call a function. After that, we will create one of the available functions and match it to the function that is being called. \n",
"We will then take the arguments of the function and map them to arguments of from the LLM.\n",
"\n",
"Lastly, we will append the function call message and the values that were returned by the `search_courses` message. This gives the LLM all the information it needs to\n",
Expand Down Expand Up @@ -527,7 +527,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Now we will send the updated message to the LLM so we can recieve a natural language response instead of an API JSON formatted response. "
"Now we will send the updated message to the LLM so we can receive a natural language response instead of an API JSON formatted response. "
]
},
{
Expand Down Expand Up @@ -561,7 +561,7 @@
"Great work! To continue your learning of Azure Open AI Function Calling you can build: https://learn.microsoft.com/training/support/catalog-api-developer-reference?WT.mc_id=academic-105485-koreyst \n",
" - More parameters of the function that might help learners find more courses. You can find the available API parameters here: \n",
" - Create another function call that takes more information from the learner like their native language \n",
" - Create error handling on when the function call and/or API call does not return any suitable courses "
" - Create error handling when the function call and/or API call does not return any suitable courses "
]
}
],
Expand Down

0 comments on commit bf81d86

Please sign in to comment.