-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2fbca6f
commit f1bc0cb
Showing
1 changed file
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tests\Settings; | ||
|
||
use Meilisearch\Endpoints\Indexes; | ||
use Meilisearch\Http\Client; | ||
use Tests\TestCase; | ||
|
||
final class EmbeddersTest extends TestCase | ||
{ | ||
private Indexes $index; | ||
|
||
public const DEFAULT_EMBEDDER = null; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$http = new Client($this->host, getenv('MEILISEARCH_API_KEY')); | ||
$http->patch('/experimental-features', ['vectorStore' => true]); | ||
$this->index = $this->createEmptyIndex($this->safeIndexName()); | ||
} | ||
|
||
public function testGetDefaultEmbedders(): void | ||
{ | ||
$response = $this->index->getEmbedders(); | ||
|
||
self::assertSame(self::DEFAULT_EMBEDDER, $response); | ||
} | ||
|
||
public function testUpdateEmbedders(): void | ||
{ | ||
$newEmbedders = ['manual' => ['source' => 'userProvided', 'dimensions' => 3, 'binaryQuantized' => true]]; | ||
|
||
$promise = $this->index->updateEmbedders($newEmbedders); | ||
|
||
$this->assertIsValidPromise($promise); | ||
$this->index->waitForTask($promise['taskUid']); | ||
|
||
$embedders = $this->index->getEmbedders(); | ||
|
||
self::assertSame($newEmbedders, $embedders); | ||
} | ||
|
||
public function testResetEmbedders(): void | ||
{ | ||
$promise = $this->index->resetEmbedders(); | ||
|
||
$this->assertIsValidPromise($promise); | ||
|
||
$this->index->waitForTask($promise['taskUid']); | ||
$embedders = $this->index->getEmbedders(); | ||
|
||
self::assertSame(self::DEFAULT_EMBEDDER, $embedders); | ||
} | ||
} |