LLPhant icon indicating copy to clipboard operation
LLPhant copied to clipboard

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

Open gponty opened this issue 1 year ago • 5 comments

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

gponty avatar Apr 08 '24 16:04 gponty

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 ?

MaximeThoonsen avatar Apr 10 '24 08:04 MaximeThoonsen

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

gponty avatar Apr 11 '24 08:04 gponty

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

MaximeThoonsen avatar Apr 12 '24 03:04 MaximeThoonsen

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

gponty avatar Apr 16 '24 08:04 gponty

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

myneid avatar Apr 17 '24 19:04 myneid