Categories
Tools

Open Interpreter Use Cases

  • File & Folder Operations:
  1. Remove unused or unwanted files: We can write a script to delete certain files based on your requirements.
  2. Open a specific directory: If you want to navigate into a certain directory and list its files.
  3. Search for a specific file: If you’re looking for a specific file, we can write a script to find it for you.
  4. Create a new folder: We can help you create new folders and organize your files.
  5. Move certain files: Based on file type or name, we can move them into different folders.
  • Additional File Operations:
  1. File Search: Searching for a file pattern in your directories. If you remember partial file name we can find the full name and path of the file.
  2. Space Usage: Check the space used by each directory on your Desktop.
  3. File Content Search: Search for a specific text inside files.
  4. File Sorting: We can sort your files based on name, size, date created, or date modified.
  5. File Compression: If there are several files that you don’t commonly use, we can compress them to save some space.
  • System Information:
  1. System Update: We can check if your system is up to date with the latest patches and updates.
  2. Disk Usage: We could analyze the disk usage and understand which files or directories are taking the most space.
  3. Process Monitor: We could list all running processes on your machine.
  4. Hardware Information: We could gather and display hardware information, such as CPU, memory, etc.
  • Programming & Software Development:
  1. Coding Project: We could start a new coding project, such as a small script or a web application.
  2. Learning New Language: We could start learning basics of a new programming language.
  3. Running a program: If you’ve written a program and are experiencing any issues or want to see the output, we can do that.
  4. Understanding Code: If you have any piece of code that you’re having trouble understanding, we could go over it.
  5. Coding Challenge: We could find and work on a coding problem from challenge websites like LeetCode, HackerRank.
  • Data Analysis & Visualization:
  1. Data Cleaning: We could take a dataset and clean it by removing missing values, handling outliers, encoding variables, etc.
  2. Data Visualization: We could explore a dataset and create various visualizations (like line graphs, bar plots, histograms, etc.) to understand the data better.
  3. Statistical Analysis: We could perform statistical analysis on a dataset of your choice.
  4. Machine Learning: We could implement a simple machine learning model on a dataset. We can even go through a step-by-step process of how machine learning models are built and refined.
  5. Data Scraping: If you’re interested, we could write a script to scrape data from the web.
  • External Services & APIs:
  1. API Calls: We could write a script to interact with an API of your choice, perhaps fetching and displaying data from it.
  2. Database Interactions: We could write SQL queries to interact with a database, if you have one set up.
  3. Email Automation: We could write a script to automate emails, such as sending an email to multiple recipients.
  4. Web Scraping: If there’s a website with data you’re interested in, we could write a script to scrape data from it.
  5. Task Automation: We can script regular system tasks that could make your day-to-day activities easier.
  • Design & Multimedia:
  1. Website Design: We could start a plan to design a simple website using HTML, CSS, and JavaScript.
  2. Photo Editing: Basic photo editing tasks can be done using Python libraries like PIL or OpenCV.
  3. Video Processing: We could write scripts for basic video processing tasks using Python’s moviepy library.
  4. Creating Animations: We can create basic animations using JavaScript or CSS.
  5. Designing a User Interface: We could design a simple user interface for an application.
  • Network-Related Tasks:
  1. Network Ping Check: We could write a script to check the network connectivity to a list of hosts.
  2. Port Scanning: Writing a basic port scanning script.
  3. Traffic Monitoring: We could monitor network traffic on your system.
  4. DNS Lookup: A script to perform a DNS lookup of a particular URL.
  5. Checking Internet Speed: We can check your internet upload and download speed.
  • System Diagnostics & Performance:
  1. Performance Monitoring: Write a script to monitor the performance of your machine.
  2. Check System Logs: Write a script to fetch and examine system logs.
  3. Hardware Statistics: Gather statistics on your computer’s hardware (CPU usage, memory usage, etc.)
  4. Network Monitoring: Monitor network usage and statistics.
  5. Detect Application Errors: We can write scripts that detect errors, exceptions, or specific log entries related to the application’s behavior.
  • Interactive Tasks:
  1. Text-based Adventure Game: We can build a simple text-based adventure game in Python or another language of your choice.
  2. Interactive Quiz: We could create a quiz, on a topic of your choice.
  3. Command Line Application: Building a simple Command Line Interface (CLI) application.
  4. Graphical User Interface (GUI) Application: We could write a basic GUI application using Tkinter or similar library.
  5. Mini Game: We can develop a small, simple game like Tic Tac Toe or Rock, Paper, Scissors.
  • Educational Activities:
  1. Online Course Discussion: We can discuss the content of an online course that you’re enrolled in.
  2. Academic Paper Review: If there’s an academic paper that you’d like to understand better, we can go through it together.
  3. Book Notes: If there’s a particular book (technical or otherwise) that you’re reading, we could discuss its themes or content.
  4. Interview Preparation: I can help you with common interview questions and tips for the area of your interest.
  5. Learning New Skills: We can explore new skills that you’re interested in learning and find the most effective ways/resources for you to learn them.
  • File Operations:
  1. File Backup: We could write a script to backup certain directories or files.
  2. Duplicate Files: We could find and remove duplicate files in a directory.
  3. File Encryption: We could write a script to encrypt sensitive documents.
  4. Auto Organization: We can script to auto-organize files into appropriate folders based on their type.
  5. Large Files: We can find the largest files that are taking up most of the space.
  • Coding Practices:
  1. Code Refactoring: We could take a look at an existing piece of code and try to refactor it to make it more efficient, readable or maintainable.
  2. Understanding Algorithms: If there is a particular algorithm or data structure you would like to understand, we could go over it.
  3. Best Coding Practices: We can discuss some of the best practices in coding, be it naming conventions, proper commenting, or efficient ways to structure code.
  4. Code Debugging: If you have a code that is giving errors or not working as expected, we could debug it together.
  5. Set Up Development Environments: We can setup a development environment for a specific programming language or framework on your computer.
Categories
AI Agents

Crew AI Game Builder

git clone https://github.com/joaomdmoura/crewAI-examples/
cd crewAI-examples/game-builder-crew
pip install crewai langchain-community langchain langchain-core langchain-openai
export OPENAI_API_KEY=xxxxxxxxxxxxxxx
python main.py

Prompt

Shooter game where the player can shoot projectiles at enemies and move around the screen. Enemies should appear at a reasonable pace randomly and increase the pace the appear over time so the game get more difficult. Enemies will get destroyed if the player shoots projectiles that hits them. If the player hit an enemy it's game over. There should be a score on how many enemies the player hits. Your Final answer must be the python code, only the python code and nothing else. 

Output

import pygame
import random

# Screen dimensions
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600

# Player attributes
PLAYER_WIDTH = 50
PLAYER_HEIGHT = 50
PLAYER_COLOR = (0,0,255)
PLAYER_SPEED = 5

# Enemy attributes
ENEMY_WIDTH = 50
ENEMY_HEIGHT = 50
ENEMY_COLOR = (255,0,0)
ENEMY_SPEED = 3

# Projectile attributes
PROJECTILE_WIDTH = 10
PROJECTILE_HEIGHT = 10
PROJECTILE_COLOR = (0,255,0)
PROJECTILE_SPEED = 10

class Player(pygame.sprite.Sprite):
    def __init__(self):
        super().__init__()
        self.image = pygame.Surface([PLAYER_WIDTH, PLAYER_HEIGHT])
        self.image.fill(PLAYER_COLOR)
        self.rect = self.image.get_rect()
        self.score = 0

    def update(self):
        keys = pygame.key.get_pressed()
        if keys[pygame.K_LEFT]:
            self.rect.x -= PLAYER_SPEED
        if keys[pygame.K_RIGHT]:
            self.rect.x += PLAYER_SPEED
        if keys[pygame.K_UP]:
            self.rect.y -= PLAYER_SPEED
        if keys[pygame.K_DOWN]:
            self.rect.y += PLAYER_SPEED

        if self.rect.x < 0:
            self.rect.x = 0
        if self.rect.x > SCREEN_WIDTH - PLAYER_WIDTH:
            self.rect.x = SCREEN_WIDTH - PLAYER_WIDTH
        if self.rect.y < 0:
            self.rect.y = 0
        if self.rect.y > SCREEN_HEIGHT - PLAYER_HEIGHT:
            self.rect.y = SCREEN_HEIGHT - PLAYER_HEIGHT

class Enemy(pygame.sprite.Sprite):
    def __init__(self):
        super().__init__()
        self.image = pygame.Surface([ENEMY_WIDTH, ENEMY_HEIGHT])
        self.image.fill(ENEMY_COLOR)
        self.rect = self.image.get_rect()
        self.rect.x = random.randint(0, SCREEN_WIDTH - ENEMY_WIDTH)
        self.rect.y = -ENEMY_HEIGHT

    def update(self):
        self.rect.y += ENEMY_SPEED
        if self.rect.y > SCREEN_HEIGHT:
            self.rect.y = -ENEMY_HEIGHT
            self.rect.x = random.randint(0, SCREEN_WIDTH - ENEMY_WIDTH)

class Projectile(pygame.sprite.Sprite):
    def __init__(self, x, y):
        super().__init__()
        self.image = pygame.Surface([PROJECTILE_WIDTH, PROJECTILE_HEIGHT])
        self.image.fill(PROJECTILE_COLOR)
        self.rect = self.image.get_rect()
        self.rect.x = x
        self.rect.y = y

    def update(self):
        self.rect.y -= PROJECTILE_SPEED
        if self.rect.y < -PROJECTILE_HEIGHT:
            self.kill()

def game():
    pygame.init()
    screen = pygame.display.set_mode([SCREEN_WIDTH, SCREEN_HEIGHT])

    player = Player()
    player.rect.x = SCREEN_WIDTH // 2
    player.rect.y = SCREEN_HEIGHT // 2

    enemies = pygame.sprite.Group()
    projectiles = pygame.sprite.Group()

    all_sprites = pygame.sprite.Group()
    all_sprites.add(player)

    clock = pygame.time.Clock()

    running = True
    while running:
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                running = False
            elif event.type == pygame.KEYDOWN:
                if event.key == pygame.K_SPACE:
                    projectile = Projectile(player.rect.x, player.rect.y)
                    projectiles.add(projectile)
                    all_sprites.add(projectile)

        if random.randint(0, 50) == 0:
            enemy = Enemy()
            enemies.add(enemy)
            all_sprites.add(enemy)

        player.update()
        enemies.update()
        projectiles.update()

        for projectile in pygame.sprite.groupcollide(projectiles, enemies, True, True).keys():
            player.score += 1
            print(f"Score: {player.score}")

        if pygame.sprite.spritecollide(player, enemies, False):
            print("Game Over!")
            running = False

        screen.fill((0,0,0))
        all_sprites.draw(screen)
        pygame.display.flip()
        clock.tick(60)

    pygame.quit()

if __name__ == "__main__":
    game()
Categories
AI Agents

Crew AI Screenplay Writer

git clone https://github.com/joaomdmoura/crewAI-examples/
cd crewAI-examples/screenplay_writer
pip install langchain-community langchain crewai langchain-openai langchain-core langchain_mistralai
export MISTRAL_API_KEY=xxxxxxxxxxxxxxx

Dataset: https://www.kaggle.com/datasets/crawford/20-newsgroups/data?select=rec.sport.hockey.txt

python screenplay_writer.py
Categories
TaskWeaver

TaskWeaver DuckDuckGo Browserless

internet_search.py

import requests
from duckduckgo_search import DDGS
from taskweaver.plugin import Plugin, register_plugin
import os, json
from unstructured.partition.html import partition_html

@register_plugin
class InternetSearchPlugin(Plugin):
    def __call__(self, query: str, max_results=2): 
        with DDGS() as ddgs:
            results = [r for r in ddgs.text(query, max_results=max_results)]
            scraped_results = []
            for result in results:
                url = self.sanitize_url(result.get('href'))
                scraped_content = self.scrape_website(url)
                scraped_results.append({'url': url, 'content': scraped_content})
            return scraped_results

    @staticmethod
    def sanitize_url(url):
        """Sanitize the URL by removing any trailing slashes."""
        return url.rstrip('/') if url else url

    def scrape_website(self, website: str):
        """Just pass a string with
        only the full url, no need for a final slash `/`, eg: https://google.com or https://clearbit.com/about-us"""
        sanitized_url = self.sanitize_url(website)
        url = f"https://chrome.browserless.io/content?token={os.environ['BROWSERLESS_API_KEY']}"
        payload = json.dumps({"url": sanitized_url})
        headers = {'cache-control': 'no-cache', 'content-type': 'application/json'}
        response = requests.request("POST", url, headers=headers, data=payload)
        elements = partition_html(text=response.text)
        content = "\n\n".join([str(el) for el in elements])
        content = [content[i:i + 8000] for i in range(0, len(content), 8000)]
        return content

internet_search.yaml

name: internet_search
enabled: true
required: false
description: >-
  The InternetSearchPlugin performs internet searches using DuckDuckGo and scrapes the content of the search results.

parameters:
  - name: query
    type: str
    required: true
    description: The search query for retrieving and scraping internet search results.

returns:
  - name: search_results
    type: list
    description: >-
      A list of dictionaries containing the URL and scraped content of each search result.
Categories
TaskWeaver

TaskWeaver Browserless Plugin

scrape_website.py

import os
import json
import requests
from taskweaver.plugin import Plugin, register_plugin
from unstructured.partition.html import partition_html

@register_plugin
class ScrapePlugin(Plugin):
    def __call__(self, website: str):
        url = f"https://chrome.browserless.io/content?token={os.environ['BROWSERLESS_API_KEY']}"
        payload = json.dumps({"url": website})
        headers = {'cache-control': 'no-cache', 'content-type': 'application/json'}
        response = requests.request("POST", url, headers=headers, data=payload)
        elements = partition_html(text=response.text)
        content = "\n\n".join([str(el) for el in elements])
        return content

scrape_website.yaml

name: scrape_website
enabled: true
required: false
description: >
  The ScrapePlugin scrapes website content.
  Pass a URL to receive the raw content of the website.

parameters:
  - name: website
    type: str
    required: true
    description: The full URL of the website to scrape.

returns:
  - name: scraped_content
    type: str
    description: >
      A string containing the raw content of the scraped website.
Categories
TaskWeaver

TaskWeaver DuckDuckGo Search Plugin

internet_search.py

from duckduckgo_search import DDGS
from taskweaver.plugin import Plugin, register_plugin

@register_plugin
class InternetSearchPlugin(Plugin):
    def __call__(self, query: str, max_results=10): 
        with DDGS() as ddgs:
            results = [r for r in ddgs.text(query, max_results=max_results)]
            return results

internet_search.yaml

name: internet_search
enabled: true
required: false
description: >
  The InternetSearchPlugin connects to the DuckDuckGo API to perform internet searches.
  It retrieves and returns search results in JSON format based on the provided query.

parameters:
  - name: query
    type: str
    required: true
    description: The search query for retrieving internet search results.

returns:
  - name: search_results
    type: dict
    description: >
      A dictionary containing the search results in JSON format.
Categories
TaskWeaver

TaskWeaver Arxiv Latest Papers Plugin

latest_papers.yaml

name: latest_papers
enabled: true
required: false
description: >-
  The LatestPapersPlugin connects to the arXiv API to fetch information about the latest papers on a specified topic.

parameters:
  - name: topic
    type: str
    required: true
    description: The topic for which the latest papers are to be retrieved.

returns:
  - name: papers_data
    type: str
    description: >-
      A string containing the latest papers' information on the specified topic, returned as XML data from arXiv.

latest_papers.py

import requests
from taskweaver.plugin import Plugin, register_plugin

@register_plugin
class LatestPapersPlugin(Plugin):
    def __call__(self, topic: str): 
        url = "http://export.arxiv.org/api/query"
        params = {
            "search_query": f"all:{topic}",
            "sortBy": "submittedDate",
            "sortOrder": "descending",
            "max_results": 5
        }
        response = requests.get(url, params=params)
        return response.text

Categories
TaskWeaver

TaskWeaver Beginners Guide

git clone https://github.com/microsoft/TaskWeaver
cd TaskWeaver
conda create -n taskweaver python=3.11
conda activate taskweaver
pip install -r requirements.txt
cd project

taskweaver_config.json

{
  "llm.api_base": "https://api.openai.com/v1",
  "llm.api_key": "sk-xxxxxxxxxxxxxxxxxxxx",
  "llm.model": "gpt-3.5-turbo-1106"
}

Text Generation Web UI

Models

TheBloke/Orca-2-7B-GGUF
orca-2-7b.Q4_K_M.gguf

Config

{
  "llm.api_base": "http://0.0.0.0:5000/v1",
  "llm.api_key": "null",
  "llm.model": "orca2",
  "llm.response" : "text"
}
Categories
AutoGen

AutoGen Travel Agents

Travel Agent Manager

You are a helpful assistant that can suggest a travel itinerary for a user. You are the primary coordinator who will receive suggestions or advice from other agents (local_assistant, language_assistant). You must ensure that the finally plan integrates the suggestions from other agents or team members. 

Expand this guide into a a full 7-day travel itinerary with detailed per-day plans, including weather forecasts, places to eat, packing suggestions, and a budget breakdown. You MUST suggest actual places to visit, actual hotels to stay and actual restaurants to go to. This itinerary should cover all aspects of the trip, from arrival to departure, integrating the city guide information with practical travel logistics. Your final answer MUST be a complete expanded travel plan, formatted as markdown, encompassing a daily schedule, anticipated weather conditions, recommended clothing and items to pack, and a detailed budget, ensuring THE BEST TRIP EVER, Be specific and give it a reason why you picked # up each place, what make them special!

YOUR FINAL RESPONSE MUST BE THE COMPLETE PLAN that ends with the word TERMINATE. 

City Selection Expert

Analyse and select the best city for the trip based on specific criteria such as weather patterns, seasonal events, and travel costs. Use the search_internet skill to know about weather patterns, seasonal events, and travel costs. This task involves comparing multiple cities, considering factors like current weather conditions, upcoming cultural or seasonal events, and overall travel expenses. Your final answer must be a detailed report on the chosen city, and everything you found out about it, including the actual flight costs, weather forecast and attractions.

Local Agent

As a local expert on this city you must compile an in-depth guide for someone traveling there and wanting to have THE BEST trip ever! Gather information about key attractions, local customs, special events, and daily activity recommendations using search_internet skill. Find the best spots to go to, the kind of place only a local would know. This guide should provide a thorough overview of what the city has to offer, including hidden gems, cultural hotspots, must-visit landmarks, weather forecasts, and high level costs. The final answer must be a comprehensive city guide, rich in cultural insights and practical tips, tailored to enhance the travel experience.

Search Tool

from duckduckgo_search import DDGS

def search_internet(query, max_results=1):
    """
    Search Skill
    Search Tool
    Search Internet Tool
    Search Internet Skill
    duckduckgo_search tool
    Performs a search on DuckDuckGo using the duckduckgo_search package.

    :param query: str, the search query.
    :param max_results: int, maximum number of results to return.
    :return: list, search results.
    """
    with DDGS() as ddgs:
        return [r for r in ddgs.text(query, max_results=max_results)]

# Example usage:
# results = search_internet('example query')
# print(results)


Categories
AI Agents

Crew AI Business Product Launch Agents

import os
from crewai import Agent, Task, Crew, Process
from langchain.tools import DuckDuckGoSearchRun
from langchain.agents import Tool
import gradio as gr

duckduckgo_search = DuckDuckGoSearchRun()

def create_crewai_setup(product_name):
    # Define Agents
    market_research_analyst = Agent(
        role="Market Research Analyst",
        goal=f"""Analyze the market demand for {product_name} and 
                 suggest marketing strategies""",
        backstory=f"""Expert at understanding market demand, target audience, 
                      and competition for products like {product_name}. 
                      Skilled in developing marketing strategies 
                      to reach a wide audience.""",
        verbose=True,
        allow_delegation=True,
        tools=[duckduckgo_search],
    )
    
    technology_expert = Agent(
        role="Technology Expert",
        goal=f"Assess technological feasibilities and requirements for producing high-quality {product_name}",
        backstory=f"""Visionary in current and emerging technological trends, 
                      especially in products like {product_name}. 
                      Identifies which technologies are best suited 
                      for different business models.""",
        verbose=True,
        allow_delegation=True,
    )
    
    business_consultant = Agent(
        role="Business Development Consultant",
        goal=f"""Evaluate the business model for {product_name}, 
               focusing on scalability and revenue streams""",
        backstory=f"""Seasoned in shaping business strategies for products like {product_name}. 
                      Understands scalability and potential 
                      revenue streams to ensure long-term sustainability.""",
        verbose=True,
        allow_delegation=True,
    )
    
    # Define Tasks
    task1 = Task(
        description=f"""Analyze the market demand for {product_name}. Current month is Jan 2024.
                        Write a report on the ideal customer profile and marketing 
                        strategies to reach the widest possible audience. 
                        Include at least 10 bullet points addressing key marketing areas.""",
        agent=market_research_analyst,
    )
    
    task2 = Task(
        description=f"""Assess the technological aspects of manufacturing 
                    high-quality {product_name}. Write a report detailing necessary 
                    technologies and manufacturing approaches. 
                    Include at least 10 bullet points on key technological areas.""",
        agent=technology_expert,
    )
    
    task3 = Task(
        description=f"""Summarize the market and technological reports 
                    and evaluate the business model for {product_name}. 
                    Write a report on the scalability and revenue streams 
                    for the product. Include at least 10 bullet points 
                    on key business areas. Give Business Plan, 
                    Goals and Timeline for the product launch. Current month is Jan 2024.""",
        agent=business_consultant,
    )
    
    # Create and Run the Crew
    product_crew = Crew(
        agents=[market_research_analyst, technology_expert, business_consultant],
        tasks=[task1, task2, task3],
        verbose=2,
        process=Process.sequential,
    )
    
    crew_result = product_crew.kickoff()
    return crew_result

# Gradio interface
def run_crewai_app(product_name):
    crew_result = create_crewai_setup(product_name)
    return crew_result

iface = gr.Interface(
    fn=run_crewai_app, 
    inputs="text", 
    outputs="text",
    title="CrewAI Business Product Launch",
    description="Enter a product name to analyze the market and business strategy."
)

iface.launch()

Output

Business Plan

  1. Product Development: Develop a high-quality, ergonomic laptop stand that caters to the needs of the modern consumer. The stand should be adjustable, portable, compatible with different laptop sizes, and made from durable, eco-friendly materials.
  2. Market Penetration: Enter the laptop stand market, valued at USD 300.53 million in 2022 and projected to reach USD 425.12 million by 2028.
  3. Competition: Differentiate from competitors like Upryze, Nulaxy, Roost, iVoler, and Twelve South Curve Flex through innovative design, superior material, and added features.
  4. Collaboration: Collaborate with laptop brands and influencers to reach potential customers.
  5. Marketing: Market the product highlighting its ergonomic benefits and conduct targeted campaigns understanding the behaviour and preferences of laptop users.

Goals:

  1. Product Development: Finalize the laptop stand design with all features by Q2 2024.
  2. Prototype Testing: Conduct prototype testing and incorporate feedback by Q3 2024.
  3. Manufacturing: Start mass production by Q4 2024.
  4. Market Entry: Launch the product by Q1 2025.
  5. Market Penetration: Achieve a 5% market share by Q4 2025.

Timeline:

  1. Q2 2024: Finalise the laptop stand design.
  2. Q3 2024: Conduct prototype testing.
  3. Q4 2024: Start mass production.
  4. Q1 2025: Launch the product in the market.
  5. Q4 2025: Achieve a 5% market share.