fix: allow passing curly braces in system instructions to the Agent component (#5092)

update agent system instructions
This commit is contained in:
Edwin Jose 2024-12-05 16:36:23 -05:00 committed by GitHub
commit fe4acf419b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View file

@ -137,6 +137,8 @@ class LCAgentComponent(Component):
max_iterations=max_iterations,
)
input_dict: dict[str, str | list[BaseMessage]] = {"input": self.input_value}
if hasattr(self, "system_prompt"):
input_dict["system_prompt"] = self.system_prompt
if hasattr(self, "chat_history") and self.chat_history:
input_dict["chat_history"] = data_to_messages(self.chat_history)

View file

@ -42,7 +42,7 @@ class ToolCallingAgentComponent(LCToolsAgentComponent):
def create_agent_runnable(self):
messages = [
("system", self.system_prompt),
("system", "{system_prompt}"),
("placeholder", "{chat_history}"),
("human", "{input}"),
("placeholder", "{agent_scratchpad}"),