Groqqle API Guide for Developers banner
jgravelle jgravelle

Groqqle API Guide for Developers

Development community intermediate

Description

This guide demonstrates how to use Groqqle's API functionalities for developers without the GUI interface.

Installation

Terminal
claude install-skill https://github.com/jgravelle/Groqqle

README

Groqqle API Guide for Developers

This guide demonstrates how to use Groqqle's API functionalities for developers without the GUI interface.

Overview

Groqqle offers two main approaches for developers to integrate search capabilities into their applications:

    undefined

Method 1: Using the HTTP REST API

Starting the API Server

To use Groqqle's API server, run:

python Groqqle.py api --num_results 20 --max_tokens 4096

The API server will start running on `http://127.0.0.1:5000`.

Making API Requests

You can send POST requests to the `/search` endpoint with the following parameters:

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

Python Example

import requests
import json

def groqqle_search(query, search_type="web", num_results=10, max_tokens=4096):
    """Function to perform a search using Groqqle's API."""
    api_url = "http://127.0.0.1:5000/search"
    
    payload = {
        "query": query,
        "num_results": num_results,
        "max_tokens": max_tokens,
        "search_type": search_type  # "web" or "news"
    }
    
    response = requests.post(api_url, json=payload)
    response.raise_for_status()
    return response.json()

# Example usage
results = groqqle_search("quantum computing breakthroughs", search_type="web")
for result in results:
    print(f"Title: {result['title']}")
    print(f"URL: {result['url']}")
    print(f"Description: {result['description'][:100]}...")
    print("")

Response Format

The API returns a JSON array of results, each containing:

    undefined

Method 2: Direct Python Integration

You can integrate Groqqle directly into your Python applications without starting a separate server by using the `Groqqle_web_tool` class.

Basic Usage

from Groqqle_web_tool import Groqqle_web_tool

# Initialize the tool with your API key and configuration
groqqle_tool = Groqqle_web_tool(
    api_key='your_groq_api_key_here',
    provider_name='groq',  # Can also use 'anthropic' if configured
    num_results=10,        # Number of search results to return
    max_tokens=4096,       # Max tokens for AI responses
    model='llama3-8b-8192', # Model to use
    temperature=0.0,        # Temperature setting for generation
    comprehension_grade=8   # Target reading level (1-15)
)

# Perform a web search
query = 'latest advancements in artificial intelligence'
results = groqqle_tool.run(query)

# Process the search results
for result in results:
    print(f"Title: {result['title']}")
    print(f"URL: {result['url']}")
    pri