Spaces:
Build error
Build error
Update agents.py
Browse files
agents.py
CHANGED
|
@@ -11,54 +11,63 @@ secret_token = os.getenv("content")
|
|
| 11 |
repo_id = "mistralai/Mistral-7B-Instruct-v0.2"
|
| 12 |
mistral = HuggingFaceEndpoint(repo_id=repo_id, huggingfacehub_api_token = secret_token,temperature=0.3,repetition_penalty=1.1)
|
| 13 |
|
| 14 |
-
class ContentAgents
|
| 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 |
-
def writer_agent(self, topic):
|
| 48 |
-
return Agent(
|
| 49 |
-
role='Senior Content Writer',
|
| 50 |
-
goal=f"""Craft insightful, authentic, compelling and factually accurate engaging opinion piece about the topic: {topic}""",
|
| 51 |
-
backstory=f"""You are a skilled writer with years of experience. You're working on writing a new opinion piece about the
|
| 52 |
-
topic: {topic}. You base your writing on the work of the Content Planner, who provides an outline and relevant context about
|
| 53 |
-
the topic, and the work of the Content Researcher, who provides the domain knowledge and related images about the topic.
|
| 54 |
-
You follow the main objectives and direction of the outline, as provided by the Content Planner. You leverage the domain
|
| 55 |
-
knowledge and images that come from the Content Researcher. You also provide authentic, objective and impartial insights and
|
| 56 |
-
back them up with information provided by the Content Researcher. You acknowledge in your opinion piece when your statements
|
| 57 |
-
are opinions as opposed to objective statements. You avoid plagia, you provide references for your citations, and mention
|
| 58 |
-
attribution to the images/information coming from others.""",
|
| 59 |
-
llm = mistral,
|
| 60 |
-
allow_delegation=False,
|
| 61 |
-
verbose=True)
|
| 62 |
|
| 63 |
|
| 64 |
'''def editor_agent(self):
|
|
|
|
| 11 |
repo_id = "mistralai/Mistral-7B-Instruct-v0.2"
|
| 12 |
mistral = HuggingFaceEndpoint(repo_id=repo_id, huggingfacehub_api_token = secret_token,temperature=0.3,repetition_penalty=1.1)
|
| 13 |
|
| 14 |
+
class ContentAgents:
|
| 15 |
|
| 16 |
+
def planner_agent(self, topic):
|
| 17 |
+
return Agent(
|
| 18 |
+
role='Senior Content Planner',
|
| 19 |
+
goal=f'Plan a comprehensive and engaging blog post about {topic} for channels like Medium, including sections such as Introduction, Application, Definition and Architecture, How it Works, Comparison with Other Similar Apps, and References.',
|
| 20 |
+
backstory=f"""You're working on planning a research article about the topic: {topic}. You collect information that helps the audience
|
| 21 |
+
learn something and make informed decisions. Your work is the basis for the Content Writer to write an article on this topic.
|
| 22 |
+
The structure of the blog post should include:
|
| 23 |
+
1. Introduction
|
| 24 |
+
2. Application
|
| 25 |
+
3. Definition and Architecture
|
| 26 |
+
4. How it Works
|
| 27 |
+
5. Comparison with Other Similar Apps
|
| 28 |
+
6. References
|
| 29 |
+
7. Images to support the content
|
| 30 |
+
""",
|
| 31 |
+
llm='mistral',
|
| 32 |
+
allow_delegation=False,
|
| 33 |
+
verbose=True)
|
| 34 |
|
| 35 |
+
def researcher_agent(self, topic):
|
| 36 |
+
return Agent(
|
| 37 |
+
role='Market and Domain Research Analyst',
|
| 38 |
+
goal=f'Provide up-to-date market analysis, domain knowledge, and relevant images on {topic} for a comprehensive blog post including sections such as Introduction, Application, Definition and Architecture, How it Works, Comparison with Other Similar Apps, and References.',
|
| 39 |
+
backstory=f"""You are an expert analyst with a keen eye for market trends. Based on the comprehensive content plan provided by
|
| 40 |
+
the Planner, you do web searches on the topic {topic} in order to find compelling images as well as provide precise and up-to-date
|
| 41 |
+
domain knowledge. Your work is the basis for the Content Writer to write an article on this topic.""",
|
| 42 |
+
llm='mistral',
|
| 43 |
+
allow_delegation=False,
|
| 44 |
+
verbose=True)
|
| 45 |
|
| 46 |
+
def writer_agent(self, topic):
|
| 47 |
+
return Agent(
|
| 48 |
+
role='Senior Content Writer',
|
| 49 |
+
goal=f'Craft an insightful, authentic, and engaging blog post about {topic} for channels like Medium, including sections such as Introduction, Application, Definition and Architecture, How it Works, Comparison with Other Similar Apps, and References.',
|
| 50 |
+
backstory=f"""You are a skilled writer with years of experience. You're working on writing a new opinion piece about the
|
| 51 |
+
topic: {topic}. You base your writing on the work of the Content Planner, who provides an outline and relevant context about
|
| 52 |
+
the topic, and the work of the Content Researcher, who provides the domain knowledge and related images about the topic.
|
| 53 |
+
The structure of the blog post should include:
|
| 54 |
+
1. Introduction
|
| 55 |
+
2. Application
|
| 56 |
+
3. Definition and Architecture
|
| 57 |
+
4. How it Works
|
| 58 |
+
5. Comparison with Other Similar Apps
|
| 59 |
+
6. References
|
| 60 |
+
7. Images to support the content
|
| 61 |
+
|
| 62 |
+
You follow the main objectives and direction of the outline, as provided by the Content Planner. You leverage the domain
|
| 63 |
+
knowledge and images that come from the Content Researcher. You also provide authentic, objective, and impartial insights and
|
| 64 |
+
back them up with information provided by the Content Researcher. You acknowledge in your opinion piece when your statements
|
| 65 |
+
are opinions as opposed to objective statements. You avoid plagiarism, you provide references for your citations, and mention
|
| 66 |
+
attribution to the images/information coming from others.""",
|
| 67 |
+
llm='mistral',
|
| 68 |
+
allow_delegation=False,
|
| 69 |
+
verbose=True)
|
| 70 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
|
| 72 |
|
| 73 |
'''def editor_agent(self):
|