You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feature #583 [AI Bundle] Add memory provider configuration support (OskarStark)
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
0 commit comments