jgravelle / Groqqle

Groqqle is a powerful web search and content summarization tool built with Python, leveraging Groq's LLM API for advanced natural language processing. It offers customizable web and news searches, image analysis, and adaptive content summaries, making it ideal for researchers, developers, and anyone seeking enhanced information retrieval.
https://j.gravelle
106 stars 41 forks source link
free free-web-search free-web-search-api google groq-api nlp web-search-api

Groqqle 2.1: Your Free AI-Powered Search Engine and Content Generator

Groqqle Logo

Groqqle 2.1 is a revolutionary, free AI web search and API that instantly returns ORIGINAL content derived from source articles, websites, videos, and even foreign language sources, for ANY target market of ANY reading comprehension level! It combines the power of large language models with advanced web and news search capabilities, offering a user-friendly web interface, a robust API, and now a powerful Groqqle_web_tool for seamless integration into your projects.

Developers can instantly incorporate Groqqle into their applications, providing a powerful tool for content generation, research, and analysis across various domains and languages.

License: MIT Python Version

🌟 Features

Groqqle Features

πŸš€ Why Choose Groqqle 2.1?

Groqqle 2.1 stands out as a powerful tool for developers, researchers, content creators, and businesses:

Whether you're building a content aggregation platform, a research tool, or an AI-powered writing assistant, Groqqle 2.1 provides the flexibility and power you need to deliver outstanding results.

πŸ› οΈ Installation

  1. Clone the repository:

    git clone https://github.com/jgravelle/Groqqle.git
    cd Groqqle
  2. Set up a Conda environment:

    conda create --name groqqle python=3.11
    conda activate groqqle
  3. Install the required packages:

    pip install -r requirements.txt
  4. Set up your environment variables: Create a .env file in the project root and add your Groq API key:

    GROQ_API_KEY=your_api_key_here
  5. Install PocketGroq:

    pip install pocketgroq

πŸš€ Usage

Web Interface

  1. Start the Groqqle application using Streamlit:

    streamlit run Groqqle.py
  2. Open your web browser and navigate to the URL provided in the console output (typically http://localhost:8501).

  3. Enter your search query in the search bar.

  4. Choose between "Web" and "News" search using the radio buttons.

  5. Click "Groqqle Search" or press Enter.

  6. View your results! Toggle the "JSON Results" checkbox to see the raw JSON data.

  7. For both web and news results, you can click the "πŸ“" button next to each result to get a summary of the article or webpage.

Groqqle Web Interface

API

The Groqqle API allows you to programmatically access search results for both web and news. Here's how to use it:

  1. Start the Groqqle application in API mode:

    python Groqqle.py api --num_results 20 --max_tokens 4096
  2. The API server will start running on http://127.0.0.1:5000.

  3. Send a POST request to http://127.0.0.1:5000/search with the following JSON body:

    {
     "query": "your search query",
     "num_results": 20,
     "max_tokens": 4096,
     "search_type": "web"  // Use "web" for web search or "news" for news search
    }

    Note: The API key is managed through environment variables, so you don't need to include it in the request.

  4. The API will return a JSON response with your search results in the order: title, description, URL, source, and timestamp (for news results).

Example using Python's requests library:

import requests

url = "http://127.0.0.1:5000/search"
data = {
    "query": "Groq",
    "num_results": 20,
    "max_tokens": 4096,
    "search_type": "news"  # Change to "web" for web search
}
response = requests.post(url, json=data)
results = response.json()
print(results)

Make sure you have set the GROQ_API_KEY in your environment variables or .env file before starting the API server.

Groqqle API Usage

Groqqle_web_tool

The new Groqqle_web_tool allows you to integrate Groqqle's powerful search and content generation capabilities directly into your Python projects. Here's how to use it:

  1. Import the necessary modules:

    from pocketgroq import GroqProvider
    from groqqle_web_tool import Groqqle_web_tool
  2. Initialize the GroqProvider and Groqqle_web_tool:

    groq_provider = GroqProvider(api_key="your_groq_api_key_here")
    groqqle_tool = Groqqle_web_tool(api_key="your_groq_api_key_here")
  3. Define the tool for PocketGroq:

    tools = [
       {
           "type": "function",
           "function": {
               "name": "groqqle_web_search",
               "description": "Perform a web search using Groqqle",
               "parameters": {
                   "type": "object",
                   "properties": {
                       "query": {
                           "type": "string",
                           "description": "The search query"
                       }
                   },
                   "required": ["query"]
               }
           }
       }
    ]
    
    def groqqle_web_search(query):
       results = groqqle_tool.run(query)
       return results
  4. Use the tool in your project:

    user_message = "Search for the latest developments in quantum computing"
    system_message = "You are a helpful assistant. Use the Groqqle web search tool to find information."
    
    response = groq_provider.generate(
       system_message,
       user_message,
       tools=tools,
       tool_choice="auto"
    )
    
    print(response)

This new tool allows for seamless integration of Groqqle's capabilities into your Python projects, enabling powerful search and content generation without the need for a separate API or web interface.

πŸ”„ AI Providers

While Groqqle is optimized for use with Groq's lightning-fast inference capabilities, we've also included stubbed-out provider code for Anthropic. This demonstrates how easily other AI providers can be integrated into the system.

To use a different provider, you can modify the provider_name parameter when initializing the Web_Agent in the Groqqle.py file.

πŸŽ›οΈ Configuration Options

Groqqle now supports the following configuration options:

These options can be set when running the application, making API requests, or initializing the Groqqle_web_tool.

🀝 Contributing

We welcome contributions to Groqqle! Here's how you can help:

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Please make sure to update tests as appropriate and adhere to the Code of Conduct.

πŸ“„ License

Distributed under the MIT License. See LICENSE file for more information. Mention J. Gravelle in your docs (README, etc.) and/or code. He's kind of full of himself.

πŸ“ž Contact

J. Gravelle - j@gravelle.us - https://j.gravelle.us

Project Link: https://github.com/jgravelle/Groqqle

πŸ™ Acknowledgements

Groqqle Footer

= = = = = = = = =

MAC INSTALLATION INSTRUCTIONS (untested, by request)

To install Groqqle 2.1 on your Mac, follow the step-by-step guide below. This installation process involves setting up a Python environment using Conda, installing necessary packages, and configuring environment variables.


Prerequisites

Before starting, ensure you have the following installed on your Mac:

  1. Git: For cloning the Groqqle repository.
  2. Conda (Anaconda or Miniconda): For managing Python environments.
  3. Python 3.11: Groqqle requires Python 3.11 (Conda will handle this).
  4. Groq API Key: You'll need a valid API key from Groq.

Step-by-Step Installation Guide

1. Install Git (if not already installed)

Check if Git is installed:

Open Terminal (Finder > Applications > Utilities > Terminal) and run:

git --version

Alternatively, install Git using Homebrew:

If you prefer using Homebrew (a package manager for macOS):

  1. Install Homebrew (if not already installed):

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  2. Install Git via Homebrew:

    brew install git

2. Install Conda (Anaconda or Miniconda)

Groqqle uses Conda to manage its Python environment.

Option A: Install Miniconda (Recommended for simplicity)

  1. Download Miniconda Installer:

    • Go to the Miniconda installation page.
    • Download the macOS installer matching your Mac's architecture:
      • Intel Macs: Miniconda3-latest-MacOSX-x86_64.sh
      • Apple Silicon (M1/M2): Miniconda3-latest-MacOSX-arm64.sh
  2. Run the Installer:

    # Navigate to your Downloads folder
    cd ~/Downloads
    
    # Run the installer (replace with your downloaded file's name)
    bash Miniconda3-latest-MacOSX-x86_64.sh  # For Intel Macs
    # or
    bash Miniconda3-latest-MacOSX-arm64.sh   # For M1/M2 Macs
  3. Follow the On-Screen Prompts:

    • Press Enter to proceed.
    • Type yes to agree to the license agreement.
    • Press Enter to confirm the installation location (default is recommended).
    • Type yes to initialize Conda.
  4. Restart Terminal or Source Conda:

    # For Bash shell
    source ~/.bash_profile
    
    # For Zsh shell (default on macOS Catalina and later)
    source ~/.zshrc

Option B: Install Anaconda

If you prefer a full Anaconda installation (larger download), download it from the Anaconda distribution page.

3. Clone the Groqqle Repository

  1. Open Terminal and navigate to your desired directory:

    cd ~  # or wherever you want to clone the repository
  2. Clone the Repository:

    git clone https://github.com/jgravelle/Groqqle.git
  3. Navigate into the Project Directory:

    cd Groqqle

4. Create and Activate a Conda Environment

  1. Create a New Environment with Python 3.11:

    conda create --name groqqle python=3.11
  2. Activate the Environment:

    conda activate groqqle
    • Note: If you receive an error about activation, initialize Conda for your shell:

      conda init

      Then restart Terminal or source your shell configuration:

      source ~/.bash_profile  # For Bash
      source ~/.zshrc         # For Zsh

5. Install the Required Packages

  1. Install Dependencies from requirements.txt:

    pip install -r requirements.txt
    • Troubleshooting:
      • If you encounter errors, especially on M1/M2 Macs, see the Apple Silicon Compatibility section below.

6. Set Up Your Environment Variables

  1. Create a .env File in the Project Root:

    touch .env
  2. Add Your Groq API Key:

    Open the .env file with a text editor:

    open .env  # Opens the file in the default text editor

    Add the following line (replace your_api_key_here with your actual API key):

    GROQ_API_KEY=your_api_key_here
  3. Save and Close the File.

    • Alternatively, set the environment variable in Terminal (session-specific):

      export GROQ_API_KEY=your_api_key_here

7. Install PocketGroq

  1. Install via Pip:

    pip install pocketgroq

8. Verify the Installation

Option A: Run the Web Interface

  1. Start the Application:

    streamlit run Groqqle.py
  2. Access the Interface:

    • Open the URL provided in the Terminal output (typically http://localhost:8501) in your web browser.

Option B: Run the API Server

  1. Start the API Server:

    python Groqqle.py api --num_results 20 --max_tokens 4096
  2. Test the API:

    • The API will be running at http://127.0.0.1:5000.
    • You can send POST requests to this endpoint as per the documentation.

Apple Silicon Compatibility (M1/M2 Macs)

Some Python packages may have compatibility issues on Apple Silicon. Here's how to address them:

  1. Install Rosetta 2 (if not already installed):

    softwareupdate --install-rosetta
  2. Run Terminal in Rosetta Mode:

    • Locate Terminal App:
      • Go to Applications > Utilities.
    • Duplicate Terminal:
      • Right-click on Terminal and select Duplicate.
      • Rename the duplicated app to Terminal Rosetta.
    • Enable Rosetta for the Duplicated Terminal:
      • Right-click Terminal Rosetta > Get Info.
      • Check the box "Open using Rosetta".
    • Use Terminal Rosetta:
      • Open Terminal Rosetta and proceed with the installation steps.
  3. Create an x86_64 Conda Environment:

    CONDA_SUBDIR=osx-64 conda create --name groqqle python=3.11
    conda activate groqqle
  4. Proceed with Installation Steps 5 to 8.


Additional Notes


Using Groqqle

Refer to the Usage section in the documentation for detailed instructions on:


Common Issues and Solutions


Support


By following these steps, you should have Groqqle 2.1 installed and running on your Mac. If you need further assistance, feel free to ask!