Skip to content

Commit

Permalink
Merge pull request #8 from GeraudBourdin/main
Browse files Browse the repository at this point in the history
Update LamaCppClient class name
  • Loading branch information
GeraudBourdin authored Mar 5, 2024
2 parents dc8e91c + d0385de commit efc0afb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ $messages->addAssistantMessage('Any response');
To get the same with Lama.cpp local inference :

```php
use Partitech\PhpMistral\LamaCppMistralClient;
use Partitech\PhpMistral\LamaCppClient;
use Partitech\PhpMistral\Messages;

$apiKey = 'YOUR_PRIVATE_MISTRAL_KEY';
$client = new LamaCppMistralClient($apiKey, 'http://localhost:8080');
$client = new LamaCppClient($apiKey, 'http://localhost:8080');

$messages = new Messages();
$messages->addUserMessage('What is the best French cheese?');
Expand Down Expand Up @@ -102,11 +102,11 @@ foreach ($client->chatStream($messages, $params)) as $chunk) {
#### Chat with streamed response with Lama.cpp

```php
use Partitech\PhpMistral\LamaCppMistralClient;
use Partitech\PhpMistral\LamaCppClient;
use Partitech\PhpMistral\Messages;

$apiKey = 'YOUR_PRIVATE_MISTRAL_KEY';
$client = new LamaCppMistralClient($apiKey, 'http://localhost:8080');
$client = new LamaCppClient($apiKey, 'http://localhost:8080');

$messages = new Messages();
$messages->addUserMessage('What is the best French cheese?');
Expand Down
2 changes: 1 addition & 1 deletion src/LamaCppMistralClient.php → src/LamaCppClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Partitech\PhpMistral;

class LamaCppMistralClient extends MistralClient
class LamaCppClient extends MistralClient
{
public function __construct(string $apiKey, string $url = self::ENDPOINT)
{
Expand Down
10 changes: 5 additions & 5 deletions tests/LamaCppClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Partitech\PhpMistral\Tests;

use Partitech\PhpMistral\LamaCppMistralClient;
use Partitech\PhpMistral\LamaCppClient;
use Partitech\PhpMistral\MistralClientException;
use PHPUnit\Framework\TestCase;
use Partitech\PhpMistral\MistralClient;
Expand All @@ -18,14 +18,14 @@ class LamaCppClientTest extends TestCase

protected function setUp(): void
{
$this->client = new LamaCppMistralClient($this->apiKey);
$this->client = new LamaCppClient($this->apiKey);
}


public function testConstruct(): void
{
$this->assertInstanceOf(LamaCppMistralClient::class, $this->client);
$client = new LamaCppMistralClient($this->apiKey);
$this->assertInstanceOf(LamaCppClient::class, $this->client);
$client = new LamaCppClient($this->apiKey);
$reflection = new \ReflectionClass($client);
$apiKeyProperty = $reflection->getProperty('apiKey');
$endpointProperty = $reflection->getProperty('url');
Expand All @@ -45,7 +45,7 @@ public function testListModels(): void

$httpClientMock = new MockHttpClient($responses);

$client = new LamaCppMistralClient('your_api_key', 'http://test.endpoint');
$client = new LamaCppClient('your_api_key', 'http://test.endpoint');
$client->setHttpClient($httpClientMock);

$models = $client->listModels();
Expand Down

0 comments on commit efc0afb

Please sign in to comment.