Skip to content

santhoshv456/ladningpage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Crew for Landing Pages

Introduction

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

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.

Running the Script

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 at config/templates.json, I haven't tested this with other templates, prompts in tasks.py might require some changes for that to work.
  • Execute the Script: Run poetry run python main.py and input your idea.

Details & Explanation

  • 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).

Using GPT 3.5

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
    ]
)

Using Local Models with Ollama

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.

Setting Up Ollama

  • 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 with top_p and temperature.

Integrating Ollama with CrewAI

  • 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
    ]
)

Advantages of Using Local Models

  • 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.

License

This project is released under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages