forked from emarco177/ice_breaker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ice_breaker.py
54 lines (44 loc) · 1.63 KB
/
ice_breaker.py
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
47
48
49
50
51
52
53
54
from typing import Tuple
from agents.linkedin_lookup_agent import lookup as linkedin_lookup_agent
from agents.twitter_lookup_agent import lookup as twitter_lookup_agent
from chains.custom_chains import (
get_summary_chain,
get_interests_chain,
get_ice_breaker_chain,
)
from third_parties.linkedin import scrape_linkedin_profile
from third_parties.twitter import scrape_user_tweets
from output_parsers import (
summary_parser,
topics_of_interest_parser,
ice_breaker_parser,
Summary,
IceBreaker,
TopicOfInterest,
)
def ice_break_with(name: str) -> Tuple[Summary, IceBreaker, TopicOfInterest, str]:
linkedin_username = linkedin_lookup_agent(name=name)
linkedin_data = scrape_linkedin_profile(linkedin_profile_url=linkedin_username)
twitter_username = twitter_lookup_agent(name=name)
tweets = scrape_user_tweets(username=twitter_username)
summary_chain = get_summary_chain()
summary_and_facts = summary_chain.run(
information=linkedin_data, twitter_posts=tweets
)
summary_and_facts = summary_parser.parse(summary_and_facts)
interests_chain = get_interests_chain()
interests = interests_chain.run(information=linkedin_data, twitter_posts=tweets)
interests = topics_of_interest_parser.parse(interests)
ice_breaker_chain = get_ice_breaker_chain()
ice_breakers = ice_breaker_chain.run(
information=linkedin_data, twitter_posts=tweets
)
ice_breakers = ice_breaker_parser.parse(ice_breakers)
return (
summary_and_facts,
interests,
ice_breakers,
linkedin_data.get("profile_pic_url"),
)
if __name__ == "__main__":
pass