forked from Archives/langchain
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