infiniflow / infiniflow/ragflow

[Go] Baidu/ERNIE: system prompt kept inside messages instead of top-level system field

Open
#17,331 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Go
Stars
91k
Forks
10.8k
Avg merge
1d 14h
Merged PRs (30d)
705

Description

## Description
In the Go Baidu/ERNIE driver (`internal/entity/models/baidu.go`), the system prompt is kept inside the `messages` array as `role:"system"` for both `ChatWithMessages` (L70) and `ChatStreamlyWithSender` (L254).

This diverges from the Python `BaiduYiyanChat` driver, which extracts the system message into a separate top-level `system=` parameter (`rag/llm/chat_model.py:1203`).

## Impact
Older ERNIE / Qianfan API versions reject a `system` role inside `messages` and require the separate `system` field. On those versions the Go driver may error out or silently mis-handle the system prompt.

## Expected behavior
Extract the system message(s) into a top-level `system` field (align with Python), or explicitly document/confirm that the targeted ERNIE version accepts an in-message `system` role.

## References
- `internal/entity/models/baidu.go:70`, `:254`
- Python (reference): `rag/llm/chat_model.py:1203`

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with internal/entity/models/baidu.go at ChatWithMessages (L70) and ChatStreamlyWithSender (L254), then compare the system-message handling with rag/llm/chat_model.py:1203. Verify the behavior against the targeted ERNIE API expectations; done means both Go paths handle system prompts in the supported format without breaking ordinary messages.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, python
Domain
ai, api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.