Skip to content

Commit bef5e8e

Browse files
committed
refactor: corrects linting errors
1 parent edd57f2 commit bef5e8e

File tree

3 files changed

+23
-23
lines changed

3 files changed

+23
-23
lines changed

src/Builders/PromptBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,10 @@ public function usingModelConfig(ModelConfig $config): self
219219
// Convert both configs to arrays
220220
$builderConfigArray = $this->modelConfig->toArray();
221221
$providedConfigArray = $config->toArray();
222-
222+
223223
// Merge arrays with builder config taking precedence
224224
$mergedArray = array_merge($providedConfigArray, $builderConfigArray);
225-
225+
226226
// Create new config from merged array
227227
$this->modelConfig = ModelConfig::fromArray($mergedArray);
228228

tests/unit/Builders/PromptBuilderTest.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -650,37 +650,37 @@ public function testUsingModel(): void
650650
public function testUsingModelConfig(): void
651651
{
652652
$builder = new PromptBuilder($this->registry);
653-
653+
654654
// Set some initial config values on the builder
655655
$builder->usingSystemInstruction('Builder instruction')
656656
->usingMaxTokens(500)
657657
->usingTemperature(0.5);
658-
658+
659659
// Create a config to merge
660660
$config = new ModelConfig();
661661
$config->setSystemInstruction('Config instruction');
662662
$config->setMaxTokens(1000);
663663
$config->setTopP(0.9);
664664
$config->setTopK(40);
665-
665+
666666
$result = $builder->usingModelConfig($config);
667-
667+
668668
// Assert fluent interface
669669
$this->assertSame($builder, $result);
670-
670+
671671
// Get the merged config
672672
$reflection = new \ReflectionClass($builder);
673673
$configProperty = $reflection->getProperty('modelConfig');
674674
$configProperty->setAccessible(true);
675-
675+
676676
/** @var ModelConfig $mergedConfig */
677677
$mergedConfig = $configProperty->getValue($builder);
678-
678+
679679
// Assert builder values take precedence
680680
$this->assertEquals('Builder instruction', $mergedConfig->getSystemInstruction());
681681
$this->assertEquals(500, $mergedConfig->getMaxTokens());
682682
$this->assertEquals(0.5, $mergedConfig->getTemperature());
683-
683+
684684
// Assert config values are used when builder doesn't have them
685685
$this->assertEquals(0.9, $mergedConfig->getTopP());
686686
$this->assertEquals(40, $mergedConfig->getTopK());
@@ -694,42 +694,42 @@ public function testUsingModelConfig(): void
694694
public function testUsingModelConfigWithCustomOptions(): void
695695
{
696696
$builder = new PromptBuilder($this->registry);
697-
697+
698698
// Create a config with custom options
699699
$config = new ModelConfig();
700700
$config->setCustomOption('stopSequences', ['CONFIG_STOP']);
701701
$config->setCustomOption('otherOption', 'value');
702-
702+
703703
$builder->usingModelConfig($config);
704-
704+
705705
// Get the merged config
706706
$reflection = new \ReflectionClass($builder);
707707
$configProperty = $reflection->getProperty('modelConfig');
708708
$configProperty->setAccessible(true);
709-
709+
710710
/** @var ModelConfig $mergedConfig */
711711
$mergedConfig = $configProperty->getValue($builder);
712712
$customOptions = $mergedConfig->getCustomOptions();
713-
713+
714714
// Assert config custom options are preserved
715715
$this->assertArrayHasKey('stopSequences', $customOptions);
716716
$this->assertIsArray($customOptions['stopSequences']);
717717
$this->assertEquals(['CONFIG_STOP'], $customOptions['stopSequences']);
718718
$this->assertArrayHasKey('otherOption', $customOptions);
719719
$this->assertEquals('value', $customOptions['otherOption']);
720-
720+
721721
// Now set a builder value that overrides one of the custom options
722722
$builder->usingStopSequences('STOP');
723-
723+
724724
// Get the config again
725725
$mergedConfig = $configProperty->getValue($builder);
726726
$customOptions = $mergedConfig->getCustomOptions();
727-
727+
728728
// Assert builder's stop sequences override the config's
729729
$this->assertArrayHasKey('stopSequences', $customOptions);
730730
$this->assertIsArray($customOptions['stopSequences']);
731731
$this->assertEquals(['STOP'], $customOptions['stopSequences']);
732-
732+
733733
// Assert other custom options are still preserved
734734
$this->assertArrayHasKey('otherOption', $customOptions);
735735
$this->assertEquals('value', $customOptions['otherOption']);

tests/unit/Providers/Models/DTO/ModelConfigTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -340,16 +340,16 @@ public function testToArrayCustomOptionsOnlyIncludedWhenNotEmpty(): void
340340
// Test with empty custom options (default)
341341
$config = new ModelConfig();
342342
$config->setTemperature(0.7);
343-
343+
344344
$array = $config->toArray();
345345
$this->assertArrayNotHasKey(ModelConfig::KEY_CUSTOM_OPTIONS, $array);
346-
346+
347347
// Test with non-empty custom options
348348
$config->setCustomOption('key1', 'value1');
349349
$array = $config->toArray();
350350
$this->assertArrayHasKey(ModelConfig::KEY_CUSTOM_OPTIONS, $array);
351351
$this->assertEquals(['key1' => 'value1'], $array[ModelConfig::KEY_CUSTOM_OPTIONS]);
352-
352+
353353
// Test with multiple custom options
354354
$config->setCustomOption('key2', ['nested' => 'value']);
355355
$array = $config->toArray();
@@ -358,7 +358,7 @@ public function testToArrayCustomOptionsOnlyIncludedWhenNotEmpty(): void
358358
'key1' => 'value1',
359359
'key2' => ['nested' => 'value']
360360
], $array[ModelConfig::KEY_CUSTOM_OPTIONS]);
361-
361+
362362
// Test resetting custom options to empty
363363
$config->setCustomOptions([]);
364364
$array = $config->toArray();

0 commit comments

Comments
 (0)