mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-13 14:50:00 +00:00
mistral[patch]: check types in adding model_name to response_metadata (#30499)
This commit is contained in:
parent
22d1a7d7b6
commit
299b222c53
@ -274,7 +274,9 @@ def _convert_chunk_to_message_chunk(
|
||||
}
|
||||
else:
|
||||
usage_metadata = None
|
||||
if _choice.get("finish_reason") is not None:
|
||||
if _choice.get("finish_reason") is not None and isinstance(
|
||||
chunk.get("model"), str
|
||||
):
|
||||
response_metadata["model_name"] = chunk.get("model")
|
||||
return AIMessageChunk(
|
||||
content=content,
|
||||
|
Loading…
Reference in New Issue
Block a user