Skip to content

Commit 9a4f633

Browse files
committed
tool parameters
1 parent bff641a commit 9a4f633

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

src/Agent/Nodes/ParallelToolNode.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use NeuronAI\Chat\Messages\ToolCallMessage;
1212
use NeuronAI\Chat\Messages\ToolResultMessage;
1313
use NeuronAI\Exceptions\ToolException;
14-
use NeuronAI\Exceptions\ToolMaxTriesException;
14+
use NeuronAI\Exceptions\ToolRunsExceededException;
1515
use NeuronAI\Observability\Events\AgentError;
1616
use NeuronAI\Observability\Events\ToolCalled;
1717
use NeuronAI\Observability\Events\ToolCalling;
@@ -33,7 +33,7 @@ class ParallelToolNode extends ToolNode
3333
{
3434
/**
3535
* @throws ToolException
36-
* @throws ToolMaxTriesException
36+
* @throws ToolRunsExceededException
3737
* @throws Throwable
3838
*/
3939
protected function executeTools(ToolCallMessage $toolCallMessage, AgentState $state): Generator
@@ -62,7 +62,7 @@ protected function executeTools(ToolCallMessage $toolCallMessage, AgentState $st
6262
// Single tool max tries have the highest priority over the global max tries
6363
$maxTries = $tool->getMaxRuns() ?? $this->maxRuns;
6464
if ($state->getToolAttempts($tool->getName()) > $maxTries) {
65-
throw new ToolMaxTriesException("Tool {$tool->getName()} has been attempted too many times: {$maxTries} attempts.");
65+
throw new ToolRunsExceededException("Tool {$tool->getName()} has been attempted too many times: {$maxTries} attempts.");
6666
}
6767

6868
$this->emit('tool-calling', new ToolCalling($tool));

src/Agent/Nodes/ToolNode.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use NeuronAI\Chat\Messages\Stream\Chunks\ToolResultChunk;
1313
use NeuronAI\Chat\Messages\ToolCallMessage;
1414
use NeuronAI\Chat\Messages\ToolResultMessage;
15-
use NeuronAI\Exceptions\ToolMaxTriesException;
15+
use NeuronAI\Exceptions\ToolRunsExceededException;
1616
use NeuronAI\Observability\Events\ToolCalled;
1717
use NeuronAI\Observability\Events\ToolCalling;
1818
use NeuronAI\Tools\ToolInterface;
@@ -32,7 +32,7 @@ public function __construct(
3232
}
3333

3434
/**
35-
* @throws ToolMaxTriesException
35+
* @throws ToolRunsExceededException
3636
* @throws Throwable
3737
*/
3838
public function __invoke(ToolCallEvent $event, AgentState $state): Generator
@@ -52,7 +52,7 @@ public function __invoke(ToolCallEvent $event, AgentState $state): Generator
5252

5353
/**
5454
* @throws Throwable
55-
* @throws ToolMaxTriesException
55+
* @throws ToolRunsExceededException
5656
*/
5757
protected function executeTools(ToolCallMessage $toolCallMessage, AgentState $state): Generator
5858
{
@@ -68,7 +68,7 @@ protected function executeTools(ToolCallMessage $toolCallMessage, AgentState $st
6868
/**
6969
* Execute a single tool with proper error handling and retry logic.
7070
*
71-
* @throws ToolMaxTriesException If the tool exceeds its maximum retry attempts
71+
* @throws ToolRunsExceededException If the tool exceeds its maximum retry attempts
7272
* @throws Throwable If the tool execution fails
7373
*/
7474
protected function executeSingleTool(ToolInterface $tool, AgentState $state): void
@@ -81,7 +81,7 @@ protected function executeSingleTool(ToolInterface $tool, AgentState $state): vo
8181
// Single tool max tries have the highest priority over the global max tries
8282
$runs = $tool->getMaxRuns() ?? $this->maxRuns;
8383
if ($state->getToolAttempts($tool->getName()) > $runs) {
84-
throw new ToolMaxTriesException("Tool {$tool->getName()} has been executed too many times: {$runs}.");
84+
throw new ToolRunsExceededException("Tool {$tool->getName()} has been executed too many times: {$runs}.");
8585
}
8686

8787
$tool->execute();

src/Exceptions/ToolMaxTriesException.php renamed to src/Exceptions/ToolRunsExceededException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
namespace NeuronAI\Exceptions;
66

7-
class ToolMaxTriesException extends ToolException
7+
class ToolRunsExceededException extends ToolException
88
{
99
}

0 commit comments

Comments
 (0)