Skip to content

Commit 3472687

Browse files
committed
minor #557 [Platform] Remove temperature default values from Model classes and examples (OskarStark)
This PR was squashed before being merged into the main branch. Discussion ---------- [Platform] Remove temperature default values from Model classes and examples | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Docs? | no | Issues | -- | License | MIT Removed temperature defaults from constructor parameters in: - OpenAI Gpt model (was 1.0) - LmStudio Completions model (was 0.7) - Gemini model (was 1.0) - Bedrock Nova model (was 1.0) - Anthropic Claude model (was 1.0) Also removed temperature from example files to let models use their natural defaults. Commits ------- a5e1b1d [Platform] Remove temperature default values from Model classes and examples
2 parents a0450a0 + a5e1b1d commit 3472687

File tree

9 files changed

+9
-15
lines changed

9 files changed

+9
-15
lines changed

examples/misc/parallel-chat-gpt.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
require_once dirname(__DIR__).'/bootstrap.php';
1818

1919
$platform = PlatformFactory::create(env('OPENAI_API_KEY'), http_client());
20-
$model = new Gpt(Gpt::GPT_4O_MINI, [
21-
'temperature' => 0.5, // default options for the model
22-
]);
20+
$model = new Gpt(Gpt::GPT_4O_MINI);
2321

2422
$messages = new MessageBag(
2523
Message::forSystem('You will be given a letter and you answer with only the next letter of the alphabet.'),

examples/openai/chat.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
require_once dirname(__DIR__).'/bootstrap.php';
1919

2020
$platform = PlatformFactory::create(env('OPENAI_API_KEY'), http_client());
21-
$model = new Gpt(Gpt::GPT_4O_MINI, [
22-
'temperature' => 0.5, // default options for the model
23-
]);
21+
$model = new Gpt(Gpt::GPT_4O_MINI);
2422

2523
$agent = new Agent($platform, $model, logger: logger());
2624
$messages = new MessageBag(

examples/openai/token-metadata.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
require_once dirname(__DIR__).'/bootstrap.php';
2020

2121
$platform = PlatformFactory::create(env('OPENAI_API_KEY'), http_client());
22-
$model = new Gpt(Gpt::GPT_4O_MINI, [
23-
'temperature' => 0.5, // default options for the model
24-
]);
22+
$model = new Gpt(Gpt::GPT_4O_MINI);
2523

2624
$agent = new Agent($platform, $model, outputProcessors: [new TokenOutputProcessor()], logger: logger());
2725
$messages = new MessageBag(

src/platform/src/Bridge/Anthropic/Claude.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Claude extends Model
3636
*/
3737
public function __construct(
3838
string $name = self::SONNET_37,
39-
array $options = ['temperature' => 1.0, 'max_tokens' => 1000],
39+
array $options = ['max_tokens' => 1000],
4040
) {
4141
$capabilities = [
4242
Capability::INPUT_MESSAGES,

src/platform/src/Bridge/Bedrock/Nova/Nova.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class Nova extends Model
2929
*/
3030
public function __construct(
3131
string $name = self::PRO,
32-
array $options = ['temperature' => 1.0, 'max_tokens' => 1000],
32+
array $options = ['max_tokens' => 1000],
3333
) {
3434
$capabilities = [
3535
Capability::INPUT_MESSAGES,

src/platform/src/Bridge/Gemini/Gemini.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Gemini extends Model
2828
/**
2929
* @param array<string, mixed> $options The default options for the model usage
3030
*/
31-
public function __construct(string $name = self::GEMINI_2_PRO, array $options = ['temperature' => 1.0])
31+
public function __construct(string $name = self::GEMINI_2_PRO, array $options = [])
3232
{
3333
$capabilities = [
3434
Capability::INPUT_MESSAGES,

src/platform/src/Bridge/LmStudio/Completions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Completions extends Model
2727

2828
public function __construct(
2929
string $name,
30-
array $options = ['temperature' => 0.7],
30+
array $options = [],
3131
array $capabilities = self::DEFAULT_CAPABILITIES,
3232
) {
3333
parent::__construct($name, $capabilities, $options);

src/platform/src/Bridge/OpenAi/Gpt.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class Gpt extends Model
7575
*/
7676
public function __construct(
7777
string $name = self::GPT_4O,
78-
array $options = ['temperature' => 1.0],
78+
array $options = [],
7979
) {
8080
$capabilities = [
8181
Capability::INPUT_MESSAGES,

src/platform/tests/Bridge/OpenAi/GptTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function testItCreatesGptWithDefaultSettings()
2828
$gpt = new Gpt();
2929

3030
$this->assertSame(Gpt::GPT_4O, $gpt->getName());
31-
$this->assertSame(['temperature' => 1.0], $gpt->getOptions());
31+
$this->assertSame([], $gpt->getOptions());
3232
}
3333

3434
public function testItCreatesGptWithCustomSettings()

0 commit comments

Comments
 (0)