Skip to content

Commit 17c431b

Browse files
committed
Updated OpenAI examples
1 parent 9d64168 commit 17c431b

4 files changed

Lines changed: 5 additions & 7 deletions

File tree

src/openai_function.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function get_current_weather(string $location, string $unit = 'celsius'): string
2525
$question = 'What\'s the weather like in Turin?';
2626

2727
$response = $client->chat()->create([
28-
'model' => 'gpt-3.5-turbo-0613',
28+
'model' => 'gpt-3.5-turbo',
2929
'messages' => [
3030
['role' => 'user', 'content' => $question],
3131
],
@@ -64,7 +64,7 @@ function get_current_weather(string $location, string $unit = 'celsius'): string
6464
$result = call_user_func($call->function->name, ...$arguments);
6565
if (!empty($result)) {
6666
$response = $client->chat()->create([
67-
'model' => 'gpt-3.5-turbo-0613',
67+
'model' => 'gpt-3.5-turbo',
6868
'messages' => [
6969
[
7070
'role' => 'system',

src/openai_moderation.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,4 @@
2222
printf("Violated: %s\n", $category->violated ? 'yes' : 'no'); // true
2323
printf("Score: %.4f\n", $category->score); // 0.97431367635727
2424
}
25-
}
26-
27-
#var_dump($response->toArray());
25+
}

src/openai_speech.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
'speed' => 0.95
1616
]);
1717

18-
file_put_contents('phpday.mp3', $response);
18+
file_put_contents('good_morning.mp3', $response);

src/rag/ollama/embedding_file.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
# Document split
2727
printf("- Document split\n");
28-
$splitDocuments = DocumentSplitter::splitDocuments($documents, 1000);
28+
$splitDocuments = DocumentSplitter::splitDocuments($documents, 500);
2929
printf("Number of splitted documents (chunk): %d\n", count($splitDocuments));
3030

3131
# Embedding

0 commit comments

Comments
 (0)