Skip to content

Conversation

@paulinevos
Copy link
Contributor

Q A
Bug fix? no
New feature? no
Docs? no
License MIT

As the Vectorizer currently makes assumptions about having to pass string data to PlatformInterface::invoke, when that method can actually take about any sort of input.

Platform implementations decide what data types they can handle through their normalizers. Therefore, it should be up to platform to handle types and not up to store to decide that it should only pass strings.

@carsonbot carsonbot changed the title Support mixed for getContent method Support mixed for getContent method Oct 27, 2025
private PlatformInterface $platform,
private string $model,
private LoggerInterface $logger = new NullLogger(),
private readonly PlatformInterface $platform,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHPStan complained about the readonly class btw. I guess this is a new rule?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public function getId(): mixed;

public function getContent(): string;
public function getContent(): mixed;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe string|object is a good alternative if we want to be a bit stricter? Because the platform normalizers also mostly assume that you're passing either strings or data classes.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible I would vote to use string|object instead of mixed, WDYT @chr-hertel ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, i would agree, currently the invoke also is explicit on the $input witharray|string|object so it would be more consistent to be explicit here as well => string|object

As the Vectorizer currently makes assumptions about having to pass
string data to `PlatformInterface::invoke`, when that method can
actually take about any sort of input.

`Platform` implementations decide what data types they can handle
through their normalizers. Therefore, it should be up to `platform` to
handle types and not up to `store` to decide that it should only pass
strings.
Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for he late response, let's go with string|object here - or do we need array as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants