-
-
Notifications
You must be signed in to change notification settings - Fork 111
[Agent] Add basic setup for memory injections to system prompt #117
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
3418c1f to
848ccc9
Compare
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.
Thanks for moving this - that saves me some time 🙏
Found one small left over in the example, and please remove declare(strict_types=1); - then we're good to merge this :)
Can we update the PHP-CS-Fixer config? |
848ccc9 to
d9b13f9
Compare
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.
|
Thank you @DZunke. |
…skarStark) This PR was squashed before being merged into the main branch. Discussion ---------- [AI Bundle] Add memory provider configuration support | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Docs? | yes | Issues | Follows #117 | License | MIT This PR introduces comprehensive memory provider configuration capabilities for AI agents, enabling both simple static memory and advanced dynamic memory scenarios. ## 🚀 Key Features ### Smart Detection Logic The system automatically detects the intent: - If the value matches an existing service/alias → uses that service directly - If no matching service exists → creates `StaticMemoryProvider` with the string as static content ### Memory as System Prompt - When only `memory` is provided (no `prompt`), memory serves as the system prompt - When both `memory` and `prompt` are provided, memory is prepended to the prompt ### Configuration Examples **Static Memory (Most Common):** ```yaml ai: agent: my_agent: model: class: 'Symfony\AI\Platform\Bridge\OpenAi\Gpt' name: !php/const Symfony\AI\Platform\Bridge\OpenAi\Gpt::GPT_4O_MINI memory: 'You have access to user preferences and conversation history' prompt: text: 'You are a helpful assistant.' ``` **Dynamic Memory (Advanced):** ```yaml ai: agent: my_agent: model: class: 'Symfony\AI\Platform\Bridge\OpenAi\Gpt' name: !php/const Symfony\AI\Platform\Bridge\OpenAi\Gpt::GPT_4O_MINI memory: 'my_custom_memory_service' # References existing service prompt: text: 'You are a helpful assistant.' ``` **Memory as System Prompt:** ```yaml ai: agent: my_agent: model: class: 'Symfony\AI\Platform\Bridge\OpenAi\Gpt' name: !php/const Symfony\AI\Platform\Bridge\OpenAi\Gpt::GPT_4O_MINI memory: 'You are a helpful assistant with access to user context.' # No prompt needed - memory serves as system prompt ``` This enhancement significantly improves the developer experience while maintaining full backward compatibility and adding powerful new memory capabilities for AI agents. cc `@DZunke` Commits ------- f4ac5b6 [AI Bundle] Add memory provider configuration support

See original contribution at php-llm/llm-chain#387