theodo-group / LLPhant

LLPhant - A comprehensive PHP Generative AI Framework using OpenAI GPT 4. Inspired by Langchain
MIT License
667 stars 62 forks source link

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

Open gponty opened 3 months ago

gponty commented 3 months ago

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 commented 3 months ago

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 commented 2 months ago

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

MaximeThoonsen commented 2 months ago

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

gponty commented 2 months ago

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

myneid commented 2 months ago

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