mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-02 11:39:18 +00:00
Fix Azure Openai function calling in streaming mode (#13768)
- **Description**: This PR addresses an issue with the OpenAI API streaming response, where initially the key (arguments) is provided but the value is None. Subsequently, it updates with {"arguments": "{\n"}, leading to a type inconsistency that causes an exception. The specific error encountered is ValueError: additional_kwargs["arguments"] already exists in this message, but with a different type. This change aims to resolve this inconsistency and ensure smooth API interactions. - **Issue**: None. - **Dependencies**: None. - **Tag maintainer**: @eyurtsev This is an updated version of #13229 based on the refactored code. Credit goes to @superken01. Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
This commit is contained in:
@@ -42,6 +42,9 @@ def test_message_chunks() -> None:
|
||||
AIMessageChunk(
|
||||
content="", additional_kwargs={"function_call": {"name": "web_search"}}
|
||||
)
|
||||
+ AIMessageChunk(
|
||||
content="", additional_kwargs={"function_call": {"arguments": None}}
|
||||
)
|
||||
+ AIMessageChunk(
|
||||
content="", additional_kwargs={"function_call": {"arguments": "{\n"}}
|
||||
)
|
||||
|
Reference in New Issue
Block a user