langchain/libs/community/langchain_community
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
..
adapters
agent_toolkits community: Add PolygonAggregates tool (#18882) 2024-03-11 11:58:10 -07:00
callbacks community[patch] : publishes duration as milliseconds to Fiddler (#19166) 2024-03-15 14:04:56 -07:00
chat_loaders community[patch]: speed up import times in the community package (#18928) 2024-03-11 16:37:36 -04:00
chat_message_histories community[patch]: speed up import times in the community package (#18928) 2024-03-11 16:37:36 -04:00
chat_models community[patch]: Fixed bug in merging generation_info during chunk concatenation in Tongyi and ChatTongyi (#19014) 2024-03-15 16:27:53 -07:00
docstore community[patch]: speed up import times in the community package (#18928) 2024-03-11 16:37:36 -04:00
document_compressors community[patch]: speed up import times in the community package (#18928) 2024-03-11 16:37:36 -04:00
document_loaders community[patch]: Use langchain-astradb for AstraDB doc loader (#19071) 2024-03-15 22:57:25 +00:00
document_transformers community[patch]: flattening imports 3 (#18939) 2024-03-12 15:18:54 -07:00
embeddings docs: fix databricks document url (#19096) 2024-03-15 22:25:11 +00:00
example_selectors
graphs community[patch]: flattening imports 3 (#18939) 2024-03-12 15:18:54 -07:00
indexes community: Add document manager and mongo document manager (#17320) 2024-02-23 21:32:52 -05:00
llms community[patch]: Fixed bug in merging generation_info during chunk concatenation in Tongyi and ChatTongyi (#19014) 2024-03-15 16:27:53 -07:00
output_parsers
retrievers community[patch]: Add Blended Search Support to GoogleVertexAISearchRetriever (#19082) 2024-03-15 22:39:31 +00:00
storage community[patch]: flattening imports 3 (#18939) 2024-03-12 15:18:54 -07:00
tools community[patch]: add args_schema to sql_database tools for langGraph integration (#18595) 2024-03-15 19:03:36 +00:00
utilities community[patch]: flattening imports 3 (#18939) 2024-03-12 15:18:54 -07:00
utils
vectorstores community[patch]: implement qdrant _aembed_query and use it in other async funcs (#19155) 2024-03-15 21:20:12 +00:00
__init__.py
cache.py community[minor]: Adding Azure Cosmos Mongo vCore Vector DB Cache (#16856) 2024-03-03 14:04:15 -08:00
py.typed