diff --git a/src/Agent/AgentExecutor.php b/src/Agent/AgentExecutor.php index 417bb78..4828c15 100644 --- a/src/Agent/AgentExecutor.php +++ b/src/Agent/AgentExecutor.php @@ -11,7 +11,9 @@ use LLM\Agents\LLM\OptionsFactoryInterface; use LLM\Agents\LLM\OptionsInterface; use LLM\Agents\LLM\Prompt\Chat\Prompt; +use LLM\Agents\LLM\Prompt\Context; use LLM\Agents\LLM\Prompt\Tool; +use LLM\Agents\LLM\PromptContextInterface; use LLM\Agents\LLM\Response\ChatResponse; use LLM\Agents\LLM\Response\ToolCalledResponse; use LLM\Agents\Solution\ToolLink; @@ -36,14 +38,14 @@ public function execute( string|\Stringable|Prompt $prompt, ?ContextInterface $context = null, ?OptionsInterface $options = null, - ?array $sessionContext = null, + PromptContextInterface $promptContext = new Context(), ): Execution { $agent = $this->agents->get($agent); $context ??= $this->contextFactory->create(); - if (! $prompt instanceof Prompt) { - $prompt = $this->promptGenerator->generate($agent, $prompt, $sessionContext); + if (!$prompt instanceof Prompt) { + $prompt = $this->promptGenerator->generate($agent, $prompt, $promptContext); } $model = $agent->getModel(); diff --git a/src/LLM/Prompt/Context.php b/src/LLM/Prompt/Context.php new file mode 100644 index 0000000..b4c2c60 --- /dev/null +++ b/src/LLM/Prompt/Context.php @@ -0,0 +1,12 @@ +