52 lines
1.4 KiB
PHP
52 lines
1.4 KiB
PHP
|
|
<?php
|
||
|
|
// This file is auto-generated by alef — DO NOT EDIT.
|
||
|
|
// alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
|
||
|
|
// To regenerate: alef generate
|
||
|
|
// To verify freshness: alef verify --exit-code
|
||
|
|
// Issues & docs: https://github.com/kreuzberg-dev/alef
|
||
|
|
|
||
|
|
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace Kreuzberg\E2e;
|
||
|
|
|
||
|
|
use PHPUnit\Framework\TestCase;
|
||
|
|
use Kreuzberg\Kreuzberg;
|
||
|
|
use Kreuzberg\ExtractionConfig;
|
||
|
|
|
||
|
|
/** E2e tests for category: embed_async_pending. */
|
||
|
|
final class EmbedAsyncPendingTest extends TestCase
|
||
|
|
{
|
||
|
|
|
||
|
|
/** embed_texts_async: empty text list */
|
||
|
|
public function test_embed_texts_async_empty_input(): void
|
||
|
|
{
|
||
|
|
$result = Kreuzberg::embedTextsAsync([], \Kreuzberg\EmbeddingConfig::from_json('{}'));
|
||
|
|
|
||
|
|
$this->assertCount(0, $result);
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/** embed_texts_async: basic async embedding */
|
||
|
|
public function test_embed_texts_async_happy(): void
|
||
|
|
{
|
||
|
|
$result = Kreuzberg::embedTextsAsync(["First", "Second"], \Kreuzberg\EmbeddingConfig::from_json('{}'));
|
||
|
|
|
||
|
|
$this->assertGreaterThanOrEqual(2, count($result));
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
/** embed_texts_async: preset override */
|
||
|
|
public function test_embed_texts_async_preset_switch(): void
|
||
|
|
{
|
||
|
|
$config = \Kreuzberg\EmbeddingConfig::from_json(json_encode(["model" => ["name" => "balanced", "type" => "preset"]]));
|
||
|
|
$this->expectNotToPerformAssertions();
|
||
|
|
$result = Kreuzberg::embedTextsAsync(["Text"], $config);
|
||
|
|
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|