Skip to content

Commit e42a31f

Browse files
committed
[Agent] Rename MemoryProviderInterface::loadMemory to load
Simplify the method name by removing the redundant 'Memory' prefix. This improves readability and follows interface naming conventions. Changes: - MemoryProviderInterface::loadMemory() → load() - Updated all implementations and usages - All tests passing
1 parent 5308d4d commit e42a31f

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

src/agent/src/Memory/EmbeddingProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function __construct(
3232
) {
3333
}
3434

35-
public function loadMemory(Input $input): array
35+
public function load(Input $input): array
3636
{
3737
$messages = $input->messages->getMessages();
3838
/** @var MessageInterface|null $userMessage */

src/agent/src/Memory/MemoryInputProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function processInput(Input $input): void
5252

5353
$memory = '';
5454
foreach ($this->memoryProviders as $provider) {
55-
$memoryMessages = $provider->loadMemory($input);
55+
$memoryMessages = $provider->load($input);
5656

5757
if (0 === \count($memoryMessages)) {
5858
continue;

src/agent/src/Memory/MemoryProviderInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ interface MemoryProviderInterface
2121
/**
2222
* @return list<Memory>
2323
*/
24-
public function loadMemory(Input $input): array;
24+
public function load(Input $input): array;
2525
}

src/agent/src/Memory/StaticMemoryProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(string ...$memory)
2828
$this->memory = $memory;
2929
}
3030

31-
public function loadMemory(Input $input): array
31+
public function load(Input $input): array
3232
{
3333
if (0 === \count($this->memory)) {
3434
return [];

src/agent/tests/Memory/EmbeddingProviderTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function testItIsDoingNothingWithEmptyMessageBag()
5555
$store,
5656
);
5757

58-
$embeddingProvider->loadMemory(new Input(
58+
$embeddingProvider->load(new Input(
5959
$this->createStub(Model::class),
6060
new MessageBag(),
6161
[],
@@ -76,7 +76,7 @@ public function testItIsDoingNothingWithoutUserMessageInBag()
7676
$store,
7777
);
7878

79-
$embeddingProvider->loadMemory(new Input(
79+
$embeddingProvider->load(new Input(
8080
$this->createStub(Model::class),
8181
new MessageBag(Message::forSystem('This is a system message')),
8282
[],
@@ -97,7 +97,7 @@ public function testItIsDoingNothingWhenUserMessageHasNoTextContent()
9797
$store,
9898
);
9999

100-
$embeddingProvider->loadMemory(new Input(
100+
$embeddingProvider->load(new Input(
101101
$this->createStub(Model::class),
102102
new MessageBag(Message::ofUser(new ImageUrl('foo.jpg'))),
103103
[],
@@ -129,7 +129,7 @@ public function testItIsNotCreatingMemoryWhenNoVectorsFound()
129129
$store,
130130
);
131131

132-
$memory = $embeddingProvider->loadMemory(new Input(
132+
$memory = $embeddingProvider->load(new Input(
133133
$this->createStub(Model::class),
134134
new MessageBag(Message::ofUser(new Text('Have we talked about the weather?'))),
135135
[],
@@ -166,7 +166,7 @@ public function testItIsCreatingMemoryWithFoundVectors()
166166
$store,
167167
);
168168

169-
$memory = $embeddingProvider->loadMemory(new Input(
169+
$memory = $embeddingProvider->load(new Input(
170170
$this->createStub(Model::class),
171171
new MessageBag(Message::ofUser(new Text('Have we talked about the weather?'))),
172172
[],

src/agent/tests/Memory/MemoryInputProcessorTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,12 @@ public function testItIsAddingMemoryToSystemPrompt()
6464
{
6565
$firstMemoryProvider = $this->createMock(MemoryProviderInterface::class);
6666
$firstMemoryProvider->expects($this->once())
67-
->method('loadMemory')
67+
->method('load')
6868
->willReturn([new Memory('First memory content')]);
6969

7070
$secondMemoryProvider = $this->createMock(MemoryProviderInterface::class);
7171
$secondMemoryProvider->expects($this->once())
72-
->method('loadMemory')
72+
->method('load')
7373
->willReturn([]);
7474

7575
$memoryInputProcessor = new MemoryInputProcessor(
@@ -106,7 +106,7 @@ public function testItIsAddingMemoryToSystemPromptEvenItIsEmpty()
106106
{
107107
$firstMemoryProvider = $this->createMock(MemoryProviderInterface::class);
108108
$firstMemoryProvider->expects($this->once())
109-
->method('loadMemory')
109+
->method('load')
110110
->willReturn([new Memory('First memory content')]);
111111

112112
$memoryInputProcessor = new MemoryInputProcessor($firstMemoryProvider);
@@ -136,7 +136,7 @@ public function testItIsAddingMultipleMemoryFromSingleProviderToSystemPrompt()
136136
{
137137
$firstMemoryProvider = $this->createMock(MemoryProviderInterface::class);
138138
$firstMemoryProvider->expects($this->once())
139-
->method('loadMemory')
139+
->method('load')
140140
->willReturn([new Memory('First memory content'), new Memory('Second memory content')]);
141141

142142
$memoryInputProcessor = new MemoryInputProcessor($firstMemoryProvider);
@@ -167,7 +167,7 @@ public function testItIsNotAddingAnythingIfMemoryWasEmpty()
167167
{
168168
$firstMemoryProvider = $this->createMock(MemoryProviderInterface::class);
169169
$firstMemoryProvider->expects($this->once())
170-
->method('loadMemory')
170+
->method('load')
171171
->willReturn([]);
172172

173173
$memoryInputProcessor = new MemoryInputProcessor($firstMemoryProvider);

src/agent/tests/Memory/StaticMemoryProviderTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function testItsReturnsNullWhenNoFactsAreProvided()
3333
{
3434
$provider = new StaticMemoryProvider();
3535

36-
$memory = $provider->loadMemory(new Input(
36+
$memory = $provider->load(new Input(
3737
$this->createStub(Model::class),
3838
new MessageBag(),
3939
[]
@@ -49,7 +49,7 @@ public function testItDeliversFormattedFacts()
4949
$fact2 = 'Water is wet',
5050
);
5151

52-
$memory = $provider->loadMemory(new Input(
52+
$memory = $provider->load(new Input(
5353
$this->createStub(Model::class),
5454
new MessageBag(),
5555
[]

0 commit comments

Comments
 (0)