mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-27 21:45:08 +00:00
Update openai.py compatibility with azure 2023-07-01-preview (#7937)
Fixed missing "content" field in azure. Added a check for "content" in _dict (missing for azure api=2023-07-01-preview) @baskaryan --------- Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
parent
b65102bdb2
commit
6792a3557d
@ -100,7 +100,9 @@ def _convert_dict_to_message(_dict: Mapping[str, Any]) -> BaseMessage:
|
||||
if role == "user":
|
||||
return HumanMessage(content=_dict["content"])
|
||||
elif role == "assistant":
|
||||
content = _dict["content"] or "" # OpenAI returns None for tool invocations
|
||||
# Fix for azure
|
||||
# Also OpenAI returns None for tool invocations
|
||||
content = _dict.get("content", "")
|
||||
if _dict.get("function_call"):
|
||||
additional_kwargs = {"function_call": dict(_dict["function_call"])}
|
||||
else:
|
||||
|
@ -445,7 +445,7 @@ class VectorStoreRetriever(BaseRetriever):
|
||||
search_kwargs: dict = Field(default_factory=dict)
|
||||
allowed_search_types: ClassVar[Collection[str]] = (
|
||||
"similarity",
|
||||
"similarity_score_threshold",
|
||||
"similarityatscore_threshold",
|
||||
"mmr",
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user