Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README-AR.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ $response = $client
->withModel(Models::CODER->value)
->withStream()
->withTemperature(1.2)
->setMaxTokens(8192)
->query('Explain quantum computing in simple terms')
->run();

Expand Down
1 change: 1 addition & 0 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ $response = $client
->withModel(Models::CODER->value)
->withStream()
->withTemperature(1.2)
->setMaxTokens(8192)
->query('Explain quantum computing in simple terms')
->run();

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ $response = $client
->withModel(Models::CODER->value)
->withStream()
->setTemperature(1.2)
->setMaxTokens(8192)
->query('Explain quantum computing in simple terms')
->run();

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"role": "creator"
}
],
"version": "2.0.4",
"version": "2.0.5",
"require": {
"php": "^8.1.0",
"nyholm/psr7": "^1.8",
Expand Down
9 changes: 9 additions & 0 deletions src/DeepSeekClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class DeepSeekClient implements ClientContract
protected bool $stream;

protected float $temperature;
protected int $maxTokens;

/**
* response result contract
Expand Down Expand Up @@ -79,6 +80,7 @@ public function __construct(ClientInterface $httpClient)
$this->requestMethod = 'POST';
$this->endpointSuffixes = EndpointSuffixes::CHAT->value;
$this->temperature = (float) TemperatureValues::GENERAL_CONVERSATION->value;
$this->maxTokens = (int) TemperatureValues::MAX_TOKENS->value;
$this->tools = null;
}

Expand All @@ -89,6 +91,7 @@ public function run(): string
QueryFlags::MODEL->value => $this->model,
QueryFlags::STREAM->value => $this->stream,
QueryFlags::TEMPERATURE->value => $this->temperature,
QueryFlags::MAX_TOKENS->value => $this->maxTokens,
QueryFlags::TOOLS->value => $this->tools,
];

Expand Down Expand Up @@ -183,6 +186,12 @@ public function setTemperature(float $temperature): self
return $this;
}

public function setMaxTokens(int $maxTokens): self
{
$this->maxTokens = $maxTokens;
return $this;
}

public function buildQuery(string $content, ?string $role = null): array
{
return [
Expand Down
1 change: 1 addition & 0 deletions src/Enums/Configs/TemperatureValues.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ enum TemperatureValues: string
case TRANSLATION = "1.4";
case CREATIVE_WRITING = "1.5";
case POETRY = "1.6";
case MAX_TOKENS = "4096";
}
1 change: 1 addition & 0 deletions src/Enums/Requests/QueryFlags.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ enum QueryFlags: string
case MODEL = 'model';
case STREAM = 'stream';
case TEMPERATURE = 'temperature';
case MAX_TOKENS = 'max_tokens';
case TOOLS = 'tools';
}