langchain/libs
Shuai Liu c244e1a50b
community[patch]: Fixed bug in merging generation_info during chunk concatenation in Tongyi and ChatTongyi (#19014)
- **Description:** 

In #16218 , during the `GenerationChunk` and `ChatGenerationChunk`
concatenation, the `generation_info` merging changed from simple keys &
values replacement to using the util method
[`merge_dicts`](https://github.com/langchain-ai/langchain/blob/master/libs/core/langchain_core/utils/_merge.py):


![image](https://github.com/langchain-ai/langchain/assets/2098020/10f315bf-7fe0-43a7-a0ce-6a3834b99a15)

The `merge_dicts` method could not handle merging values of `int` or
some other types, and would raise a
[`TypeError`](https://github.com/langchain-ai/langchain/blob/master/libs/core/langchain_core/utils/_merge.py#L55).

This PR fixes this issue in the **Tongyi and ChatTongyi Model** by
adopting the `generation_info` of the last chunk
and discarding the `generation_info` of the intermediate chunks,
ensuring that `stream` and `astream` function correctly.

- **Issue:**  
    - Related issues or PRs about Tongyi & ChatTongyi: #16605, #17105 
    - Other models or cases: #18441, #17376
- **Dependencies:** No new dependencies
2024-03-15 16:27:53 -07:00
..
cli templates, cli: more security deps (#19006) 2024-03-12 20:48:56 -07:00
community community[patch]: Fixed bug in merging generation_info during chunk concatenation in Tongyi and ChatTongyi (#19014) 2024-03-15 16:27:53 -07:00
core docs: Add in code documentation to core Runnable with_fallbacks method (docs only) (#19104) 2024-03-15 15:21:10 -07:00
experimental community, langchain, infra: revert store extended test deps outside of poetry (#19153) 2024-03-15 17:10:47 +00:00
langchain langchain[patch]: make hub work with older langchainhub versions (#19076) 2024-03-15 15:37:52 -07:00
partners voyageai[patch]: init package (#19098) 2024-03-15 00:56:10 +00:00
text-splitters community, langchain, infra: revert store extended test deps outside of poetry (#19153) 2024-03-15 17:10:47 +00:00