Rashmi0801 commited on
Commit
a76d507
·
verified ·
1 Parent(s): f61e168

Upload 5 files

Browse files
Files changed (5) hide show
  1. agents.py +40 -27
  2. crew.py +13 -19
  3. new-blog-post.md +4 -50
  4. tasks.py +17 -13
  5. tools.py +9 -3
agents.py CHANGED
@@ -1,10 +1,16 @@
1
  from crewai import Agent, LLM
2
- from tools import yt_tool
 
3
  from dotenv import load_dotenv
4
  load_dotenv()
5
- import litellm
6
- import os
7
  from langchain_google_genai import ChatGoogleGenerativeAI
 
 
 
 
 
 
 
8
 
9
  os.environ["GEMINI_API_KEY"] = os.getenv("GEMINI_API_KEY")
10
  api_key = "AIzaSyA_jVLib-F27Fe6GvPqdHH5VQZ1eRJUJbY"
@@ -18,32 +24,39 @@ llm = LLM(
18
  google_api_key=api_key
19
  )
20
 
21
- # Create a Senior blog Content researcher agent
22
- blog_researcher = Agent(
23
- role = 'Blog Researcher from Youtube Videos',
24
- goal = 'Get the relevant video content for the topic {topic} from YT channel',
25
- verbose = True,
26
- memory = True,
27
- backstory = (
28
- "Expert in understanding videos in AI Data Science , Machine Learning And GEN AI and providing suggestions"
 
 
 
 
29
  ),
30
- tools = [yt_tool],
31
  llm=llm,
32
- allow_delegation = True
 
33
  )
34
 
35
- # Create a senior blog Writer agent with YT tool
36
- blog_writer=Agent(
37
- role = 'Blog Writer',
38
- goal = 'Narrate compelling tech stories about the video {topic} from YT video',
39
- verbose = True,
40
- memory = True,
41
- backstory = (
42
- "With a flair for simplifying complex topics, you craft"
43
- "engaging narratives that captivate and educate, bringing new"
44
- "discoveries to light in an accessible manner."
45
- ),
46
- tools = [yt_tool],
47
- llm=llm,
48
- allow_delegation = False
 
49
  )
 
 
1
  from crewai import Agent, LLM
2
+ from tools import tool
3
+ import litellm
4
  from dotenv import load_dotenv
5
  load_dotenv()
 
 
6
  from langchain_google_genai import ChatGoogleGenerativeAI
7
+ import os
8
+
9
+ ## call the gemini models
10
+ # llm=ChatGoogleGenerativeAI(model="gemini-1.5-flash",
11
+ # verbose=True,
12
+ # temperature=0.5,
13
+ # google_api_key=os.getenv("GEMINI_API_KEY"))
14
 
15
  os.environ["GEMINI_API_KEY"] = os.getenv("GEMINI_API_KEY")
16
  api_key = "AIzaSyA_jVLib-F27Fe6GvPqdHH5VQZ1eRJUJbY"
 
24
  google_api_key=api_key
25
  )
26
 
27
+ # Creating a senior researcher agent with memory and verbose mode
28
+
29
+ news_researcher=Agent(
30
+ role="Senior Researcher",
31
+ goal='Unccover ground breaking technologies in {topic}',
32
+ verbose=True,
33
+ memory=True,
34
+ backstory=(
35
+ "Driven by curiosity, you're at the forefront of"
36
+ "innovation, eager to explore and share knowledge that could change"
37
+ "the world."
38
+
39
  ),
40
+ tools=[tool],
41
  llm=llm,
42
+ allow_delegation=True
43
+
44
  )
45
 
46
+ ## creating a write agent with custom tools responsible in writing news blog
47
+
48
+ news_writer = Agent(
49
+ role='Writer',
50
+ goal='Narrate compelling tech stories about {topic}',
51
+ verbose=True,
52
+ memory=True,
53
+ backstory=(
54
+ "With a flair for simplifying complex topics, you craft"
55
+ "engaging narratives that captivate and educate, bringing new"
56
+ "discoveries to light in an accessible manner."
57
+ ),
58
+ tools=[tool],
59
+ llm=llm,
60
+ allow_delegation=False
61
  )
62
+
crew.py CHANGED
@@ -1,22 +1,16 @@
1
- from crewai import Crew, Process, LLM
2
- import os
3
- from dotenv import load_dotenv
4
- load_dotenv()
5
- from litellm import completion
6
- from agents import blog_researcher, blog_writer
7
- from tasks import research_task, write_task
 
 
8
 
9
- # Forming the tech-focused crew with some enhanced configurations
10
- crew = Crew(
11
- agents=[blog_researcher, blog_writer],
12
- tasks=[research_task, write_task],
13
- process=Process.sequential, # Optional: Sequential task execution is default
14
- memory=True,
15
- cache=True,
16
- max_rpm=100,
17
- share_crew=True
18
  )
19
 
20
- # Start the task execution process with Enhanced feedback
21
- result = crew.kickoff(inputs={'topic':'AI VS ML VS DL vs Data Science'})
22
- print(result)
 
 
1
+ from crewai import Crew,Process
2
+ from tasks import research_task,write_task
3
+ from agents import news_researcher,news_writer
4
+
5
+ ## Forming the tech focused crew with some enhanced configuration
6
+ crew=Crew(
7
+ agents=[news_researcher,news_writer],
8
+ tasks=[research_task,write_task],
9
+ process=Process.sequential,
10
 
 
 
 
 
 
 
 
 
 
11
  )
12
 
13
+ ## starting the task execution process wiht enhanced feedback
14
+
15
+ result=crew.kickoff(inputs={'topic':'AI in healthcare'})
16
+ print(result)
new-blog-post.md CHANGED
@@ -1,53 +1,7 @@
1
- ## AI vs. ML vs. DL vs. Data Science: Untangling the Web
2
 
3
- The world of technology is buzzing with terms like Artificial Intelligence (AI), Machine Learning (ML), Deep Learning (DL), and Data Science. These fields are interconnected, yet distinct, and understanding their relationships is crucial for anyone navigating the modern tech landscape. Let's break down these concepts and clarify their roles.
4
 
5
- **Artificial Intelligence (AI): The Big Picture**
6
 
7
- AI is the overarching concept of creating machines that can perform tasks that typically require human intelligence. This includes problem-solving, learning, reasoning, and perception. Think of AI as the grand vision a future where machines can think and act intelligently.
8
-
9
- * **Example:** A self-driving car is an example of AI. It needs to perceive its surroundings, make decisions based on those perceptions, and navigate safely.
10
-
11
- **Machine Learning (ML): Learning from Data**
12
-
13
- Machine Learning is a *subset* of AI. It focuses on enabling machines to learn from data without being explicitly programmed. Instead of writing specific rules, ML algorithms identify patterns in data and use those patterns to make predictions or decisions.
14
-
15
- * **Example:** A spam filter is an ML application. It learns to identify spam emails by analyzing the characteristics of many emails that have been labeled as spam or not spam.
16
- * **How it Relates to AI:** ML provides a way to *achieve* AI. By learning from data, machines can perform intelligent tasks without constant human intervention.
17
-
18
- **Deep Learning (DL): A Deeper Dive into Neural Networks**
19
-
20
- Deep Learning is a *subset* of Machine Learning. It uses artificial neural networks with multiple layers (hence "deep") to analyze data. These networks are inspired by the structure of the human brain and are capable of learning very complex patterns.
21
-
22
- * **Example:** Image recognition is a common DL application. Deep learning models can be trained to identify objects in images with high accuracy, even when those objects are partially obscured or viewed from different angles.
23
- * **How it Relates to ML and AI:** DL is a powerful technique for *implementing* ML. Its ability to learn complex patterns makes it suitable for tasks that are difficult to solve with traditional ML algorithms.
24
-
25
- **Data Science: The Foundation**
26
-
27
- Data Science is an interdisciplinary field that uses scientific methods, processes, algorithms, and systems to extract knowledge and insights from structured and unstructured data. It encompasses a broader range of activities than just ML or AI. Data scientists use various tools and techniques, including statistics, data visualization, and, yes, ML, to make sense of data.
28
-
29
- * **Example:** A data scientist might analyze customer data to identify trends in purchasing behavior. This information can then be used to improve marketing campaigns or develop new products.
30
- * **How it Relates to AI, ML, and DL:** Data Science provides the *foundation* for AI, ML, and DL. It's the process of collecting, cleaning, and preparing data so that it can be used to train ML and DL models. Data scientists also play a crucial role in evaluating the performance of these models and ensuring that they are used ethically and responsibly. Data Science is the broader field that encompasses the processes needed to ask questions, collect data, analyze it, and interpret it.
31
-
32
- **Analogy:**
33
-
34
- Think of it like this:
35
-
36
- * **AI:** Building a robot that can perform household chores.
37
- * **ML:** Teaching the robot to recognize different objects (e.g., a chair, a table) by showing it many pictures.
38
- * **DL:** Using a complex neural network to enable the robot to understand subtle differences between objects (e.g., different types of chairs).
39
- * **Data Science:** Analyzing data about household chores to determine which tasks to automate first, what kind of robot is needed, and how to measure its performance.
40
-
41
- **Key Differences: A Quick Comparison**
42
-
43
- | Feature | AI | ML | DL | Data Science |
44
- | ---------------- | ----------------------------------- | ---------------------------------------- | ------------------------------------------ | --------------------------------------------- |
45
- | **Definition** | Creating intelligent machines | Machines learning from data | Deep neural networks learning from data | Extracting knowledge and insights from data |
46
- | **Approach** | Broad; various techniques | Algorithms learn from data | Neural networks with multiple layers | Scientific methods, statistics, algorithms |
47
- | **Data** | Can work with limited data | Requires significant data | Requires massive amounts of data | Requires structured and unstructured data |
48
- | **Complexity** | Varies | Moderate | High | Varies |
49
- | **Applications** | Robotics, expert systems, game playing | Spam filtering, recommendation systems | Image recognition, natural language processing | Business intelligence, fraud detection, healthcare |
50
-
51
- **In Conclusion**
52
-
53
- AI, ML, DL, and Data Science are interconnected fields that are transforming the world around us. While AI is the broad goal of creating intelligent machines, ML and DL are specific techniques for achieving that goal. Data Science provides the foundation for all of these fields by enabling us to collect, analyze, and interpret the vast amounts of data that are now available. By understanding the relationships between these concepts, you can gain a deeper appreciation for the power of technology and its potential to solve some of the world's most pressing problems.
 
1
+ AI is rapidly transforming healthcare, promising a future of more efficient, personalized, and accessible care. One of the most exciting trends is the rise of Generative AI, which is being used to accelerate drug discovery by predicting molecular interactions and designing novel drug candidates. AI is also enhancing medical imaging analysis, leading to earlier and more accurate disease detection. Beyond diagnostics and treatment, AI is streamlining administrative tasks, automating clinical documentation, and personalizing patient communication, freeing up healthcare professionals to focus on what they do best: direct patient care.
2
 
3
+ Another key trend is the increasing use of machine vision and ambient listening in patient rooms. These technologies, combined with the Internet of Medical Things (IoMT), enable proactive patient care and improve clinical workflows. AI excels at well-defined tasks, supporting doctors and augmenting human capabilities rather than replacing them. This collaborative approach allows healthcare leaders to gain knowledge and insights from data, leading to more informed decision-making and improved patient outcomes. The integration of AI is also supporting poorly resourced services, making healthcare more accessible to underserved populations.
4
 
5
+ Generative AI, in particular, is poised to revolutionize various aspects of the healthcare industry. Its ability to generate realistic and diverse synthetic data helps overcome data scarcity issues, while its capacity to personalize treatment plans based on individual patient characteristics promises a new era of precision medicine. The market for Generative AI in healthcare is rapidly expanding, with projections estimating significant growth in the coming years, driven by increasing adoption across pharmaceutical companies, hospitals, and research institutions. This growth reflects the immense potential of AI to improve patient outcomes, reduce costs, and accelerate innovation.
6
 
7
+ However, the integration of AI in healthcare is not without its challenges. Ethical considerations, such as algorithmic bias and data privacy, must be carefully addressed. Ensuring that AI systems are fair, transparent, and secure is crucial for building trust and maximizing the benefits of this technology. By establishing clear guidelines and standards for the development and deployment of AI, healthcare organizations can harness its power to improve patient outcomes, reduce costs, and accelerate innovation, ultimately advancing the well-being of all patients. Continuous monitoring and evaluation of AI models are also crucial to identify and mitigate biases, ensuring fairness and equity in healthcare delivery.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tasks.py CHANGED
@@ -1,26 +1,30 @@
1
  from crewai import Task
2
- from tools import yt_tool
3
- from agents import blog_researcher, blog_writer
4
 
5
- # Research Task
6
  research_task = Task(
7
  description=(
8
- "Identify the video {topic}."
9
- "Get detailed information about the video from the channel video."
 
 
10
  ),
11
- expected_output='A comprehensive 3 paragraphs long report based on the {topic} of video content.',
12
- tools=[yt_tool],
13
- agent=blog_researcher,
14
  )
15
 
16
  # Writing task with language model configuration
17
  write_task = Task(
18
  description=(
19
- "get the info from the youtube channel on the topic {topic}."
 
 
20
  ),
21
- expected_output='Summarize the info from the youtube channel video on the topic{topic} and create the content for the blog',
22
- tools=[yt_tool],
23
- agent=blog_writer,
24
  async_execution=False,
25
  output_file='new-blog-post.md' # Example of output customization
26
- )
 
1
  from crewai import Task
2
+ from tools import tool
3
+ from agents import news_researcher,news_writer
4
 
5
+ # Research task
6
  research_task = Task(
7
  description=(
8
+ "Identify the next big trend in {topic}."
9
+ "Focus on identifying pros and cons and the overall narrative."
10
+ "Your final report should clearly articulate the key points,"
11
+ "its market opportunities, and potential risks."
12
  ),
13
+ expected_output='A comprehensive 3 paragraphs long report on the latest AI trends.',
14
+ tools=[tool],
15
+ agent=news_researcher,
16
  )
17
 
18
  # Writing task with language model configuration
19
  write_task = Task(
20
  description=(
21
+ "Compose an insightful article on {topic}."
22
+ "Focus on the latest trends and how it's impacting the industry."
23
+ "This article should be easy to understand, engaging, and positive."
24
  ),
25
+ expected_output='A 4 paragraph article on {topic} advancements formatted as markdown.',
26
+ tools=[tool],
27
+ agent=news_writer,
28
  async_execution=False,
29
  output_file='new-blog-post.md' # Example of output customization
30
+ )
tools.py CHANGED
@@ -1,7 +1,13 @@
1
- from crewai_tools import YoutubeChannelSearchTool
2
 
3
- # Initialize the tool with a specific Youtube channel handle to target your search
4
- yt_tool = YoutubeChannelSearchTool(youtube_channel_handle="https://www.youtube.com/@krishnaik06")
 
5
 
 
6
 
7
 
 
 
 
 
 
1
+ ## https://serper.dev/
2
 
3
+ from dotenv import load_dotenv
4
+ load_dotenv()
5
+ import os
6
 
7
+ os.environ['SERPER_API_KEY'] = os.getenv('SERPER_API_KEY')
8
 
9
 
10
+ from crewai_tools import SerperDevTool
11
+
12
+ # Initialize the tool for internet searching capabilities
13
+ tool = SerperDevTool()