File size: 1,939 Bytes
feed544
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# 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("==============================================================")