Prudvireddy commited on
Commit
b08a5af
·
verified ·
1 Parent(s): 3e5e116

Update agents.py

Browse files
Files changed (1) hide show
  1. agents.py +105 -82
agents.py CHANGED
@@ -1,82 +1,105 @@
1
- from langchain_openai import ChatOpenAI
2
- from langchain.schema import HumanMessage, SystemMessage
3
-
4
- def web_summarizer_company(scraped_data):
5
-
6
- AI71_BASE_URL = "https://api.ai71.ai/v1/"
7
- AI71_API_KEY = 'ai71-api-f65e97e6-af86-4de9-a667-dc61c1ef8c75'
8
-
9
- llm = ChatOpenAI(
10
- model="tiiuae/falcon-180b-chat",
11
- api_key=AI71_API_KEY,
12
- base_url=AI71_BASE_URL,
13
- # streaming=True,
14
- )
15
-
16
- summary = llm.invoke(
17
- [
18
- SystemMessage(content="You are a Web Data Summarizer. you are skilled at summarizing company webpages into short summaries. "),
19
- HumanMessage(content=f"provide a neet summary of the company. Do not add up things. \n\n**Scraped Data:** \n\n{scraped_data}"),
20
- ]
21
- )
22
- return summary
23
-
24
- def web_summarizer_person(scraped_data):
25
-
26
- AI71_BASE_URL = "https://api.ai71.ai/v1/"
27
- AI71_API_KEY = 'ai71-api-f65e97e6-af86-4de9-a667-dc61c1ef8c75'
28
-
29
- llm = ChatOpenAI(
30
- model="tiiuae/falcon-180b-chat",
31
- api_key=AI71_API_KEY,
32
- base_url=AI71_BASE_URL,
33
- # streaming=True,
34
- )
35
-
36
- summary = llm.invoke(
37
- [
38
- SystemMessage(content="You are a Web Data Summarizer. you are skilled at summarizing complex webpages into short summaries. "),
39
- HumanMessage(content=f"provide a neet summary of the youself. Do not add up things. \n\n**Scraped Data from your portfolio:** \n\n{scraped_data}"),
40
- ]
41
- )
42
- return summary
43
-
44
- def person_linkedin_agent(topic, summary, mood):
45
-
46
- AI71_BASE_URL = "https://api.ai71.ai/v1/"
47
- AI71_API_KEY = 'ai71-api-f65e97e6-af86-4de9-a667-dc61c1ef8c75'
48
-
49
- llm = ChatOpenAI(
50
- model="tiiuae/falcon-180b-chat",
51
- api_key=AI71_API_KEY,
52
- base_url=AI71_BASE_URL,
53
- # streaming=True,
54
- )
55
-
56
- blog = llm.invoke(
57
- [
58
- SystemMessage(content=f"Your details are given below: \n\n{summary}"),
59
- HumanMessage(content=f"Write a LinkedIn post on the topic: {topic}. Mention your details in the post. Add symbols and emojis to make the post attractive. "),
60
- ]
61
- )
62
- return blog
63
-
64
- def company_linkedin_agent(topic, summary, mood):
65
-
66
- AI71_BASE_URL = "https://api.ai71.ai/v1/"
67
- AI71_API_KEY = 'ai71-api-f65e97e6-af86-4de9-a667-dc61c1ef8c75'
68
-
69
- llm = ChatOpenAI(
70
- model="tiiuae/falcon-180b-chat",
71
- api_key=AI71_API_KEY,
72
- base_url=AI71_BASE_URL,
73
- # streaming=True,
74
- )
75
-
76
- blog = llm.invoke(
77
- [
78
- SystemMessage(content=f"You are a content Writer. You write content in {mood} way. You also add symbols, emojis to make the content attractive."),
79
- HumanMessage(content=f"Write a LinkedIn post on the topic: {topic}.\n\nThe post is for the company mentioned below.\n\n{summary}"),
80
- ]
81
- )
82
- return blog
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from langchain_openai import ChatOpenAI
2
+ from langchain.schema import HumanMessage, SystemMessage
3
+ from langchain_groq import ChatGroq
4
+
5
+
6
+ def web_summarizer_company(scraped_data):
7
+
8
+ AI71_BASE_URL = "https://api.ai71.ai/v1/"
9
+ AI71_API_KEY = 'ai71-api-f65e97e6-af86-4de9-a667-dc61c1ef8c75'
10
+
11
+ llm = ChatOpenAI(
12
+ model="tiiuae/falcon-180b-chat",
13
+ api_key=AI71_API_KEY,
14
+ base_url=AI71_BASE_URL,
15
+ # streaming=True,
16
+ )
17
+
18
+ summary = llm.invoke(
19
+ [
20
+ SystemMessage(content="You are a Web Data Summarizer. you are skilled at summarizing company webpages into short summaries. "),
21
+ HumanMessage(content=f"provide a neet summary of the company. Do not add up things. \n\n**Scraped Data:** \n\n{scraped_data}"),
22
+ ]
23
+ )
24
+ return summary
25
+
26
+ def web_summarizer_person(scraped_data):
27
+
28
+ AI71_BASE_URL = "https://api.ai71.ai/v1/"
29
+ AI71_API_KEY = 'ai71-api-f65e97e6-af86-4de9-a667-dc61c1ef8c75'
30
+
31
+ llm = ChatOpenAI(
32
+ model="tiiuae/falcon-180b-chat",
33
+ api_key=AI71_API_KEY,
34
+ base_url=AI71_BASE_URL,
35
+ # streaming=True,
36
+ )
37
+
38
+ summary = llm.invoke(
39
+ [
40
+ SystemMessage(content="You are a Web Data Summarizer. you are skilled at summarizing complex webpages into short summaries. "),
41
+ HumanMessage(content=f"provide a neet summary of the youself. Do not add up things. \n\n**Scraped Data from your portfolio:** \n\n{scraped_data}"),
42
+ ]
43
+ )
44
+ return summary
45
+
46
+ def person_linkedin_agent(topic, summary, mood):
47
+
48
+ AI71_BASE_URL = "https://api.ai71.ai/v1/"
49
+ AI71_API_KEY = 'ai71-api-f65e97e6-af86-4de9-a667-dc61c1ef8c75'
50
+
51
+ llm = ChatOpenAI(
52
+ model="tiiuae/falcon-180b-chat",
53
+ api_key=AI71_API_KEY,
54
+ base_url=AI71_BASE_URL,
55
+ # streaming=True,
56
+ )
57
+
58
+ blog = llm.invoke(
59
+ [
60
+ SystemMessage(content=f"Your details are given below: \n\n{summary}"),
61
+ HumanMessage(content=f"Write a LinkedIn post on the topic: {topic}. Mention your details in the post. Add symbols and emojis to make the post attractive. "),
62
+ ]
63
+ )
64
+ return blog
65
+
66
+ def company_linkedin_agent(topic, summary, mood):
67
+
68
+ AI71_BASE_URL = "https://api.ai71.ai/v1/"
69
+ AI71_API_KEY = 'ai71-api-f65e97e6-af86-4de9-a667-dc61c1ef8c75'
70
+
71
+ llm = ChatOpenAI(
72
+ model="tiiuae/falcon-180b-chat",
73
+ api_key=AI71_API_KEY,
74
+ base_url=AI71_BASE_URL,
75
+ # streaming=True,
76
+ )
77
+
78
+ blog = llm.invoke(
79
+ [
80
+ SystemMessage(content=f"You are a content Writer. You write content in {mood} way. You also add symbols, emojis to make the content attractive."),
81
+ HumanMessage(content=f"Write a LinkedIn post on the topic: {topic}.\n\nThe post is for the company mentioned below.\n\n{summary}"),
82
+ ]
83
+ )
84
+ return blog
85
+
86
+ def image_prompt_agent(post):
87
+
88
+ llm = ChatGroq(model="llama3-70b-8192", api_key='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')
89
+ # AI71_BASE_URL = "https://api.ai71.ai/v1/"
90
+ # AI71_API_KEY = 'ai71-api-f65e97e6-af86-4de9-a667-dc61c1ef8c75'
91
+
92
+ # llm = ChatOpenAI(
93
+ # model="tiiuae/falcon-180b-chat",
94
+ # api_key=AI71_API_KEY,
95
+ # base_url=AI71_BASE_URL,
96
+ # # streaming=True,
97
+ # )
98
+
99
+ blog = llm.invoke("write descriptive prompt for used in LinkedIn post. "
100
+ "Prompt is 'What you wish to see in the output image'. "
101
+ "A descriptive prompt that clearly defines elements, colors, and subjects will lead to better results. "
102
+ "For example: The sky was a crisp (blue:0.3) and (green:0.8) would convey a sky that was blue and green, but more green than blue. The weight applies to all words in the prompt. ",
103
+ "Output only the prompt"
104
+ f"**LinkedIn post**: {post}")
105
+ return blog