8000 enhance client contract · deepseek-php/deepseek-php-client@10eb95e · GitHub
[go: up one dir, main page]

Skip to content

Commit 10eb95e

Browse files
committed
enhance client contract
1 parent c1cd8d3 commit 10eb95e

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/Contracts/DeepseekClientContract.php renamed to src/Contracts/ClientContract.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
namespace DeepSeek\Contracts;
44

5-
interface DeepseekClientContract
5+
interface ClientContract
66
{
7-
public static function build(string $apiKey): self;
87
public function run(): string;
8+
public static function build(string $apiKey, ?string $baseUrl = null, ?int $timeout = null): self;
99
public function query(string $content, ?string $role = "user"): self;
10+
public function getModelsList(): self;
1011
public function withModel(?string $model = null): self;
1112
public function withStream(bool $stream = true): self;
13+
public function buildQuery(string $content, ?string $role = null): array;
1214
}

src/DeepSeekClient.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@
22

33
namespace DeepSeek;
44

5-
use DeepSeek\Contracts\DeepseekClientContract;
5+
use DeepSeek\Contracts\ClientContract;
66
use DeepSeek\Contracts\Models\ResultContract;
77
use DeepSeek\Enums\Requests\EndpointSuffixes;
88
use DeepSeek\Resources\Resource;
99
use Psr\Http\Client\ClientInterface;
1010
use DeepSeek\Factories\ApiFactory;
1111
use DeepSeek\Enums\Queries\QueryRoles;
1212
use DeepSeek\Enums\Requests\QueryFlags;
13-
use DeepSeek\Enums\Requests\HeaderFlags;
1413
use DeepSeek\Enums\Configs\TemperatureValues;
1514
use DeepSeek\Traits\Resources\{HasChat, HasCoder};
1615

17-
class DeepSeekClient implements DeepseekClientContract
16+
class DeepSeekClient implements ClientContract
1817
{
1918
use HasChat, HasCoder;
2019

@@ -113,14 +112,14 @@ public static function build(string $apiKey, ?string $baseUrl = null, ?int $time
113112
* @param string|null $role
114113
* @return self The current instance for method chaining.
115114
*/
116-
public function query(string $content, ?string $role = null): self
115+
public function query(string $content, ?string $role = "user"): self
117116
{
118117
$this->queries[] = $this->buildQuery($content, $role);
119118
return $this;
120119
}
121120

122121
/**
123-
* get list of available models ..
122+
* get list of available models .
124123
*
125124
* @return self The current instance for method chaining.
126125
*/
@@ -161,7 +160,7 @@ public function setTemperature(float $temperature): self
161160
return $this;
162161
}
163162

164-
protected function buildQuery(string $content, ?string $role = null): array
163+
public function buildQuery(string $content, ?string $role = null): array
165164
{
166165
return [
167166
'role' => $role ?: QueryRoles::USER->value,

0 commit comments

Comments
 (0)
0