@@ -163,11 +163,11 @@ $response->object; // 'text_completion'
163
163
$response->created; // 1589478378
164
164
$response->model; // 'gpt-3.5-turbo-instruct'
165
165
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
171
171
}
172
172
173
173
$response->usage->promptTokens; // 5,
@@ -217,11 +217,11 @@ $response->object; // 'chat.completion'
217
217
$response->created; // 1677701073
218
218
$response->model; // 'gpt-3.5-turbo-0301'
219
219
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'
225
225
}
226
226
227
227
$response->usage->promptTokens; // 9,
@@ -269,15 +269,15 @@ $response->object; // 'chat.completion'
269
269
$response->created; // 1677701073
270
270
$response->model; // 'gpt-3.5-turbo-0613'
271
271
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'
281
281
}
282
282
283
283
$response->usage->promptTokens; // 82,
@@ -320,13 +320,13 @@ $response->object; // 'chat.completion'
320
320
$response->created; // 1677701073
321
321
$response->model; // 'gpt-3.5-turbo-0613'
322
322
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'
330
330
}
331
331
332
332
$response->usage->promptTokens; // 82,
@@ -2197,9 +2197,9 @@ $response = $client->edits()->create([
2197
2197
$response->object; // 'edit'
2198
2198
$response->created; // 1589478378
2199
2199
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
2203
2203
}
2204
2204
2205
2205
$response->usage->promptTokens; // 25,
0 commit comments