# JB 13-06-2024 # C:\Users\jfhmb\EXA_CREWAI\exa-crewai-master\exa-crewai-master\src\newsletter_gen\tools\JB_test_research_tools.py from research import SearchAndContents from research import FindSimilar from research import GetContents search_and_contents = SearchAndContents() find_similar = FindSimilar() get_contents = GetContents() # dir(search_and_contents) # Search and Contents Tool # Searches the web based on a search query for the latest results. # Results are only from the last week. # Uses the Exa API. # This also returns the contents of the search results. print(search_and_contents.run(search_query="Grokking")) print("==============================================================") # EXAMPLE RESULT (ONLY 1 SHOW HERE): # URL: https://research.google/blog/transformer-a-novel-neural-network-architecture-for-language-understanding/ # ID: https://research.google/blog/transformer-a-novel-neural-network-architecture-for-language-understanding/ # Score: 0.11678461730480194 # Published Date: 2024-06-06 # Etc. # Find Similar Tool # Searches for similar articles to a given article using the Exa API. Takes in a URL of the article url = "https://research.google/blog/transformer-a-novel-neural-network-architecture-for-language-understanding/" print(find_similar.run(article_url=url)) print("==============================================================") # Get Contents Tool # Gets the contents of a specific article using the Exa API. # Takes in the ID of the article in a list, # like this: ['https://www.cnbc.com/2024/04/18/my-news-story']. # article_ids article_ids = ["https://www.iotworldtoday.com/industry/openai-chief-architect-predicts-huge-large-language-model-leaps", "https://ieeexplore.ieee.org/document/6547645/"] print(get_contents.run(article_ids=article_ids)) print("==============================================================")