You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
langchain/libs/core/langchain_core/messages
CastaChick 7d13a2f958
core[patch]: add option to specify the chunk separator in `merge_message_runs` (#24783)
**Description:**
LLM will stop generating text even in the middle of a sentence if
`finish_reason` is `length` (for OpenAI) or `stop_reason` is
`max_tokens` (for Anthropic).
To obtain longer outputs from LLM, we should call the message generation
API multiple times and merge the results into the text to circumvent the
API's output token limit.
The extra line breaks forced by the `merge_message_runs` function when
seamlessly merging messages can be annoying, so I added the option to
specify the chunk separator.

**Issue:**
No corresponding issues.

**Dependencies:**
No dependencies required.

**Twitter handle:**
@hanama_chem
https://x.com/hanama_chem

---------

Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
1 month ago
..
__init__.py core: add RemoveMessage (#23636) 3 months ago
ai.py docs: fix kwargs docstring (#25010) 2 months ago
base.py docs: fix kwargs docstring (#25010) 2 months ago
chat.py core: docstrings `messages` (#23788) 3 months ago
function.py core: docstrings `messages` (#23788) 3 months ago
human.py docs: fix kwargs docstring (#25010) 2 months ago
modifier.py docs: fix kwargs docstring (#25010) 2 months ago
system.py docs: fix kwargs docstring (#25010) 2 months ago
tool.py docs: fix kwargs docstring (#25010) 2 months ago
utils.py core[patch]: add option to specify the chunk separator in `merge_message_runs` (#24783) 1 month ago