Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
OskarStark committed Oct 5, 2024
1 parent d722f60 commit 379ed04
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/Response/TollCallResponseTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

namespace PhpLlm\LlmChain\Tests\Response;

use PhpLlm\LlmChain\Exception\InvalidArgumentException;
use PhpLlm\LlmChain\Response\ToolCall;
use PhpLlm\LlmChain\Response\ToolCallResponse;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\Small;
use PHPUnit\Framework\Attributes\Test;
use PHPUnit\Framework\Attributes\UsesClass;
use PHPUnit\Framework\TestCase;

#[CoversClass(ToolCallResponse::class)]
#[UsesClass(ToolCall::class)]
#[Small]
final class TollCallResponseTest extends TestCase
{
#[Test]
public function throwsIfNoToolCall(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Response must have at least one tool call.');

new ToolCallResponse();
}

#[Test]
public function getContent(): void
{
$response = new ToolCallResponse($toolCall = new ToolCall('ID', 'name', ['foo' => 'bar']));
self::assertSame([$toolCall], $response->getContent());
}
}

0 comments on commit 379ed04

Please sign in to comment.