Skip to content

Commit 17d1a23

Browse files
authored
Merge pull request #505 from gauztech/patch-2
Update README.md
2 parents 4a565d1 + 1745dfb commit 17d1a23

File tree

1 file changed

+29
-29
lines changed

1 file changed

+29
-29
lines changed

README.md

+29-29
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,11 @@ $response->object; // 'text_completion'
163163
$response->created; // 1589478378
164164
$response->model; // 'gpt-3.5-turbo-instruct'
165165

166-
foreach ($response->choices as $result) {
167-
$result->text; // '\n\nThis is a test'
168-
$result->index; // 0
169-
$result->logprobs; // null
170-
$result->finishReason; // 'length' or null
166+
foreach ($response->choices as $choice) {
167+
$choice->text; // '\n\nThis is a test'
168+
$choice->index; // 0
169+
$choice->logprobs; // null
170+
$choice->finishReason; // 'length' or null
171171
}
172172

173173
$response->usage->promptTokens; // 5,
@@ -217,11 +217,11 @@ $response->object; // 'chat.completion'
217217
$response->created; // 1677701073
218218
$response->model; // 'gpt-3.5-turbo-0301'
219219

220-
foreach ($response->choices as $result) {
221-
$result->index; // 0
222-
$result->message->role; // 'assistant'
223-
$result->message->content; // '\n\nHello there! How can I assist you today?'
224-
$result->finishReason; // 'stop'
220+
foreach ($response->choices as $choice) {
221+
$choice->index; // 0
222+
$choice->message->role; // 'assistant'
223+
$choice->message->content; // '\n\nHello there! How can I assist you today?'
224+
$choice->finishReason; // 'stop'
225225
}
226226

227227
$response->usage->promptTokens; // 9,
@@ -269,15 +269,15 @@ $response->object; // 'chat.completion'
269269
$response->created; // 1677701073
270270
$response->model; // 'gpt-3.5-turbo-0613'
271271

272-
foreach ($response->choices as $result) {
273-
$result->index; // 0
274-
$result->message->role; // 'assistant'
275-
$result->message->content; // null
276-
$result->message->toolCalls[0]->id; // 'call_123'
277-
$result->message->toolCalls[0]->type; // 'function'
278-
$result->message->toolCalls[0]->function->name; // 'get_current_weather'
279-
$result->message->toolCalls[0]->function->arguments; // "{\n \"location\": \"Boston, MA\"\n}"
280-
$result->finishReason; // 'tool_calls'
272+
foreach ($response->choices as $choice) {
273+
$choice->index; // 0
274+
$choice->message->role; // 'assistant'
275+
$choice->message->content; // null
276+
$choice->message->toolCalls[0]->id; // 'call_123'
277+
$choice->message->toolCalls[0]->type; // 'function'
278+
$choice->message->toolCalls[0]->function->name; // 'get_current_weather'
279+
$choice->message->toolCalls[0]->function->arguments; // "{\n \"location\": \"Boston, MA\"\n}"
280+
$choice->finishReason; // 'tool_calls'
281281
}
282282

283283
$response->usage->promptTokens; // 82,
@@ -320,13 +320,13 @@ $response->object; // 'chat.completion'
320320
$response->created; // 1677701073
321321
$response->model; // 'gpt-3.5-turbo-0613'
322322

323-
foreach ($response->choices as $result) {
324-
$result->index; // 0
325-
$result->message->role; // 'assistant'
326-
$result->message->content; // null
327-
$result->message->functionCall->name; // 'get_current_weather'
328-
$result->message->functionCall->arguments; // "{\n \"location\": \"Boston, MA\"\n}"
329-
$result->finishReason; // 'function_call'
323+
foreach ($response->choices as $choice) {
324+
$choice->index; // 0
325+
$choice->message->role; // 'assistant'
326+
$choice->message->content; // null
327+
$choice->message->functionCall->name; // 'get_current_weather'
328+
$choice->message->functionCall->arguments; // "{\n \"location\": \"Boston, MA\"\n}"
329+
$choice->finishReason; // 'function_call'
330330
}
331331

332332
$response->usage->promptTokens; // 82,
@@ -2197,9 +2197,9 @@ $response = $client->edits()->create([
21972197
$response->object; // 'edit'
21982198
$response->created; // 1589478378
21992199

2200-
foreach ($response->choices as $result) {
2201-
$result->text; // 'What day of the week is it?'
2202-
$result->index; // 0
2200+
foreach ($response->choices as $choice) {
2201+
$choice->text; // 'What day of the week is it?'
2202+
$choice->index; // 0
22032203
}
22042204

22052205
$response->usage->promptTokens; // 25,

0 commit comments

Comments
 (0)