Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Undefined constant Doctrine\ORM\Query\Lexer::T_IDENTIFIER #100

Open
gponty opened this issue Apr 8, 2024 · 5 comments · May be fixed by #126
Open

[Bug] Undefined constant Doctrine\ORM\Query\Lexer::T_IDENTIFIER #100

gponty opened this issue Apr 8, 2024 · 5 comments · May be fixed by #126
Labels
enhancement New feature or request

Comments

@gponty
Copy link

gponty commented Apr 8, 2024

Hello, I've encountered this error when i execute answerQuestion :

Undefined constant Doctrine\ORM\Query\Lexer::T_IDENTIFIER

vendor/theodo-group/llphant/src/Embeddings/VectorStores/Doctrine/PgVectorL2OperatorDql.php:23

Here my code :

        $config = new OpenAIConfig();
        $config->apiKey = $_ENV['OPENAI_API_KEY'];

        $embeddingGenerator = new OpenAI3SmallEmbeddingGenerator($config);
        $vectorStore = new DoctrineVectorStore($entityManager, Document::class);

        $qa = new QuestionAnswering(
            $vectorStore,
            $embeddingGenerator,
            new OpenAIChat($config)
        );

        $answer = $qa->answerQuestion('what is the secret of Alice?');

Have you an idea ?
Thank you

@MaximeThoonsen
Copy link
Contributor

Hey @gponty.

Can you follow the example in tests/Integration/Embeddings/VectorStores/Doctrine/DoctrineVectorStoreTest.php which are working and see if you still have the problem?

if yes, can you provide your the entity and the code your are using to build the $entityManager ?

@gponty
Copy link
Author

gponty commented Apr 11, 2024

Thank you @MaximeThoonsen
I found the problem, I'm using ORM 3 while LLPHANT uses version 2.

@gponty gponty closed this as completed Apr 11, 2024
@MaximeThoonsen
Copy link
Contributor

@gponty We should make it compliant with the new version. How did you manage to use it and what framework do you use?

@MaximeThoonsen MaximeThoonsen added the enhancement New feature or request label Apr 12, 2024
@gponty
Copy link
Author

gponty commented Apr 16, 2024

Nothing :). I just switched back to version 2, for now it's just a POC. I'm working on Symfony 7.

@myneid
Copy link

myneid commented Apr 17, 2024

yea so i changed it as it has changed from Lexer:: to TokenType::
which is in Doctrine\ORM\Query\TokenType
that has all of those constants now

@JasonMartoux JasonMartoux linked a pull request May 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants