Suppress "Placeholders have not been resolved" warning when MessagesPlaceholder use is intentional (LangChain integration)
Maintainer thường phản hồi trong vòng 1 ngày
@hassiebp đang làm issue này rồi.
Từ ngày 22/5/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Summary
ChatPromptClient.compile() (and get_langchain_prompt() which calls it
under the hood) unconditionally logs:
Placeholders ['...'] have not been resolved. Pass them as keyword arguments to compile().
even when leaving placeholders unresolved is intentional — i.e. the
caller follows the officially documented LangChain integration pattern
where unresolved placeholders are deliberately returned as
MessagesPlaceholder for LangChain's ChatPromptTemplate to resolve at
.invoke() time.
Result: production logs are flooded with one WARNING per request, masking
real signals.
Reproduction (langfuse 4.6.1, official docs example)
from langfuse import get_client
from langchain_core.prompts import ChatPromptTemplate
langfuse = get_client()
# Create a chat prompt with a placeholder (per docs example)
langfuse.create_prompt(
name="movie-critic-chat",
type="chat",
prompt=[
{"role": "system", "content": "You are an expert movie critic"},
{"type": "placeholder", "name": "chat_history"},
{"role": "user", "content": "What should I watch next?"},
],
labels=["production"],
)
# Documented LangChain integration:
# https://langfuse.com/docs/prompt-management/features/message-placeholders
prompt = langfuse.get_prompt("movie-critic-chat")
langchain_prompt = ChatPromptTemplate.from_template(prompt.get_langchain_prompt())
# → logs WARNING: Placeholders ['chat_history'] have not been resolved.
# even though leaving it unresolved is EXACTLY what the docs tell you
# to do for LangChain integration.
Why this is a problem
- The docs at
/docs/prompt-management/features/message-placeholders
(LangChain Python tab) endorse this exact pattern —MessagesPlaceholder
objects in the output are the documented goal. - SDK can't distinguish "intentional unresolved (LangChain hand-off)" from
"misuse (forgot kwargs)" and warns in both cases. - No public API to silence: no
silent=/suppress_warnings=kwarg on
compile()orget_langchain_prompt(). logging.getLogger("langfuse").setLevel(...)is not a reliable
workaround — see langfuse/langfuse#4976 reporting setLevel doesn't
affect certain SDK-emitted warnings.- Forces every LangChain integrator to install a
logging.Filterthat
string-matches the warning message — brittle (breaks on copy edits)
and easy to over-silence.
Suggested fix
Add a silent=True (or suppress_unresolved_warning=True) kwarg to:
ChatPromptClient.compile(**kwargs, silent: bool = False)ChatPromptClient.get_langchain_prompt(**kwargs, silent: bool = False)
When silent=True, the
"Placeholders ['...'] have not been resolved" warning is skipped, but
other validation warnings (e.g. "Placeholder X must contain a list of
chat messages") still fire — those are genuine misuse signals.
Alternatively, get_langchain_prompt() could pass silent=True to its
internal compile() call by default, since by definition any unresolved
placeholder returned from this method is intended for LangChain.
Version info
- langfuse-python: 4.6.1 (also reproduces on 4.5.1 + main
HEAD) - langchain-core: 1.3.2
- Python: 3.11
Current workaround we use
contextlib.contextmanager that scopes a logging.Filter matching the
substring "have not been resolved" over the
chat_skeleton.get_langchain_prompt() call site. Fragile (depends on
warning string), but scoped narrowly so other langfuse warnings still
propagate.
Happy to send a PR if the maintainers agree with the kwarg shape.
- Ngôn ngữ chính
- Python
- Star
- 468
- Fork
- 349
- Merge trung bình
- 16 giờ 35 phút
- Pull request đã merge (30 ngày)
- 19
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của langfuse/langfuse-python
-
bug: get_dataset_run / get_dataset_runs / delete_dataset_run are unusable on Langfuse v4Có thể đã có người làm @hassiebp đã nhận 1 ngày trước. Đang mởbug feat-datasets feat-experiments sdk-python
langfuse/langfuse-python#1906 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
mask is not applied to create_dataset_item or create_score(comment=)Có thể đã có người làm @hassiebp đã nhận 5 ngày trước. Đang mởbug compliance feat-data-masking sdk-python security
langfuse/langfuse-python#1896 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Scores bypass sample_rate since v4Có thể đã có người làm @hassiebp đã nhận 10 ngày trước. Đang mởfeat-scores sdk-python unconfirmed-bug
langfuse/langfuse-python#1890 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
batch_evaluation fails on self-hosted v4 events_only deployments (uses unavailable v3 read endpoints)Có thể đã có người làm @hassiebp đã nhận 23 ngày trước. Đang mởbug feat-evals sdk-python
langfuse/langfuse-python#1861 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[HTTPXodus] Consider migrating from httpx to httpx2 (the actively maintained fork)Có thể đã có người làm @hassiebp đã nhận 24 ngày trước. Đang mởimprovement sdk-python
langfuse/langfuse-python#1856 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của langfuse/langfuse-python
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
qgis/QGIS-Plugins-Website#459 ·
-
bug severity:medium
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
bot-found bug priority: P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
madenvel/KalinkaPlayer#179 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ls1intum/edutelligence#1098 ·
Maintainer thường phản hồi trong vòng 1 ngày