Skip to content

Commit

Permalink
Fixes problem with Agent executor
Browse files Browse the repository at this point in the history
  • Loading branch information
butschster committed Sep 4, 2024
1 parent 6771f11 commit 1221fb2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Agent/AgentExecutor.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down
12 changes: 12 additions & 0 deletions src/LLM/Prompt/Context.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace LLM\Agents\LLM\Prompt;

use LLM\Agents\LLM\PromptContextInterface;

class Context implements PromptContextInterface
{

}

0 comments on commit 1221fb2

Please sign in to comment.