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/tests/StructuredOutput/AgentProcessorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
use Symfony\AI\Fixtures\StructuredOutput\Step;
use Symfony\AI\Platform\Capability;
use Symfony\AI\Platform\Message\MessageBag;
use Symfony\AI\Platform\Metadata\Metadata;
use Symfony\AI\Platform\Model;
use Symfony\AI\Platform\Result\Metadata\Metadata;
use Symfony\AI\Platform\Result\ObjectResult;
use Symfony\AI\Platform\Result\TextResult;
use Symfony\Component\Serializer\SerializerInterface;
Expand Down
4 changes: 4 additions & 0 deletions src/platform/src/Message/MessageBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@

namespace Symfony\AI\Platform\Message;

use Symfony\AI\Platform\Metadata\MetadataAwareTrait;

/**
* @final
*
* @author Christopher Hertel <mail@christopher-hertel.de>
*/
class MessageBag implements MessageBagInterface
{
use MetadataAwareTrait;

/**
* @var list<MessageInterface>
*/
Expand Down
4 changes: 4 additions & 0 deletions src/platform/src/Message/MessageBagInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

namespace Symfony\AI\Platform\Message;

use Symfony\AI\Platform\Metadata\Metadata;

/**
* @author Oskar Stark <oskarstark@googlemail.com>
*/
Expand All @@ -36,4 +38,6 @@ public function prepend(MessageInterface $message): self;
public function containsAudio(): bool;

public function containsImage(): bool;

public function getMetadata(): Metadata;
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\AI\Platform\Result\Metadata;
namespace Symfony\AI\Platform\Metadata;

/**
* @implements \IteratorAggregate<string, mixed>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

namespace Symfony\AI\Platform\Result\Metadata;
namespace Symfony\AI\Platform\Metadata;

/**
* @author Denis Zunke <denis.zunke@gmail.com>
Expand Down
2 changes: 1 addition & 1 deletion src/platform/src/Result/BaseResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Symfony\AI\Platform\Result;

use Symfony\AI\Platform\Result\Metadata\MetadataAwareTrait;
use Symfony\AI\Platform\Metadata\MetadataAwareTrait;

/**
* Base result of converted result classes.
Expand Down
2 changes: 1 addition & 1 deletion src/platform/src/Result/ResultInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace Symfony\AI\Platform\Result;

use Symfony\AI\Platform\Metadata\Metadata;
use Symfony\AI\Platform\Result\Exception\RawResultAlreadySetException;
use Symfony\AI\Platform\Result\Metadata\Metadata;

/**
* @author Christopher Hertel <mail@christopher-hertel.de>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
use Symfony\AI\Agent\Output;
use Symfony\AI\Platform\Bridge\Mistral\TokenOutputProcessor;
use Symfony\AI\Platform\Message\MessageBagInterface;
use Symfony\AI\Platform\Metadata\Metadata;
use Symfony\AI\Platform\Model;
use Symfony\AI\Platform\Result\Metadata\Metadata;
use Symfony\AI\Platform\Result\Metadata\TokenUsage;
use Symfony\AI\Platform\Result\RawHttpResult;
use Symfony\AI\Platform\Result\ResultInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
use Symfony\AI\Agent\Output;
use Symfony\AI\Platform\Bridge\OpenAi\TokenOutputProcessor;
use Symfony\AI\Platform\Message\MessageBagInterface;
use Symfony\AI\Platform\Metadata\Metadata;
use Symfony\AI\Platform\Model;
use Symfony\AI\Platform\Result\Metadata\Metadata;
use Symfony\AI\Platform\Result\Metadata\TokenUsage;
use Symfony\AI\Platform\Result\RawHttpResult;
use Symfony\AI\Platform\Result\ResultInterface;
Expand Down
13 changes: 13 additions & 0 deletions src/platform/tests/Message/MessageBagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,17 @@ public function testContainsImageReturnsTrueWithImage()

$this->assertTrue($messageBag->containsImage());
}

public function testItCanHandleMetadata()
{
$messageBag = new MessageBag();
$metadata = $messageBag->getMetadata();

$this->assertCount(0, $metadata);

$metadata->add('key', 'value');
$metadata = $messageBag->getMetadata();

$this->assertCount(1, $metadata);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
* file that was distributed with this source code.
*/

namespace Symfony\AI\Platform\Tests\Result\Metadata;
namespace Symfony\AI\Platform\Tests\Metadata;

use PHPUnit\Framework\Attributes\CoversTrait;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\Attributes\UsesClass;
use PHPUnit\Framework\TestCase;
use Symfony\AI\Platform\Result\Metadata\Metadata;
use Symfony\AI\Platform\Result\Metadata\MetadataAwareTrait;
use Symfony\AI\Platform\Metadata\Metadata;
use Symfony\AI\Platform\Metadata\MetadataAwareTrait;

#[CoversTrait(MetadataAwareTrait::class)]
#[Small]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
* file that was distributed with this source code.
*/

namespace Symfony\AI\Platform\Tests\Result\Metadata;
namespace Symfony\AI\Platform\Tests\Metadata;

use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\TestCase;
use Symfony\AI\Platform\Result\Metadata\Metadata;
use Symfony\AI\Platform\Metadata\Metadata;

#[CoversClass(Metadata::class)]
#[Small]
Expand Down
4 changes: 2 additions & 2 deletions src/platform/tests/Result/BaseResultTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
use PHPUnit\Framework\Attributes\UsesClass;
use PHPUnit\Framework\Attributes\UsesTrait;
use PHPUnit\Framework\TestCase;
use Symfony\AI\Platform\Metadata\Metadata;
use Symfony\AI\Platform\Metadata\MetadataAwareTrait;
use Symfony\AI\Platform\Result\BaseResult;
use Symfony\AI\Platform\Result\Exception\RawResultAlreadySetException;
use Symfony\AI\Platform\Result\Metadata\Metadata;
use Symfony\AI\Platform\Result\Metadata\MetadataAwareTrait;
use Symfony\AI\Platform\Result\RawResultAwareTrait;
use Symfony\AI\Platform\Result\RawResultInterface;

Expand Down
2 changes: 1 addition & 1 deletion src/platform/tests/Result/ResultPromiseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\Attributes\UsesClass;
use PHPUnit\Framework\TestCase;
use Symfony\AI\Platform\Metadata\Metadata;
use Symfony\AI\Platform\Result\BaseResult;
use Symfony\AI\Platform\Result\Exception\RawResultAlreadySetException;
use Symfony\AI\Platform\Result\Metadata\Metadata;
use Symfony\AI\Platform\Result\RawHttpResult;
use Symfony\AI\Platform\Result\RawResultInterface;
use Symfony\AI\Platform\Result\ResultInterface;
Expand Down