mirror of
https://github.com/hwchase17/langchain.git
synced 2026-07-01 14:47:02 +00:00
docs(langchain): document summarization prompt contract (#38256)
Adds a contract note for the default summarization prompt so future
edits preserve the pieces downstream consumers depend on. The key risk
is not the prompt text itself, but the `<messages>` marker and
`{messages}` placeholder that other middleware uses to splice in
additional instructions.
This commit is contained in:
@@ -76,6 +76,17 @@ Respond ONLY with the extracted context. Do not include any additional informati
|
||||
Messages to summarize:
|
||||
{messages}
|
||||
</messages>""" # noqa: E501
|
||||
"""Default prompt used to summarize conversation history.
|
||||
|
||||
The `<messages>` marker (on its own line) and the `{messages}` placeholder are
|
||||
part of this constant's public contract, not just cosmetic formatting.
|
||||
Downstream consumers depend on them: for example, deep agents'
|
||||
`SummarizationMiddleware` splices an extra instruction block in immediately
|
||||
before the `<messages>` marker via `str.replace`. Removing, renaming, or
|
||||
reformatting the marker (or the `{messages}` placeholder) is a breaking change
|
||||
for those consumers even though it does not alter any function signature, so
|
||||
treat edits to it accordingly.
|
||||
"""
|
||||
|
||||
_DEFAULT_MESSAGES_TO_KEEP = 20
|
||||
_DEFAULT_TRIM_TOKEN_LIMIT = 4000
|
||||
|
||||
Reference in New Issue
Block a user