-
-
Notifications
You must be signed in to change notification settings - Fork 124
[AI Bundle] Add chat console command for interactive AI agent conversations #395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
be7fc49 to
7429039
Compare
|
Ready for review |
GromNaN
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice feature!
I think there are small details we can improve.
|
Ready to merge from my side |
3a9bf1a to
73ba017
Compare
chr-hertel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great for testing 👍
|
oh, i wonder, did you try to use streaming? otherwise maybe a follow up |
chr-hertel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
found that one bug about the ChoiceQuestion
No not yet, lets follow up |
GromNaN
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can simplify by using short agent names everywhere.
|
I agree with @GromNaN that we can simplify this a lot if we only allow |
|
It works when I provide a correct one, or a wrong one. But it does not work when I provide none... investigating. |
|
Works now! |
|
Got a 👍 from @chr-hertel via WhatsApp 😄 |
2872221 to
6309a0b
Compare
| protected function interact(InputInterface $input, OutputInterface $output): void | ||
| { | ||
| // Skip interaction in non-interactive mode | ||
| if (!$input->isInteractive()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useless check. The parent class already skips calling the interact method entirely.
| protected function configure(): void | ||
| { | ||
| $this | ||
| ->addArgument('agent', InputArgument::OPTIONAL, 'The name of the agent to chat with') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The argument should be marked as required, as you use the interact method to fill it anyway. this provides better documentation (and standard error reporting)
| } | ||
|
|
||
| $agentArg = $input->getArgument('agent'); | ||
| $this->agentName = \is_string($agentArg) ? $agentArg : ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why using instance properties (making the service stateful) when they are only used locally ? You should use local variables instead.
|
Thanks for your feedback @stof, makes sense |
This PR was squashed before being merged into the main branch. Discussion ---------- [AI Bundle] Improve `ChatCommand` | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Docs? | no | Issues | Follows #395 | License | MIT cc `@stof` Commits ------- c0e7f3c [AI Bundle] Improve `ChatCommand`
…(OskarStark) This PR was merged into the main branch. Discussion ---------- [AI Bundle] Rename `ai:chat` command to `ai:agent:call` | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Docs? | no | Issues | Follows #395 | License | MIT I think we can have ai:chat command soon after #675 Commits ------- ec7018f Rename ai:chat command to ai:agent:call with backward compatibility



Implement a new console command
bin/console ai:chatthat allows users to interactively chat with different AI agents (blog, stream, youtube, wikipedia, audio). The command supports custom system prompts and maintains conversation history.Demo