langchain/utilities/duckduckgo_search.py/DuckDuckGoSearchAPIWrapper/to_metadata
class DuckDuckGoSearchAPIWrapper:    def results(self, query: str, num_results: int) -> List[Dict[str, str]]:
        """Run query through DuckDuckGo and return metadata.

        Args:
            query: The query to search for.
            num_results: The number of results to return.

        Returns:
            A list of dictionaries with the following keys:
                snippet - The description of the result.
                title - The title of the result.
                link - The link to the result.
        """
        from duckduckgo_search import ddg

        results = ddg(
            query,
            region=self.region,
            safesearch=self.safesearch,
            time=self.time,
            max_results=num_results,
        )

        if results is None or len(results) == 0:
            return [{"Result": "No good DuckDuckGo Search Result was found"}]

        def to_metadata(result: Dict) -> Dict[str, str]:
            return {
                "snippet": result["body"],
                "title": result["title"],
                "link": result["href"],
            }

        return [to_metadata(result) for result in results]