Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/store/src/Document/Vectorizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* The Vectorizer encapsulates the logic to convert a collection of TextDocuments into VectorDocuments. It checks for
* the model's capabilities to handle batch processing or handles it with HttpClient's concurrency feature.
*/
final readonly class Vectorizer
final readonly class Vectorizer implements VectorizerInterface
{
public function __construct(
private PlatformInterface $platform,
Expand Down
27 changes: 27 additions & 0 deletions src/store/src/Document/VectorizerInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\AI\Store\Document;

/**
* Interface for converting TextDocuments into VectorDocuments.
*
* @author Oskar Stark <oskarstark@googlemail.com>
*/
interface VectorizerInterface
{
/**
* @param TextDocument[] $documents
*
* @return VectorDocument[]
*/
public function vectorizeDocuments(array $documents): array;
}
4 changes: 2 additions & 2 deletions src/store/src/Indexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Symfony\AI\Store\Document\TextDocument;
use Symfony\AI\Store\Document\Vectorizer;
use Symfony\AI\Store\Document\VectorizerInterface;

/**
* Converts a collection of TextDocuments into VectorDocuments and pushes them to a store implementation.
Expand All @@ -24,7 +24,7 @@
final readonly class Indexer
{
public function __construct(
private Vectorizer $vectorizer,
private VectorizerInterface $vectorizer,
private StoreInterface $store,
private LoggerInterface $logger = new NullLogger(),
) {
Expand Down