php-llm / llm-chain

PHP library for building LLM-based features and applications.
MIT License
12 stars 3 forks source link

Introduce `EmbeddedDocument` #101

Closed OskarStark closed 1 month ago

OskarStark commented 1 month ago

Can be merged after

chr-hertel commented 1 month ago

what do you think about like a tupel of document classes:

TextDocument and VectorDocument - both have an UUID and Metadata

/**
 * @param TextDocument|TextDocument[] $documents
 */
DocumentEmbedder::create(TextDocument|array $documents, ...): void

// only converting than

$vectorDocuments[] = new VectorDocument($vectors[$i], $document->id, $document->metadata);

// and drop text in store context completely

/**
 * @param VectorDocument|VectorDocument[] $documents
 **/
StoreInterface::add(VectorDocument|array $documents): void;

/**
 * @return VectorDocument[]
 */
VectorStoreInterface::query(Vector $vector, array $options = []): array;
OskarStark commented 1 month ago

I like it, I thought sth like this without inheritance too in the beginning

chr-hertel commented 1 month ago

thought about a Document interface with getId(): Uuid and getMetadata(): Metadata; - but i don't see a user of that interface in our code :D

OskarStark commented 1 month ago

No I don't think we need that abstraction upstream

chr-hertel commented 1 month ago

you want to tackle that with your PRs or shall I?

OskarStark commented 1 month ago

If you have time, go ahead. Either use my PR or open a new one where you do the transformation completely

OskarStark commented 1 month ago

Superseded by