You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by xt...@apache.org on 2025/09/26 05:14:10 UTC
(flink-agents) 01/03: [hotfix] Append input messages to prompt.
This is an automated email from the ASF dual-hosted git repository.
xtsong pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/flink-agents.git
commit 03c3e8988a709264cc29515f1d50581481fa765d
Author: WenjinXie <we...@gmail.com>
AuthorDate: Thu Sep 25 14:22:49 2025 +0800
[hotfix] Append input messages to prompt.
---
python/flink_agents/api/chat_models/chat_model.py | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/python/flink_agents/api/chat_models/chat_model.py b/python/flink_agents/api/chat_models/chat_model.py
index 418ba44..fb56cf9 100644
--- a/python/flink_agents/api/chat_models/chat_model.py
+++ b/python/flink_agents/api/chat_models/chat_model.py
@@ -182,10 +182,17 @@ class BaseChatModelSetup(Resource):
prompt = self.prompt
input_variable = {}
+
+ # fill the prompt template
for msg in messages:
input_variable.update(msg.extra_args)
- messages = prompt.format_messages(**input_variable)
+ prompt_messages = prompt.format_messages(**input_variable)
+ # append meaningful messages
+ for msg in messages:
+ if msg.content is not None and msg.content != "":
+ prompt_messages.append(msg)
+ messages = prompt_messages
# Bind tools
tools = None
if self.tools is not None: