Download src/Ai/Domain/ValueObjects/Embedding.php from pnacorp/AIKEEDO: direct link, hf CLI and curl.
- Browser
- Download file 810 Bytes
-
https://huggingface.co/pnacorp/AIKEEDO/resolve/main/src/Ai/Domain/ValueObjects/Embedding.php
- Command line
-
hf download hf://pnacorp/AIKEEDO/src/Ai/Domain/ValueObjects/Embedding.php
-
curl -L -o Embedding.php https://huggingface.co/pnacorp/AIKEEDO/resolve/main/src/Ai/Domain/ValueObjects/Embedding.php
810 Bytes
| declare(strict_types=1); | |
| namespace Ai\Domain\ValueObjects; | |
| use Doctrine\DBAL\Types\Types; | |
| use Doctrine\ORM\Mapping as ORM; | |
| use JsonSerializable; | |
| use Override; | |
| #[ORM\Embeddable] | |
| class Embedding implements JsonSerializable | |
| { | |
| /** @var array<array{content:string,embedding:array<float>}> */ | |
| #[ORM\Column(type: Types::JSON, name: "embedding", nullable: true)] | |
| public readonly ?array $value; | |
| public function __construct(EmbeddingMap ...$maps) | |
| { | |
| $value = []; | |
| foreach ($maps as $map) { | |
| $value[] = [ | |
| 'content' => $map->content, | |
| 'embedding' => $map->embedding, | |
| ]; | |
| } | |
| $this->value = $value; | |
| } | |
| public function jsonSerialize(): ?array | |
| { | |
| return $this->value; | |
| } | |
| } | |