Simple Symfony demo application on top of LLM Chain and its integration bundle.
What you need to run this demo:
- Internet Connection
- Terminal & Browser
- Git & GitHub Account
- Docker with Docker Compose Plugin
- Your Favorite IDE or Editor
- An OpenAI API Key
This small demo sits on top of following technologies:
- PHP >= 8.4
- Symfony 7.2 incl. Twig, Asset Mapper & UX
- Bootstrap 5
- OpenAI's GPT & Embeddings
- ChromaDB Vector Store
- FrankenPHP
The setup is split into three parts, the Symfony application, the OpenAI configuration, and initializing the Chroma DB.
Checkout the repository, start the docker environment and install dependencies:
git clone git@github.com:php-llm/symfony-demo.git
cd symfony-demo
docker compose up -d
docker compose run composer install
Now you should be able to open https://localhost/ in your browser, and the chatbot UI should be available for you to start chatting.
Note
You might have to bypass the security warning of your browser with regard to self-signed certificates.
For using GPT and embedding models from OpenAI, you need to configure an OpenAI API key as environment variable.
This requires you to have an OpenAI account, create a valid API key and set it as OPENAI_API_KEY
in .env.local
file.
echo "OPENAI_API_KEY='sk-...'" > .env.local
Verify the success of this step by running the following command:
docker compose exec app bin/console debug:dotenv
You should be able to see the OPENAI_API_KEY
in the list of environment variables.
The Chroma DB is a vector store that is used to store embeddings of the chatbot's context.
To initialize the Chroma DB, you need to run the following command:
docker compose exec app bin/console app:blog:embed -vv
Now you should be able to run the test command and get some results:
docker compose exec app bin/console app:blog:query
Don't forget to set up the project in your favorite IDE or editor.
- The chatbot application is a simple and small Symfony 7.2 application.
- The UI is coupled to a Twig LiveComponent, that integrates different
Chat
implementations on top of the user's session. - You can reset the chat context by hitting the
Reset
button in the top right corner. - You find three different usage scenarios in the upper navbar.