This project is an example using the CrewAI framework to automate the process of creating landing pages from a single idea. CrewAI orchestrates autonomous AI agents, enabling them to collaborate and execute complex tasks efficiently.
Disclaimer: Templates are not included as they are Tailwind templates. Place Tailwind individual template folders in ./templates
, if you have a lincese you can download them at (https://tailwindui.com/templates), their references are at config/templates.json
, this was not tested this with other templates, prompts in tasks.py
might require some changes for that to work.
By @joaomdmoura
- CrewAI Framework
- Running the script
- Details & Explanation
- Using GPT 3.5
- Using Local Models with Ollama
- Contributing
- Support and Contact
- License
CrewAI is designed to facilitate the collaboration of role-playing AI agents. In this example, these agents work together to transform an idea into a fully fleshed-out landing page by expanding the idea, choosing a template, and customizing it to fit the concept.
It uses GPT-4 by default so you should have access to that to run it.
Disclaimer: This will use gpt-4 unless you changed it not to, and by doing so it will cost you money (~2-9 USD). The full run might take around ~10-45m. Enjoy your time back
- Configure Environment: Copy ``.env.example` and set up the environment variables for Browseless, Serper and OpenAI
- Install Dependencies: Run
poetry install --no-root
. - Add Tailwind Templates: Place Tailwind individual template folders in
./templates
, if you have a linces you can download them at (https://tailwindui.com/templates), their references are atconfig/templates.json
, I haven't tested this with other templates, prompts intasks.py
might require some changes for that to work. - Execute the Script: Run
poetry run python main.py
and input your idea.
- Running the Script: Execute `python main.py`` and input your idea when prompted. The script will leverage the CrewAI framework to process the idea and generate a landing page.
- Output: The generated landing page will be zipped in the a
workdir.zip
file you can download. - Key Components:
./main.py
: Main script file../tasks.py
: Main file with the tasks prompts../tools
: Contains tool classes used by the agents../config
: Configuration files for agents../templates
: Directory to store Tailwind templates (not included).
CrewAI allow you to pass an llm argument to the agent construtor, that will be it's brain, so changing the agent to use GPT-3.5 instead of GPT-4 is as simple as passing that argument on the agent you want to use that LLM (in main.py
).
from langchain.chat_models import ChatOpenAI
llm = ChatOpenAI(model='gpt-3.5') # Loading GPT-3.5
self.idea_analyst = Agent(
**idea_analyst_config,
verbose=True,
llm=llm, # <----- passing our llm reference here
tools=[
SearchTools.search_internet,
BrowserTools.scrape_and_summarize_kwebsite
]
)
The CrewAI framework supports integration with local models, such as Ollama, for enhanced flexibility and customization. This allows you to utilize your own models, which can be particularly useful for specialized tasks or data privacy concerns.
- Install Ollama: Ensure that Ollama is properly installed in your environment. Follow the installation guide provided by Ollama for detailed instructions.
- Configure Ollama: Set up Ollama to work with your local model. You will probably need to tweak the model using a Modelfile, I'd recommend adding
Observation
as a stop word and playing withtop_p
andtemperature
.
- Instantiate Ollama Model: Create an instance of the Ollama model. You can specify the model and the base URL during instantiation. For example:
from langchain.llms import Ollama
ollama_openhermes = Ollama(model="agent")
# Pass Ollama Model to Agents: When creating your agents within the CrewAI framework, you can pass the Ollama model as an argument to the Agent constructor. For instance:
self.idea_analyst = Agent(
**idea_analyst_config,
verbose=True,
llm=ollama_openhermes, # Ollama model passed here
tools=[
SearchTools.search_internet,
BrowserTools.scrape_and_summarize_website
]
)
- Privacy: Local models allow processing of data within your own infrastructure, ensuring data privacy.
- Customization: You can customize the model to better suit the specific needs of your tasks.
- Performance: Depending on your setup, local models can offer performance benefits, especially in terms of latency.
This project is released under the MIT License.