Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prompt combined multi-output from different agents with wrong content #4262

Open
ChunJen opened this issue Oct 24, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@ChunJen
Copy link

ChunJen commented Oct 24, 2024

Bug Description

Prompt component should combine the results from previous output correctly, but all been replaced by one of the outputs.

Who can help?

Backend or Full Stack Engineers

Operating System

Windows 11

Langflow Version

1.0.17

Python Version

3.12.4

Screenshot

Prompt:
collect outputs from previous flow
image

Bug output (check the prompt output):
image
All {variable} become the same content.

But check each output from previous, they all correctly return the message(different message):
(samples from output)
image

image
image

Reproduction:[the prompt]

客戶歷史對話:  
{history}

客戶提問:  
{query}

### Skills
- 提供投資產品資訊: 如果產品分類屬於小Agent_智主投、小Agent_智動GO、小Agent_嵐山豬豬,依據客戶提問摘選來自多個小Agent的回應內容,提供準確的產品訊息。  
- 提供市場觀點: 如果產品分類屬於小Agent_市場聚焦、 小Agent_市場評論,再依據客戶提問當中關注的議題,摘整出相關的市場分析,如果產品分類不屬於這兩類,就不要提供市場分析。  
- 提供特定的基金資訊:  如果產品分類屬於小Agent_多檔基金,且客戶提問想了解具體基金的資訊,則直接引用小Agent_多檔基金的回答,回答具體的基金資訊
- 比較多檔的基金內容: 如果產品分類屬於小Agent_多檔基金,且客戶提問想比較己檔基金的資訊,涵蓋基金績效、前五大持股、市場類型等,請直接引用小Agent_多檔基金的回答,並逐點比較幾檔基金的異同

## Prompt Variables
- 產品分類:{小Agent問題分類}(指示哪些小Agent的回應是此次提問最重要的)
- 小Agent建議回應(每個小Agent約300字的回應內容,每一個Agent都負責了提取一部分重要的產品資訊或市場報告與觀點):
    - **市場聚焦資料**: {小Agent_市場聚焦}
    - **市場評論資料**: {小Agent_市場評論}
    - **智主投**: {小Agent_智主投},
    - **智動GO**: {小Agent_智動GO},
    - **嵐山豬豬**: {小Agent_嵐山豬豬}
    - **多檔基金**: {小Agent_多檔基金}  

## Response Process
1. **使用分類的小Agent回應**  
    - 根據產品小agent分類,只留下符合客戶提問中最相關的產品資料,並且不要更改任何產品資料,也不要將不同產品的資訊相混,如果有不只一個類別的產品資訊,則將不同類別的產品資訊分別留下,這些產品資訊會包含客戶提問中,需要的具體的產品資訊。

2. **找出有吸引力的投顧報告觀點或資訊**
    - 根據**小Agent_市場聚焦**和**小Agent_市場評論**給的資訊,找出最具吸引力且相關的市場觀點或資訊,呈現給客戶。

3. **最終輸出**
   - **小Agent回應**: 引用小Agent問題分類中最相關的回應作為具體回答。
   - **有吸引力的投顧報告觀點或資訊**: 基於**小Agent_市場聚焦**和**小Agent_市場評論**,生成有吸引力的文字描述

######
注意事項: 
- 從小agent提供的資訊回答客戶提問,如果無法回應則說明你無法回答
- 一定要使用繁體中文回答
- 字數限制300字,保持回答簡潔易懂
@ChunJen ChunJen added the bug Something isn't working label Oct 24, 2024
Copy link

dosubot bot commented Oct 24, 2024

@ChunJen Hello there! I'm here to help you with your software issue. I can assist with bug fixes, answer questions, and even guide you on how to become a contributor. Let me know how I can assist you!

The issue you're experiencing with the Langflow 'Prompt' component, where all variables are being replaced by the same output, might be related to how dynamic variables are processed and replaced. In Langflow, the 'Prompt' component uses the process_prompt_template function and update_template_values utility to ensure that dynamic variables are correctly replaced with the intended values from previous outputs [1].

To address this issue, you might want to check the following:

  1. Template Configuration: Ensure that the template is correctly configured to handle multiple outputs. Verify that each variable in the template is correctly mapped to the corresponding output from the previous components.

  2. Variable Replacement Logic: Review the logic used for replacing dynamic variables. Make sure that the process_prompt_template function is correctly processing each variable and that update_template_values is updating the template with the correct values.

  3. Component Connections: Double-check the connections between components in your flow to ensure that the outputs are being routed correctly to the 'Prompt' component.

If these steps do not resolve the issue, it might be helpful to look into the specific implementation of the process_prompt_template and update_template_values functions to ensure they are functioning as expected in your setup.

To continue talking to Dosu, mention @dosu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant