[Bug][api][java][python] A text prompt on a chat model setup is a user message in Java but a system message in Python

Aperta
#1,482 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java, python

Direzione di ricerca

Read BaseChatModelSetup.java around line 253 and chat_model.py around line 575, then check the prompt formatting APIs and existing cross-language tests. The issue leaves the intended message role undecided, so first determine the project’s expected behavior with maintainers; done means Java and Python setups send the same role and a cross-language test covers it.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Search before asking
  • I searched in the 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?
  • I'm willing to submit a PR!
Lingua principale
Java
Stelle
497
Fork
193
Merge medio
2g 21h
PR unite (30g)
68

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/flink-agents

Tutte le issue di apache/flink-agents

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.