Skip to content

The agent engineering platform.

docs: add example to create_message function docstring (#34851)

aahanabobade7b4ced2d3b48
diff --git a/libs/core/langchain_core/exceptions.py b/libs/core/langchain_core/exceptions.py
index a1e8a5cb91..073cfa9902 100644
--- a/libs/core/langchain_core/exceptions.py
+++ b/libs/core/langchain_core/exceptions.py
@@ -52,6 +52,7 @@ class OutputParserException(ValueError, LangChainException): # noqa: N818
error = create_message(
message=error, error_code=ErrorCode.OUTPUT_PARSING_FAILURE
)
+
super().__init__(error)
if send_to_llm and (observation is None or llm_output is None):
msg = (
@@ -85,6 +86,15 @@ def create_message(*, message: str, error_code: ErrorCode) -> str:
Returns:
The full message with the troubleshooting link.
+
+ Example:
+ ```python
+ create_message(
+ message="Failed to parse output",
+ error_code=ErrorCode.OUTPUT_PARSING_FAILURE,
+ )
+ "Failed to parse output. For troubleshooting, visit: ..."
+ ```
"""
return (
f"{message}\n"