langchain/libs/community/langchain_community/chat_models
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
..
__init__.py community[patch]: speed up import times in the community package (#18928) 2024-03-11 16:37:36 -04:00
anthropic.py community[patch]: move pdf text tests to integration (#18746) 2024-03-07 10:34:22 -08:00
anyscale.py community[minor]: Add async_client for Anyscale Chat model (#18050) 2024-02-23 21:22:54 -05:00
azure_openai.py
azureml_endpoint.py
baichuan.py community[patch]: callback before yield for _stream/_astream (#17907) 2024-02-22 16:15:21 -08:00
baidu_qianfan_endpoint.py community[patch]: re-arrange the addtional_kwargs of returned qianfan structure to avoid _merge_dict issue (#18889) 2024-03-12 05:43:56 +00:00
bedrock.py community[patch]: Bedrock add support for mistral models (#18756) 2024-03-09 01:20:38 +00:00
cohere.py community: Add support for cohere SDK v5 (keeps v4 backwards compatibility) (#19084) 2024-03-14 15:53:24 -07:00
databricks.py docs: fix databricks document url (#19096) 2024-03-15 22:25:11 +00:00
deepinfra.py community[patch]: callback before yield for _stream/_astream (#17907) 2024-02-22 16:15:21 -08:00
edenai.py community[patch]: callback before yield for _stream/_astream (#17907) 2024-02-22 16:15:21 -08:00
ernie.py
everlyai.py
fake.py
fireworks.py community[patch]: deprecate community fireworks (#18544) 2024-03-05 01:04:26 +00:00
friendli.py community[minor]: Integration for Friendli LLM and ChatFriendli ChatModel. (#17913) 2024-03-08 02:20:47 +00:00
gigachat.py community[patch]: callback before yield for _stream/_astream (#17907) 2024-02-22 16:15:21 -08:00
google_palm.py
gpt_router.py community[patch]: callback before yield for _stream/_astream (#17907) 2024-02-22 16:15:21 -08:00
huggingface.py community[patch]: chat hf typing fix (#18693) 2024-03-07 17:06:38 -08:00
human.py
hunyuan.py community[patch]: callback before yield for _stream/_astream (#17907) 2024-02-22 16:15:21 -08:00
javelin_ai_gateway.py
jinachat.py community[patch]: callback before yield for _stream/_astream (#17907) 2024-02-22 16:15:21 -08:00
kinetica.py community[patch]: type ignore fixes (#18395) 2024-03-01 11:21:02 -08:00
konko.py community: fix openai streaming throws 'AIMessageChunk' object has no attribute 'text' (#18006) 2024-02-23 12:12:47 -05:00
litellm_router.py community[patch]: callback before yield for _stream/_astream (#17907) 2024-02-22 16:15:21 -08:00
litellm.py community[patch]: callback before yield for _stream/_astream (#17907) 2024-02-22 16:15:21 -08:00
llama_edge.py community: fix openai streaming throws 'AIMessageChunk' object has no attribute 'text' (#18006) 2024-02-23 12:12:47 -05:00
maritalk.py community[minor]: add maritalk chat (#17675) 2024-03-01 12:18:23 -08:00
meta.py
minimax.py
mlflow_ai_gateway.py community[patch]: chat model mypy fixes (#17061) 2024-02-05 13:42:59 -08:00
mlflow.py docs: fix databricks document url (#19096) 2024-03-15 22:25:11 +00:00
ollama.py ollama[patch]: delete suffix slash to avoid redirect (#18260) 2024-02-28 16:44:48 -05:00
openai.py community: fix openai streaming throws 'AIMessageChunk' object has no attribute 'text' (#18006) 2024-02-23 12:12:47 -05:00
pai_eas_endpoint.py
perplexity.py community[patch]: Invoke callback prior to yielding token (#18449) 2024-03-03 14:14:00 -08:00
promptlayer_openai.py
sparkllm.py community[patch]: Fix sparkllm authentication problem. (#18651) 2024-03-06 18:43:16 -08:00
tongyi.py community[patch]: Fixed bug in merging generation_info during chunk concatenation in Tongyi and ChatTongyi (#19014) 2024-03-15 16:27:53 -07:00
vertexai.py
volcengine_maas.py community[patch]: callback before yield for _stream/_astream (#17907) 2024-02-22 16:15:21 -08:00
yandex.py
yuan2.py community[patch]: callback before yield for _stream/_astream (#17907) 2024-02-22 16:15:21 -08:00
zhipuai.py community[patch]: callback before yield for _stream/_astream (#17907) 2024-02-22 16:15:21 -08:00