Zhuoxi2000 opened a new issue, #1482:
URL: https://github.com/apache/flink-agents/issues/1482

   ### Search before asking
   
   - [x] I searched in the 
[issues](https://github.com/apache/flink-agents/issues) and found nothing 
similar.
   
   ### Description
   
   A text prompt (`Prompt.from_text` / `Prompt.fromText`) set as a chat model 
setup's `prompt` becomes a different message role in each language:
   
   - Java: `BaseChatModelSetup` renders it with 
`prompt.formatMessages(MessageRole.USER, ...)` (`BaseChatModelSetup.java:253`), 
so it is sent as a **user** message.
   - Python: `BaseChatModelSetup` calls 
`self._get_prompt().format_messages(**str_prompt_args)` (`chat_model.py:575`), 
which uses the default `MessageRole.SYSTEM`, so it is sent as a **system** 
message.
   
   The same agent, declared in Java, Python or YAML, therefore sends a 
different conversation to the model depending on the language that runs the 
setup. The docs don't say which role a text prompt takes. Messages prompts are 
not affected, since each message carries its own role.
   
   Which role is intended? I'm happy to align the other side, plus a 
cross-language test, once that's settled.
   
   ### How to reproduce
   
   Bind `Prompt.from_text("Summarize {text}")` / `Prompt.fromText("Summarize 
{text}")` to a chat model setup in each language and inspect the messages sent 
to the model: Java sends `user: Summarize ...`, Python sends `system: Summarize 
...`.
   
   ### Version and environment
   
   main at 0f83f4b9, Java 17 / Python 3.11, macOS.
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to