Workshop: Symfony AI - Discover The New Ecosystem
What you need to participate in this workshop:
- Internet Connection
- Terminal & Browser
- Git & GitHub Account
- Docker with Docker Compose Plugin
- Your Favorite IDE or Editor
- An OpenAI API Key
- An MCP Client, e.g. the MCP Inspector (optional)
- Membership in the Symfony Slack, so we can share private files during in-person workshops
This small demo sits on top of following technologies:
- PHP >= 8.4
- Symfony 7.4 incl. Twig, Asset Mapper & UX
- Stimulus & Bootstrap 5
- OpenAI's GPT & Embeddings
- ChromaDB Vector Store
- FrankenPHP
And of course, the Symfony AI 1.0 Components & Bundles.
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:sensiolabs-de/symfony-ai-workshop.git
cd symfony-ai-workshop
docker compose up -d
docker compose run composer installNow 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 the OPENAI_API_KEY env variable.
This is done by copying the provided dev.decrypt.private.php file into config/secrets/dev/ directory.
Verify the success of this step by running the following command:
docker compose exec app bin/console secrets:list [--reveal]You should see the OPENAI_API_KEY in the list of secrets.
And as a last step, you can call the test command:
docker compose exec app bin/console app:openai:testThe Chroma DB vector store starts together with the docker environment and is available on port 8080 of your host.
Verify that it is up and running:
curl http://localhost:8080/api/v2/heartbeatSetting up the collection and indexing the conference schedule is part of the workshop.
Don't forget to set up the project in your favorite IDE or editor.
- The chatbot application is a simple and small Symfony 7.4 application.
- The UI is coupled to a Twig LiveComponent, that integrates different
Chatimplementations on top of the user's session. - You can reset the chat context by hitting the
Resetbutton in the top right corner. - As part of this workshop, we will connect the
Chatwith GPT, a vector store and other tools.
The application comes with an MCP server, configured in config/packages/mcp.yaml. Once its tools are in place, you
can connect your MCP client with one of the two transports:
- HTTP:
https://localhost/mcp/demo_app - STDIO:
docker compose exec -T app bin/console mcp:server
Note
HTTP clients need to accept the self-signed certificate. If yours can't, use the STDIO transport instead.
To see what the server exposes, run:
docker compose exec app bin/console debug:mcpThis repository comes with some tools for quality assurance installed, and a small wrapper script.
bin/checkdocker compose run composer install
docker compose run composer validatedocker compose exec app vendor/bin/php-cs-fixer fixdocker compose exec app vendor/bin/phpstan analyse --memory-limit=-1docker compose exec app vendor/bin/phpunit