Spaces:
Build error
Build error
File size: 2,628 Bytes
ec94d77 6bb011c ec94d77 9c86c9e c95b5a3 5c10bd1 ec94d77 8543cfb cbe9938 55d30d0 51324d0 55d30d0 cbe9938 cf84cf6 ff776cc 15551d7 9c86c9e ec94d77 ea1abf9 9046617 ff776cc 9c86c9e 55d30d0 ea1abf9 480208d 5f3be4e 9046617 c95b5a3 ea1abf9 ec94d77 ea1abf9 480208d 5f3be4e 9046617 c95b5a3 ea1abf9 ec94d77 ea1abf9 480208d 5f3be4e 9046617 5c10bd1 ea1abf9 |
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 55 56 57 58 |
from crewai import Agent
from langchain.llms import HuggingFaceEndpoint
import os
from dotenv import load_dotenv
#from tools.image_generation_tools import ImageGenerationTools
#from tools.web_search_tools import WebSearchTools
from web_scraper_tool import web_scraper_tool
#from image_search_tool import image_search_tool
load_dotenv()
secret_token = os.getenv("content")
repo_id = "mistralai/Mistral-7B-Instruct-v0.3"
mistral = HuggingFaceEndpoint(repo_id=repo_id, huggingfacehub_api_token=secret_token, max_new_tokens=28000, temperature=0.3, repetition_penalty=1.1)
from langchain_groq import ChatGroq
# Initialize the Groq LLM
groq_llm = ChatGroq(temperature=0.6, groq_api_key=os.environ.get("groq_api_key"), model_name="llama3-8b-8192")
# Initialize the Tools
#image_generation_tools = ImageGenerationTools()
#web_search_tools = WebSearchTools()
class ContentAgents:
def __init__(self):
self.llm = groq_llm
#self.image_generator = image_generation_tools
def planner_agent(self, topic):
return Agent(
role='Senior Content Planner',
goal=f'Create a detailed and structured content plan for a blog post about {topic} that will guide further content creation steps.',
backstory="You are a seasoned strategist responsible for developing content plans, conducting research, and ensuring the foundation for high-quality articles.",
llm=self.llm,
tools=[web_scraper_tool],
allow_delegation=False,
verbose=True)
def researcher_agent(self, topic):
return Agent(
role='Market and Domain Research Analyst',
goal=f'Provide accurate and up-to-date domain knowledge and image references for the topic {topic} to support content creation.',
backstory="You are a seasoned strategist responsible for developing content plans, conducting research, and ensuring the foundation for high-quality articles.",
llm=self.llm,
tools=[web_scraper_tool],
allow_delegation=False,
verbose=True)
def writer_agent(self, topic):
return Agent(
role='Senior Content Writer',
goal=f'Write a high-quality, engaging, and informative blog post on {topic}, based on the content plan and research provided.',
backstory="You are a seasoned strategist responsible for developing content plans, conducting research, and ensuring the foundation for high-quality articles.",
llm=self.llm,
#tools=[image_search_tool],
allow_delegation=False,
verbose=True)
|