DuckDuckGoSearchException                 Traceback (most recent call last)
Cell In[13], line 2
      1 # What is the price of a MacBook Pro?
----> 2 agent_executor.invoke(
      3     {
      4         "input": "What is the current price of a MacBook Pro in USD? How much would it cost in EUR if the exchange rate is 0.85 EUR for 1 USD."
      5     }
      6 )

File ~\OneDrive - TCS COM PROD\Documents\python_env\legal_work_env\Lib\site-packages\langchain\chains\base.py:170, in Chain.invoke(self, input, config, **kwargs)
    168 except BaseException as e:
    169     run_manager.on_chain_error(e)
--> 170     raise e
    171 run_manager.on_chain_end(outputs)
    173 if include_run_info:

File ~\OneDrive - TCS COM PROD\Documents\python_env\legal_work_env\Lib\site-packages\langchain\chains\base.py:160, in Chain.invoke(self, input, config, **kwargs)
    157 try:
    158     self._validate_inputs(inputs)
    159     outputs = (
--> 160         self._call(inputs, run_manager=run_manager)
    161         if new_arg_supported
    162         else self._call(inputs)
    163     )
    165     final_outputs: Dict[str, Any] = self.prep_outputs(
    166         inputs, outputs, return_only_outputs
    167     )
    168 except BaseException as e:

File ~\OneDrive - TCS COM PROD\Documents\python_env\legal_work_env\Lib\site-packages\langchain\agents\agent.py:1624, in AgentExecutor._call(self, inputs, run_manager)
   1622 # We now enter the agent loop (until it returns something).
   1623 while self._should_continue(iterations, time_elapsed):
-> 1624     next_step_output = self._take_next_step(
   1625         name_to_tool_map,
   1626         color_mapping,
   1627         inputs,
   1628         intermediate_steps,
   1629         run_manager=run_manager,
   1630     )
   1631     if isinstance(next_step_output, AgentFinish):
   1632         return self._return(
   1633             next_step_output, intermediate_steps, run_manager=run_manager
   1634         )

File ~\OneDrive - TCS COM PROD\Documents\python_env\legal_work_env\Lib\site-packages\langchain\agents\agent.py:1330, in AgentExecutor._take_next_step(self, name_to_tool_map, color_mapping, inputs, intermediate_steps, run_manager)
   1321 def _take_next_step(
   1322     self,
   1323     name_to_tool_map: Dict[str, BaseTool],
   (...)
   1327     run_manager: Optional[CallbackManagerForChainRun] = None,
   1328 ) -> Union[AgentFinish, List[Tuple[AgentAction, str]]]:
   1329     return self._consume_next_step(
-> 1330         [
   1331             a
   1332             for a in self._iter_next_step(
   1333                 name_to_tool_map,
   1334                 color_mapping,
   1335                 inputs,
   1336                 intermediate_steps,
   1337                 run_manager,
   1338             )
   1339         ]
   1340     )

File ~\OneDrive - TCS COM PROD\Documents\python_env\legal_work_env\Lib\site-packages\langchain\agents\agent.py:1415, in AgentExecutor._iter_next_step(self, name_to_tool_map, color_mapping, inputs, intermediate_steps, run_manager)
   1413     yield agent_action
   1414 for agent_action in actions:
-> 1415     yield self._perform_agent_action(
   1416         name_to_tool_map, color_mapping, agent_action, run_manager
   1417     )

File ~\OneDrive - TCS COM PROD\Documents\python_env\legal_work_env\Lib\site-packages\langchain\agents\agent.py:1437, in AgentExecutor._perform_agent_action(self, name_to_tool_map, color_mapping, agent_action, run_manager)
   1435         tool_run_kwargs["llm_prefix"] = ""
   1436     # We then call the tool on the tool input to get an observation
-> 1437     observation = tool.run(
   1438         agent_action.tool_input,
   1439         verbose=self.verbose,
   1440         color=color,
   1441         callbacks=run_manager.get_child() if run_manager else None,
   1442         **tool_run_kwargs,
   1443     )
   1444 else:
   1445     tool_run_kwargs = self._action_agent.tool_run_logging_kwargs()

File ~\OneDrive - TCS COM PROD\Documents\python_env\legal_work_env\Lib\site-packages\langchain_core\tools\base.py:763, in BaseTool.run(self, tool_input, verbose, start_color, color, callbacks, tags, metadata, run_name, run_id, config, tool_call_id, **kwargs)
    761 if error_to_raise:
    762     run_manager.on_tool_error(error_to_raise)
--> 763     raise error_to_raise
    764 output = _format_output(content, artifact, tool_call_id, self.name, status)
    765 run_manager.on_tool_end(output, color=color, name=self.name, **kwargs)

File ~\OneDrive - TCS COM PROD\Documents\python_env\legal_work_env\Lib\site-packages\langchain_core\tools\base.py:732, in BaseTool.run(self, tool_input, verbose, start_color, color, callbacks, tags, metadata, run_name, run_id, config, tool_call_id, **kwargs)
    730 if config_param := _get_runnable_config_param(self._run):
    731     tool_kwargs = tool_kwargs | {config_param: config}
--> 732 response = context.run(self._run, *tool_args, **tool_kwargs)
    733 if self.response_format == "content_and_artifact":
    734     if not isinstance(response, tuple) or len(response) != 2:

File ~\OneDrive - TCS COM PROD\Documents\python_env\legal_work_env\Lib\site-packages\langchain_core\tools\simple.py:100, in Tool._run(self, config, run_manager, *args, **kwargs)
     98     if config_param := _get_runnable_config_param(self.func):
     99         kwargs[config_param] = config
--> 100     return self.func(*args, **kwargs)
    101 msg = "Tool does not support sync invocation."
    102 raise NotImplementedError(msg)

File ~\OneDrive - TCS COM PROD\Documents\python_env\legal_work_env\Lib\site-packages\langchain_core\tools\base.py:763, in BaseTool.run(self, tool_input, verbose, start_color, color, callbacks, tags, metadata, run_name, run_id, config, tool_call_id, **kwargs)
    761 if error_to_raise:
    762     run_manager.on_tool_error(error_to_raise)
--> 763     raise error_to_raise
    764 output = _format_output(content, artifact, tool_call_id, self.name, status)
    765 run_manager.on_tool_end(output, color=color, name=self.name, **kwargs)

File ~\OneDrive - TCS COM PROD\Documents\python_env\legal_work_env\Lib\site-packages\langchain_core\tools\base.py:732, in BaseTool.run(self, tool_input, verbose, start_color, color, callbacks, tags, metadata, run_name, run_id, config, tool_call_id, **kwargs)
    730 if config_param := _get_runnable_config_param(self._run):
    731     tool_kwargs = tool_kwargs | {config_param: config}
--> 732 response = context.run(self._run, *tool_args, **tool_kwargs)
    733 if self.response_format == "content_and_artifact":
    734     if not isinstance(response, tuple) or len(response) != 2:

File ~\OneDrive - TCS COM PROD\Documents\python_env\legal_work_env\Lib\site-packages\langchain_community\tools\ddg_search\tool.py:112, in DuckDuckGoSearchResults._run(self, query, run_manager)
    106 def _run(
    107     self,
    108     query: str,
    109     run_manager: Optional[CallbackManagerForToolRun] = None,
    110 ) -> tuple[Union[List[dict], str], List[dict]]:
    111     """Use the tool."""
--> 112     raw_results = self.api_wrapper.results(
    113         query, self.max_results, source=self.backend
    114     )
    115     results = [
    116         {
    117             k: v
   (...)
    121         for d in raw_results
    122     ]
    124     if self.output_format == "list":

File ~\OneDrive - TCS COM PROD\Documents\python_env\legal_work_env\Lib\site-packages\langchain_community\utilities\duckduckgo_search.py:146, in DuckDuckGoSearchAPIWrapper.results(self, query, max_results, source)
    142 source = source or self.source
    143 if source == "text":
    144     results = [
    145         {"snippet": r["body"], "title": r["title"], "link": r["href"]}
--> 146         for r in self._ddgs_text(query, max_results=max_results)
    147     ]
    148 elif source == "news":
    149     results = [
    150         {
    151             "snippet": r["body"],
   (...)
    157         for r in self._ddgs_news(query, max_results=max_results)
    158     ]

File ~\OneDrive - TCS COM PROD\Documents\python_env\legal_work_env\Lib\site-packages\langchain_community\utilities\duckduckgo_search.py:64, in DuckDuckGoSearchAPIWrapper._ddgs_text(self, query, max_results)
     61 from duckduckgo_search import DDGS
     63 with DDGS() as ddgs:
---> 64     ddgs_gen = ddgs.text(
     65         query,
     66         region=self.region,  # type: ignore[arg-type]
     67         safesearch=self.safesearch,
     68         timelimit=self.time,
     69         max_results=max_results or self.max_results,
     70         backend=self.backend,
     71     )
     72     if ddgs_gen:
     73         return [r for r in ddgs_gen]

File ~\OneDrive - TCS COM PROD\Documents\python_env\legal_work_env\Lib\site-packages\duckduckgo_search\duckduckgo_search.py:184, in DDGS.text(self, keywords, region, safesearch, timelimit, backend, max_results)
    181         logger.info(f"Error to search using {b} backend: {ex}")
    182         err = ex
--> 184 raise DuckDuckGoSearchException(err)

DuckDuckGoSearchException: https://lite.duckduckgo.com/lite/ RuntimeError: error sending request for url (https://lite.duckduckgo.com/lite/): client error (Connect)

Caused by:
    0: client error (Connect)
    1: TLS handshake failed: cert verification failed - unable to get local issuer certificate [CERTIFICATE_VERIFY_FAILED]
    2: [CERTIFICATE_VERIFY_FAILED]
    3: [CERTIFICATE_VERIFY_FAILED]