shcherbanich / symfony-console-gpt
Use console application through regular chat with ConsoleGpt!
Installs: 5
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/shcherbanich/symfony-console-gpt
Requires
- php: ^8.1.0
- gioni06/gpt3-tokenizer: ^1.2
- guzzlehttp/guzzle: ^7.9
- nyholm/psr7: ^1.8
- openai-php/client: ^0.10.3
- symfony/console: ^7.1
- symfony/http-client: ^7.2
- symfony/process: ^7.2
Requires (Dev)
- dg/bypass-finals: ^1.4
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: 3.*
README
This library allows seamless integration of a GPT-based chat interface with symfony/console, enabling users to execute one command or a sequence of commands and manipulate them interactively via chat.
Have you dreamed of speaking the same language with your application? 😀
Try chatting with the demo app
$ OPENAI_API_KEY='<your API key>' php demo/demo.php chat
Features
- Run Console Commands: Execute a single Symfony console command or a sequence of commands through an interactive chat.
- Processing the result: Dynamically change and modify the return result of console commands. If you want to display it in the form of a table, please do so. Translating into any language is not a problem.
- Easy to use: Integrate ConsoleGpt into your existing Symfony console application and start talking to it today!
Installation
- 
Add the library to your project via Composer: composer require shcherbanich/symfony-console-gpt 
- 
Ensure your project uses Symfony Console ( symfony/console).
- 
Add the Chatcommand to your Symfony console application.
- 
Set the environment variable OPENAI_API_KEY.
Usage
Basic Setup
The library provides a ready-to-use command: ConsoleGpt\Command\ChatCommand. You can use it in your project in two ways:
- 
Add the Command to Your Application 
 Include theChatCommandin your console application:use ConsoleGpt\Command\ChatCommand; use Symfony\Component\Console\Application; $application = new Application(); $application->add(new ChatCommand()); $application->run(); 
- 
Inherit from the Chat Application namespace MyApp\Console; use ConsoleGpt\Application as ChatApplication; final class SomeApp extends ChatApplication { // Add custom behavior here } 
In this case, the command will be available in your application.
Running the Chat Command
Run the chat command in your console:
$ OPENAI_API_KEY='<your API key>' php console chat
and enjoy the magic :)
