You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The GPT-3.5, and GPT-4 models from OpenAI are prompt-based optimized for conversational interfaces. With prompt-based models, the user interacts with the model by entering a text prompt, to which the model responds with a text or chat completion. This completion is the model's continuation of the input text.
1
+
The GPT-3.5 and GPT-4 models from OpenAI are prompt-based optimized for conversational interfaces. With prompt-based models, the user interacts with the model by entering a text prompt, to which the model responds with a text or chat completion. This completion is the model's continuation of the input text.
2
2
3
3
You input some text as a prompt, and the model generates a completion that attempts to match whatever context or pattern you gave it. For example, if you give the AI the prompt, "As Descartes said, I think, therefore", it returns the completion " I am" with high probability.
4
4
5
-
At a practical level, the prompt-based models allow you to develop applications that enable users to ask questions of the model as free-form text and the model responds with the answer. GPT-3.5 and GPT-4 are even capable of having multi-turn conversations with the users of your application.
5
+
At a practical level, the prompt-based models allow you to develop applications that enable users to ask questions of the model as free-form text, and the model responds with the answer. GPT-3.5 and GPT-4 are even capable of having multi-turn conversations with the users of your application.
6
6
7
-
For example, imagine you want to build an AI that recommends hikes to people based on the preferences they enter for the hike. The AI could ask them what attributes they are looking for, and then respond based on what they input.
7
+
For example, imagine you want to build an AI that recommends hikes to people based on the preferences they enter for the hike. The AI could ask them what attributes they're looking for, and then respond based on what they input.
8
8
9
9
Let's take a deeper look at both text and completions, how to improve completion quality, and build a simple application that can use Azure OpenAI to chat with the model to get hiking recommendations.
Copy file name to clipboardExpand all lines: learn-pr/azure/open-ai-dotnet-text-completions/includes/2-azure-openai-text-completions-overview.md
+17-17Lines changed: 17 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
Azure OpenAI Service provides REST API access to OpenAI's powerful language models including the GPT-3.5 and GPT-4 model series. These models can be easily adapted to your specific task including but not limited to content generation, summarization, semantic search, and natural language to code translation.
1
+
Azure OpenAI Service provides REST API access to OpenAI's powerful language models, including the GPT-3.5 and GPT-4 model series. These models can be easily adapted to your specific task including but not limited to content generation, summarization, semantic search, and natural language to code translation.
2
2
3
-
In addition to the REST API access, a .NET SDK exists to access Azure OpenAI Service. And that's what we will use to build our application. But before building the application, let's learn a bit more about what Azure OpenAI is and what text completions are. Knowing that give us the foundation we need to build amazing applications with AI.
3
+
In addition to the REST API access, a .NET SDK exists to access Azure OpenAI Service. That's what we'll use to build our application. But before building the application, let's learn a bit more about what Azure OpenAI is and what text completions are. Knowing that gives us the foundation we need to build amazing applications with AI.
4
4
5
5
## Azure OpenAI overview
6
6
@@ -12,7 +12,7 @@ The completions endpoint is the core component of the API service. This API prov
12
12
13
13
## Text completions
14
14
15
-
In this unit we'll learn about text completions. The completions endpoint can be used for a wide variety of tasks. It provides a simple but powerful text-in, text-out interface to any of the Azure OpenAI models. You input some text as a prompt, and the model generates a text completion that attempts to match whatever context or pattern you gave it. For example, if you give the API the prompt, "As Descartes said, I think, therefore", it returns the completion " I am" with high probability.
15
+
In this unit, we'll learn about text completions. The completions endpoint can be used for a wide variety of tasks. It provides a simple but powerful text-in, text-out interface to any of the Azure OpenAI models. You input some text as a prompt, and the model generates a text completion that attempts to match whatever context or pattern you gave it. For example, if you give the API the prompt, "As Descartes said, I think, therefore", it returns the completion " I am" with high probability.
16
16
17
17
The actual completion results you see may differ because the AI is stochastic by default. In other words, you might get a slightly different completion every time you call it, even if your prompt stays the same.
18
18
@@ -22,15 +22,15 @@ We'll take a look at how to write a good prompt a bit later, but for now let's l
22
22
23
23
## Types of Azure OpenAI completions
24
24
25
-
As mentioned, you pass in a prompt to the Azure OpenAI API that provides instructions on what you want it to do. And you can make it do things like classify text, generate ideas, or even translate text into emojis.
25
+
As mentioned, you pass in a prompt to the Azure OpenAI API that provides instructions on what you want it to do. You can make it do things like classify text, generate ideas, or even translate text into emojis.
26
26
27
27
### Classification
28
28
29
29
For this first completion type, let's dive deep into how to "program" the model with instructions.
30
30
31
31
You can tell the model you want it to sort data into predefined categories. This completion type is known as **Classification**.
32
32
33
-
For example, you can pass instructions, or a prompt, similar to following to the completion API:
33
+
For example, you can pass instructions or a prompt, similar to following to the completion API:
34
34
35
35
```
36
36
This is a sentiment classifier
@@ -72,33 +72,33 @@ Sentiment classifications:
72
72
1.
73
73
```
74
74
75
-
After showing the model 4 examples of a sentence classified by sentiment, we then provide it a list of examples and then a list of sentiment ratings with the same number index. The API is able to pick up from this how it is supposed to output the classified sentiments.
75
+
After showing the model 4 examples of a sentence classified by sentiment, we then provide it a list of examples and then a list of sentiment ratings with the same number index. The API is able to pick up from this how it's supposed to output the classified sentiments.
76
76
77
-
And that leads us to what we want the model to do: we give it 5 sentiments for it to classify and then it should output the classification of each in an ordered list.
77
+
That leads us to what we want the model to do: we give it five sentiments to classify, and then it should output the classification of each in an ordered list.
78
78
79
79
This allows the model to rate five (and even more) examples in just one call to it.
80
80
81
-
You can begin to see how the prompt, or the text passed to the model is the programming language.
81
+
You can begin to see how the prompt or the text passed to the model is the programming language.
82
82
83
83
### Generation
84
84
85
-
One of the most powerful yet simplest tasks you can accomplish with the various GPT models is generating new ideas or versions of input. You can give the model a list of a few story ideas and it tries to add to that list. We've seen it create business plans, character descriptions and marketing slogans just by providing it a handful of examples.
85
+
One of the most powerful yet simplest tasks you can accomplish with the various GPT models is generating new ideas or versions of input. You can give the model a list of a few story ideas, and it tries to add to that list. We've seen it create business plans, character descriptions, and marketing slogans just by providing it a handful of examples.
86
86
87
87
### Conversation
88
88
89
-
The model is extremely adept at carrying on conversations with humans and even with itself. With just a few lines of instruction, we've seen the model perform as a customer service chatbot that intelligently answers questions without ever getting flustered or a wise-cracking conversation partner that makes jokes and puns.
89
+
The model is adept at carrying on conversations with humans and even with itself. With just a few lines of instruction, we've seen the model perform as a customer service chatbot that intelligently answers questions without ever getting flustered, or a wise-cracking conversation partner that makes jokes and puns.
90
90
91
91
### Transformation
92
92
93
-
The model is a language model that is familiar with a variety of ways that words and characters can be used to express information. This ranges from natural language text to code and languages other than English. The model is also able to understand content on a level that allows it to summarize, convert and express it in different ways.
93
+
The model is a language model that is familiar with a variety of ways that words and characters can be used to express information. This ranges from natural language text to code and languages other than English. The model is also able to understand content on a level that allows it to summarize, convert, and express it in different ways.
94
94
95
95
#### Translation
96
96
97
-
The model already has a grasp of many languages, such as French, so you do not need to teach it. Instead you just need to provide it enough examples of the translation in the prompt so it understands that it is translating from one language to another.
97
+
The model already has a grasp of many languages, such as French, so you don't need to teach it. Instead, you just need to provide it enough examples of the translation in the prompt so it understands that it's translating from one language to another.
98
98
99
99
#### Conversion
100
100
101
-
In this example we convert the name of a movie into emoji. This shows the adaptability of the model to picking up patterns and working with other characters.
101
+
In this example, we convert the name of a movie into emoji. This shows the adaptability of the model to picking up patterns and working with other characters.
102
102
103
103
Here we expect the output to be an emoji representation of the Spider-Man movie.
104
104
@@ -130,9 +130,9 @@ Vertical farming provides a novel solution for producing food locally, reducing
130
130
131
131
Large language models (LLMs) have a lot of knowledge that they've learned from the data they trained on. They also have the ability to provide responses that sound real but are in fact made up. There are two ways to limit the likelihood of LLMs making up an answer.
132
132
133
-
***1. Provide a ground truth for the API** If you provide the model with a body of text to answer questions about (like a Wikipedia entry) it is less likely to confabulate a response.
133
+
***1. Provide a ground truth for the API.**: If you provide the model with a body of text to answer questions about (like a Wikipedia entry), it's less likely to confabulate a response.
134
134
135
-
***2. Use a low probability and show the API how to say "I don't know"** If the model understands that in cases where it's less certain about a response that saying "I don't know" or some variation is appropriate, it is less inclined to make up answers.
135
+
***2. Use a low probability and show the API how to say "I don't know."**: If the model understands that in cases where it's less certain about a response that saying "I don't know" or some variation is appropriate, it's less inclined to make up answers.
136
136
137
137
In this example, we give the model examples of questions and answers it knows and then examples of things it wouldn't know and provide question marks. We also set the probability to zero so the model is more likely to respond with a "?" if there's any doubt.
138
138
@@ -147,11 +147,11 @@ Q: What is Devz9?
147
147
A: ?
148
148
149
149
Q: Who is George Lucas?
150
-
A: George Lucas is American film director and producer famous for creating Star Wars.
150
+
A: George Lucas is an American film director and producer famous for creating Star Wars.
151
151
```
152
152
153
153
## Summary
154
154
155
-
Azure OpenAI Service provides REST API access to OpenAI's powerful language models including the GPT-3.5 and GPT-4 model series. It also gives you the security and enterprise features you've come to rely from the Azure cloud.
155
+
Azure OpenAI Service provides REST API access to OpenAI's powerful language models including the GPT-3.5 and GPT-4 model series. It also gives you the security and enterprise features you've come to rely on from the Azure cloud.
156
156
157
157
One of the most useful features from the OpenAI language models is text completion. You pass in a **prompt** or a plain language description of what you want the model to do, and it can perform tasks such as text classification, text generation, or text summarization.
0 commit comments