Source code for langchain_community.tools.merriam_webster.tool
"""Tool for the Merriam-Webster API."""fromtypingimportOptionalfromlangchain_core.callbacksimportCallbackManagerForToolRunfromlangchain_core.toolsimportBaseToolfromlangchain_community.utilities.merriam_websterimportMerriamWebsterAPIWrapper
[docs]classMerriamWebsterQueryRun(BaseTool):# type: ignore[override]"""Tool that searches the Merriam-Webster API."""name:str="merriam_webster"description:str=("A wrapper around Merriam-Webster. ""Useful for when you need to get the definition of a word.""Input should be the word you want the definition of.")api_wrapper:MerriamWebsterAPIWrapperdef_run(self,query:str,run_manager:Optional[CallbackManagerForToolRun]=None,)->str:"""Use the Merriam-Webster tool."""returnself.api_wrapper.run(query)