diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c5a6b38 --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +build +vendor +tests/TestSupport/temp +tests/temp +composer.lock +phpunit.xml +.env +.phpunit.cache/ +.phpunit.result.cache +.phpunit.cache/test-results +.php-cs-fixer.cache +phpstan.neon +tests/Support/temp/ +.idea/ diff --git a/README.md b/README.md index 6c1701f..0f4424f 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,7 @@ $response = DeepseekClient::build($apiKey, 'https://api.deepseek.com/v2', 500) ->query('System setup query', 'system') ->query('User input message', 'user') ->withModel(Models::CODER->value) + ->setTemperature(1.5) ->run(); echo 'API Response:'.$response; diff --git a/composer.json b/composer.json index 4d84a87..44a9923 100644 --- a/composer.json +++ b/composer.json @@ -59,7 +59,7 @@ "role": "creator" } ], - "version": "1.0.0.0", + "version": "1.0.2", "require": { "php": "^8.1.0", "php-http/discovery": "^1.20.0", diff --git a/src/DeepseekClient.php b/src/DeepseekClient.php index 33214f1..abf2902 100644 --- a/src/DeepseekClient.php +++ b/src/DeepseekClient.php @@ -43,6 +43,8 @@ class DeepseekClient implements DeepseekClientContract */ protected bool $stream; + protected int $temperature; + /** * Initialize the DeepseekClient with a PSR-compliant HTTP client. * @@ -61,6 +63,7 @@ public function run(): string QueryFlags::MESSAGES->value => $this->queries, QueryFlags::MODEL->value => $this->model, QueryFlags::STREAM->value => $this->stream, + QueryFlags::TEMPERATURE->value => $this->temperature, ]; // Clear queries after sending $this->queries = []; @@ -123,6 +126,12 @@ public function withStream(bool $stream = true): self return $this; } + public function setTemperature(int $temperature): self + { + $this->temperature = $temperature; + return $this; + } + protected function buildQuery(string $content, ?string $role = null): array { return [ diff --git a/src/Enums/Requests/QueryFlags.php b/src/Enums/Requests/QueryFlags.php index fb133d6..b4523f2 100644 --- a/src/Enums/Requests/QueryFlags.php +++ b/src/Enums/Requests/QueryFlags.php @@ -7,4 +7,5 @@ enum QueryFlags: string case MESSAGES = 'messages'; case MODEL = 'model'; case STREAM = 'stream'; + case TEMPERATURE = 'temperature'; }