Skip to content

Simple Symfony App providing a GPT Chat UI (dependencies upgraded)

License

boryszielonka/symfonycon-vienna-chatbot

 
 

Repository files navigation

SymfonyCon Vienna 2024 - Custom Chatbot

Simple Symfony based Chat Bot UI on top of OpenAI's GPT. It was build as demo for a workshop at SymfonyCon Vienna 2024.

Before we start, let's have a brief look at the technologies, setup and basic architecture of this demo.

Requirements

What you need to run this demo:

Technology

This small demo sits on top of following technologies:

Setup

The setup is split into two parts, the Symfony application and the OpenAI configuration.

1. Symfony App

Checkout the repository, start the docker environment and install dependencies:

git clone git@github.com:chr-hertel/symfonycon-vienna-chatbot.git
cd symfonycon-vienna-chatbot
docker compose up -d
docker compose exec app composer install

Now you should be able to open https://localhost:8080 in your browser, and the chatbot UI should be available for you to start chatting.

2. OpenAI Configuration

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.

Don't forget to set up the project in your favorite IDE or editor.

Functionality

  • The chatbot application is a simple and small Symfony 7.1 application.
  • The UI is coupled to a Twig LiveComponent, that integrates a Chat implementation on top of the user's session.
  • You can reset the chat context by hitting the Reset button in the top right corner.
  • As part of this workshop, we will connect the Chat with GPT, a vector store and other tools.

The challenges of this workshop are documented in the CHALLENGES.md file.

Helpers

This repository comes with some tools for quality assurance installed, and a small wrapper script.

Execute all quality checks at once

bin/check

Composer

docker compose exec app composer install
docker compose exec app composer validate

PHP CS Fixer

docker compose exec app vendor/bin/php-cs-fixer fix

PHPStan

docker compose exec app vendor/bin/phpstan analyse

PHPUnit

docker compose exec app vendor/bin/phpunit

About

Simple Symfony App providing a GPT Chat UI (dependencies upgraded)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 39.4%
  • Twig 21.0%
  • JavaScript 18.7%
  • CSS 10.2%
  • Shell 9.0%
  • Dockerfile 1.7%