Skip to content

Commit

Permalink
Fixes error Argument #1 ($agent) must be of type string, object given
Browse files Browse the repository at this point in the history
  • Loading branch information
butschster committed Sep 4, 2024
1 parent d7ae416 commit 128c268
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/AgentExecutor/Interceptor/GeneratePromptInterceptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ public function execute(
ExecutorInterface $next,
): Execution {
if (!$prompt instanceof Prompt) {
$agent = $this->agents->get($agent);
$prompt = $this->promptGenerator->generate($agent, $prompt, $promptContext);
$prompt = $this->promptGenerator->generate(
$this->agents->get($agent),
$prompt,
$promptContext,
);
}

return $next->execute(
Expand Down
1 change: 0 additions & 1 deletion src/AgentExecutor/Interceptor/InjectModelInterceptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use LLM\Agents\Agent\Execution;
use LLM\Agents\AgentExecutor\ExecutorInterceptorInterface;
use LLM\Agents\AgentExecutor\ExecutorInterface;
use LLM\Agents\LLM\AgentPromptGeneratorInterface;
use LLM\Agents\LLM\ContextInterface;
use LLM\Agents\LLM\OptionsInterface;
use LLM\Agents\LLM\Prompt\Chat\Prompt;
Expand Down

0 comments on commit 128c268

Please sign in to comment.