Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/agent/src/Memory/EmbeddingProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __construct(
) {
}

public function loadMemory(Input $input): array
public function load(Input $input): array
{
$messages = $input->messages->getMessages();
/** @var MessageInterface|null $userMessage */
Expand Down
2 changes: 1 addition & 1 deletion src/agent/src/Memory/MemoryInputProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function processInput(Input $input): void

$memory = '';
foreach ($this->memoryProviders as $provider) {
$memoryMessages = $provider->loadMemory($input);
$memoryMessages = $provider->load($input);

if (0 === \count($memoryMessages)) {
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/agent/src/Memory/MemoryProviderInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ interface MemoryProviderInterface
/**
* @return list<Memory>
*/
public function loadMemory(Input $input): array;
public function load(Input $input): array;
}
2 changes: 1 addition & 1 deletion src/agent/src/Memory/StaticMemoryProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function __construct(string ...$memory)
$this->memory = $memory;
}

public function loadMemory(Input $input): array
public function load(Input $input): array
{
if (0 === \count($this->memory)) {
return [];
Expand Down
10 changes: 5 additions & 5 deletions src/agent/tests/Memory/EmbeddingProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function testItIsDoingNothingWithEmptyMessageBag()
$store,
);

$embeddingProvider->loadMemory(new Input(
$embeddingProvider->load(new Input(
$this->createStub(Model::class),
new MessageBag(),
[],
Expand All @@ -76,7 +76,7 @@ public function testItIsDoingNothingWithoutUserMessageInBag()
$store,
);

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

$embeddingProvider->loadMemory(new Input(
$embeddingProvider->load(new Input(
$this->createStub(Model::class),
new MessageBag(Message::ofUser(new ImageUrl('foo.jpg'))),
[],
Expand Down Expand Up @@ -129,7 +129,7 @@ public function testItIsNotCreatingMemoryWhenNoVectorsFound()
$store,
);

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

$memory = $embeddingProvider->loadMemory(new Input(
$memory = $embeddingProvider->load(new Input(
$this->createStub(Model::class),
new MessageBag(Message::ofUser(new Text('Have we talked about the weather?'))),
[],
Expand Down
10 changes: 5 additions & 5 deletions src/agent/tests/Memory/MemoryInputProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ public function testItIsAddingMemoryToSystemPrompt()
{
$firstMemoryProvider = $this->createMock(MemoryProviderInterface::class);
$firstMemoryProvider->expects($this->once())
->method('loadMemory')
->method('load')
->willReturn([new Memory('First memory content')]);

$secondMemoryProvider = $this->createMock(MemoryProviderInterface::class);
$secondMemoryProvider->expects($this->once())
->method('loadMemory')
->method('load')
->willReturn([]);

$memoryInputProcessor = new MemoryInputProcessor(
Expand Down Expand Up @@ -106,7 +106,7 @@ public function testItIsAddingMemoryToSystemPromptEvenItIsEmpty()
{
$firstMemoryProvider = $this->createMock(MemoryProviderInterface::class);
$firstMemoryProvider->expects($this->once())
->method('loadMemory')
->method('load')
->willReturn([new Memory('First memory content')]);

$memoryInputProcessor = new MemoryInputProcessor($firstMemoryProvider);
Expand Down Expand Up @@ -136,7 +136,7 @@ public function testItIsAddingMultipleMemoryFromSingleProviderToSystemPrompt()
{
$firstMemoryProvider = $this->createMock(MemoryProviderInterface::class);
$firstMemoryProvider->expects($this->once())
->method('loadMemory')
->method('load')
->willReturn([new Memory('First memory content'), new Memory('Second memory content')]);

$memoryInputProcessor = new MemoryInputProcessor($firstMemoryProvider);
Expand Down Expand Up @@ -167,7 +167,7 @@ public function testItIsNotAddingAnythingIfMemoryWasEmpty()
{
$firstMemoryProvider = $this->createMock(MemoryProviderInterface::class);
$firstMemoryProvider->expects($this->once())
->method('loadMemory')
->method('load')
->willReturn([]);

$memoryInputProcessor = new MemoryInputProcessor($firstMemoryProvider);
Expand Down
4 changes: 2 additions & 2 deletions src/agent/tests/Memory/StaticMemoryProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function testItsReturnsNullWhenNoFactsAreProvided()
{
$provider = new StaticMemoryProvider();

$memory = $provider->loadMemory(new Input(
$memory = $provider->load(new Input(
$this->createStub(Model::class),
new MessageBag(),
[]
Expand All @@ -49,7 +49,7 @@ public function testItDeliversFormattedFacts()
$fact2 = 'Water is wet',
);

$memory = $provider->loadMemory(new Input(
$memory = $provider->load(new Input(
$this->createStub(Model::class),
new MessageBag(),
[]
Expand Down