Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Commit 668cf3c

Browse files
committed
refactor: remove resolver interface for now
1 parent 694ee2d commit 668cf3c

File tree

3 files changed

+4
-21
lines changed

3 files changed

+4
-21
lines changed

src/Chain/Toolbox/ToolCallArgumentResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
/**
1313
* @author Valtteri R <valtzu@gmail.com>
1414
*/
15-
final readonly class ToolCallArgumentResolver implements ToolCallArgumentResolverInterface
15+
final readonly class ToolCallArgumentResolver
1616
{
1717
public function __construct(
1818
private DenormalizerInterface $denormalizer = new Serializer([new DateTimeNormalizer(), new ObjectNormalizer()]),
1919
) {
2020
}
2121

22-
public function resolveArguments(object $tool, Tool $metadata, ToolCall $toolCall): array
22+
public function resolveArguments(Tool $metadata, ToolCall $toolCall): array
2323
{
2424
$method = new \ReflectionMethod($metadata->reference->class, $metadata->reference->method);
2525

src/Chain/Toolbox/ToolCallArgumentResolverInterface.php

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/Chain/Toolbox/Toolbox.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ final class Toolbox implements ToolboxInterface
3939
public function __construct(
4040
private readonly ToolFactoryInterface $toolFactory,
4141
iterable $tools,
42+
private readonly ToolCallArgumentResolver $argumentResolver = new ToolCallArgumentResolver(),
4243
private readonly LoggerInterface $logger = new NullLogger(),
43-
private readonly ToolCallArgumentResolverInterface $argumentResolver = new ToolCallArgumentResolver(),
4444
private readonly ?EventDispatcherInterface $eventDispatcher = null,
4545
) {
4646
$this->tools = $tools instanceof \Traversable ? iterator_to_array($tools) : $tools;
@@ -75,7 +75,7 @@ public function execute(ToolCall $toolCall): mixed
7575
try {
7676
$this->logger->debug(\sprintf('Executing tool "%s".', $toolCall->name), $toolCall->arguments);
7777

78-
$arguments = $this->argumentResolver->resolveArguments($tool, $metadata, $toolCall);
78+
$arguments = $this->argumentResolver->resolveArguments($metadata, $toolCall);
7979
$this->eventDispatcher?->dispatch(new ToolCallArgumentsResolved($tool, $metadata, $arguments));
8080

8181
$result = $tool->{$metadata->reference->method}(...$arguments);

0 commit comments

Comments
 (0)