Skip to content

Commit d897d29

Browse files
authored
Update README.md
1 parent fb8af0a commit d897d29

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

README.md

+15-9
Original file line numberDiff line numberDiff line change
@@ -68,26 +68,32 @@ private async void SendRequest()
6868

6969
To make a stream request, you can use the `CreateCompletionAsync` and `CreateChatCompletionAsync` methods.
7070
These methods are going to set `Stream` property of the request to `true` and return responses through an onResponse callback.
71-
In this case text responses are stored in `Delta` property of the `Choices` field.
71+
In this case text responses are stored in `Delta` property of the `Choices` field in the Chat Completion.
7272

7373
```csharp
74-
var req = new CreateCompletionRequest{
75-
Model = "text-davinci-003",
76-
Prompt = "Say this is a test.",
77-
MaxTokens = 7,
78-
Temperature = 0
74+
var req = new CreateChatCompletionRequest{
75+
Model = "gpt-3.5-turbo",
76+
Messages = new List<ChatMessage>
77+
{
78+
new ChatMessage()
79+
{
80+
Role = "user",
81+
Content = "Write a 100 word long short story in La Fontaine style."
82+
}
83+
},
84+
Temperature = 0.7f,
7985
};
8086

81-
openai.CreateCompletionAsync(req,
87+
openai.CreateChatCompletionAsync(req,
8288
(responses) => {
8389
var result = string.Join("", responses.Select(response => response.Choices[0].Delta.Content));
8490
Debug.Log(result);
8591
},
8692
() => {
8793
Debug.Log("completed");
8894
},
89-
new CancellationTokenSource());
90-
}
95+
new CancellationTokenSource()
96+
);
9197
```
9298

9399
### Sample Projects

0 commit comments

Comments
 (0)