-
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.
Merge pull request #687 from meilisearch/ai-powered-api-changes
Ai powered api changes
- Loading branch information
Showing
6 changed files
with
96 additions
and
55 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
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
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
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
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
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; | ||
|
||
private 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); | ||
} | ||
} |