Skip to content

Conversation

chr-hertel
Copy link
Member

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

Turns out pipeline was not running phpstan on the demo - this PR adds that and fixes the open issues.

@chr-hertel chr-hertel added the Demo Issues & PRs about the demo application label Oct 8, 2025
@carsonbot carsonbot added Bug Something isn't working Status: Needs Review labels Oct 8, 2025
@chr-hertel
Copy link
Member Author

chr-hertel commented Oct 8, 2025

@OskarStark need your help here with the conditional return on the vectorizer - breaks my head or maybe just too late

this code:

$search = $io->ask('What do you want to know about?', 'New Symfony Features');
$io->comment(\sprintf('Converting "%s" to vector & searching in Chroma DB ...', $search));
$io->comment('Results are limited to 4 most similar documents.');
$vector = $this->vectorizer->vectorize($search);
$queryResponse = $collection->query(
queryEmbeddings: [$vector->getData()],
nResults: 4,
);

with this return:

* @return Vector|VectorDocument|array<Vector>|array<VectorDocument>
*
* @phpstan-return (
* $values is string|\Stringable ? Vector : (
* $values is EmbeddableDocumentInterface ? VectorDocument : (
* $values is array<string|\Stringable> ? array<Vector> : array<VectorDocument>
* )
* )
* )

leads to:

------ --------------------------------------------------------------------------------------------------------------- 
  Line   src/Blog/Command/QueryCommand.php                                                                              
 ------ --------------------------------------------------------------------------------------------------------------- 
  50     Cannot call method getData() on array<Symfony\AI\Platform\Vector\Vector|Symfony\AI\Store\Document\VectorDocum  
         ent>|Symfony\AI\Platform\Vector\Vector|Symfony\AI\Store\Document\VectorDocument.                               
         🪪  method.nonObject                                                                                           
 ------ --------------------------------------------------------------------------------------------------------------- 

@chr-hertel
Copy link
Member Author

Used @phpstan-ignore-line for now to get the demo green again and phpstan integration going there.

Follow up with #768

@chr-hertel chr-hertel merged commit 91d507e into symfony:main Oct 9, 2025
14 checks passed
@chr-hertel chr-hertel deleted the fix-demo-phpstan branch October 9, 2025 22:04
chr-hertel added a commit that referenced this pull request Oct 9, 2025
This PR was merged into the main branch.

Discussion
----------

[Demo] Fix codestyle issues in demo

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| Docs?         | no
| Issues        |
| License       | MIT

Follows #760

Commits
-------

b3c1a68 Fix codestyle issues in demo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working Demo Issues & PRs about the demo application Status: Reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants