Skip to content

Commit

Permalink
Improves user prompt message. It provides an ability to replace promp…
Browse files Browse the repository at this point in the history
…t text
  • Loading branch information
butschster committed Sep 7, 2024
1 parent 6fc61d8 commit 3bfae04
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"license": "MIT",
"require": {
"php": "^8.3",
"llm-agents/agents": "dev-feature/embeddings as 1.0",
"llm-agents/agents": "^1.5",
"llm-agents/json-schema-mapper": "^1.0"
},
"require-dev": {
Expand Down
11 changes: 5 additions & 6 deletions src/Interceptors/UserPromptInjector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

namespace LLM\Agents\PromptGenerator\Interceptors;

use LLM\Agents\LLM\Prompt\Chat\ChatMessage;
use LLM\Agents\LLM\Prompt\Chat\MessagePrompt;
use LLM\Agents\LLM\Prompt\Chat\Prompt;
use LLM\Agents\LLM\Prompt\Chat\PromptInterface;
use LLM\Agents\LLM\Prompt\Chat\Role;
use LLM\Agents\PromptGenerator\InterceptorHandler;
use LLM\Agents\PromptGenerator\PromptGeneratorInput;
use LLM\Agents\PromptGenerator\PromptInterceptorInterface;
Expand All @@ -23,10 +22,10 @@ public function generate(
return $next(
input: $input->withPrompt(
$input->prompt->withAddedMessage(
new ChatMessage(
content: (string) $input->userPrompt,
role: Role::User,
),
MessagePrompt::user('{user_prompt}')
->withValues([
'user_prompt' => (string) $input->userPrompt,
]),
),
),
);
Expand Down

0 comments on commit 3bfae04

Please sign in to comment.