mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-20 13:54:48 +00:00
fmt
This commit is contained in:
parent
1160090ce3
commit
85a1215217
@ -321,10 +321,11 @@ def _convert_to_message(message: MessageLikeRepresentation) -> BaseMessage:
|
|||||||
"tool_calls" in msg_kwargs or "content" in msg_kwargs
|
"tool_calls" in msg_kwargs or "content" in msg_kwargs
|
||||||
)
|
)
|
||||||
if not content_or_tool_calls:
|
if not content_or_tool_calls:
|
||||||
raise KeyError("Must have one of content or tool calls")
|
msg = "Must have one of content or tool calls"
|
||||||
|
raise KeyError(msg)
|
||||||
msg_content = msg_kwargs.pop("content", "") or ""
|
msg_content = msg_kwargs.pop("content", "") or ""
|
||||||
except KeyError as e:
|
except KeyError as e:
|
||||||
msg = f"Message dict must contain 'role' and one of 'content' or 'tool_calls' keys, got {message}"
|
msg = f"Message dict must contain 'role' and one of 'content' or 'tool_calls' keys, got {message}" # noqa: E501
|
||||||
msg = create_message(
|
msg = create_message(
|
||||||
message=msg, error_code=ErrorCode.MESSAGE_COERCION_FAILURE
|
message=msg, error_code=ErrorCode.MESSAGE_COERCION_FAILURE
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user