mirror of
https://github.com/hwchase17/langchain
synced 2024-11-06 03:20:49 +00:00
Improve math chain error msg (#4415)
This commit is contained in:
parent
f6c97e6af4
commit
65f85af242
@ -84,7 +84,10 @@ class LLMMathChain(Chain):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise ValueError(f"{e}. Please try again with a valid numerical expression")
|
raise ValueError(
|
||||||
|
f'LLMMathChain._evaluate("{expression}") raised error: {e}.'
|
||||||
|
" Please try again with a valid numerical expression"
|
||||||
|
)
|
||||||
|
|
||||||
# Remove any leading and trailing brackets from the output
|
# Remove any leading and trailing brackets from the output
|
||||||
return re.sub(r"^\[|\]$", "", output)
|
return re.sub(r"^\[|\]$", "", output)
|
||||||
|
Loading…
Reference in New Issue
Block a user