-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathice_breaker.py
More file actions
49 lines (37 loc) · 1.74 KB
/
ice_breaker.py
File metadata and controls
49 lines (37 loc) · 1.74 KB
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
from langchain import PromptTemplate
from langchain.chains import LLMChain
from langchain.chat_models import ChatOpenAI
from agents.linkedin_lookup_agent import lookup as linkedin_lookup_agent
from third_parties.linkedIn import scrape_linkedin_profile
from output_parser import person_intel_parser, personIntel
from dotenv import load_dotenv
import os
load_dotenv()
os.environ["OPENAI_API_KEY"]=os.getenv("OPENAI_API_KEY")
os.environ["PROXYCURL_API_KEY"]=os.getenv("PROXYCURL_API_KEY")
os.environ["SERPAPI_API_KEY"]=os.getenv("SERPAPI_API_KEY")
def ice_breaker(name: str) -> tuple[personIntel, str]:
linkedin_profile_url = linkedin_lookup_agent(name=name)
summary_template = """
given the LinkedIn information {information} about a person from I want you to create:
1. a short summary
2. two interesting facts about them
3. a topic that may interest them
4. 2 creative Ice breakers to open a conversation with them
\n{format_instructions}
"""
summary_prompt_template = PromptTemplate(
input_variables=["information"],
template=summary_template,
partial_variables={
"format_instructions": person_intel_parser.get_format_instructions()
},
)
llm = ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo")
chain = LLMChain(llm=llm, prompt=summary_prompt_template)
linkedin_data = scrape_linkedin_profile(linkedin_profile_url=linkedin_profile_url)
result = chain.run(information=linkedin_data)
return person_intel_parser.parse(result), linkedin_data.get("profile_pic_url")
if __name__ == "__main__":
print("Hello, LangChain!")
result = ice_breaker(name="Eden Marco")