File tree 1 file changed +15
-9
lines changed
1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -68,26 +68,32 @@ private async void SendRequest()
68
68
69
69
To make a stream request, you can use the ` CreateCompletionAsync ` and ` CreateChatCompletionAsync ` methods.
70
70
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 .
72
72
73
73
``` 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 . 7 f ,
79
85
};
80
86
81
- openai .CreateCompletionAsync (req ,
87
+ openai .CreateChatCompletionAsync (req ,
82
88
(responses ) => {
83
89
var result = string .Join (" " , responses .Select (response => response .Choices [0 ].Delta .Content ));
84
90
Debug .Log (result );
85
91
},
86
92
() => {
87
93
Debug .Log (" completed" );
88
94
},
89
- new CancellationTokenSource ());
90
- }
95
+ new CancellationTokenSource ()
96
+ );
91
97
```
92
98
93
99
### Sample Projects
You can’t perform that action at this time.
0 commit comments