Skip to main content

Quercle tools for LlamaIndex - AI-powered web fetch and search

Project description

llama-index-tools-quercle

Quercle tools for LlamaIndex - AI-powered web fetch and search.

Installation

pip install llama-index-tools-quercle

Quick Start

Using QuercleToolSpec (Recommended)

from llama_index.tools.quercle import QuercleToolSpec
from llama_index.core.agent import ReActAgent
from llama_index.llms.openai import OpenAI

# Create the tool spec
quercle = QuercleToolSpec(api_key="qk_...")  # Or set QUERCLE_API_KEY env var

# Get all tools and create an agent
agent = ReActAgent.from_tools(quercle.to_tool_list(), llm=OpenAI())

# Use the agent
response = agent.chat("Search for the latest Python news")
print(response)

Using Standalone Tools

from llama_index.tools.quercle import create_quercle_fetch_tool, create_quercle_search_tool

# Create individual tools
fetch_tool = create_quercle_fetch_tool(api_key="qk_...")
search_tool = create_quercle_search_tool(api_key="qk_...")

# Use directly
result = fetch_tool.call(url="https://example.com", prompt="Summarize this page")
result = search_tool.call(query="Python web frameworks")

Direct Usage

from llama_index.tools.quercle import QuercleToolSpec

quercle = QuercleToolSpec()

# Fetch and analyze a web page
content = quercle.fetch(
    url="https://docs.python.org/3/whatsnew/3.12.html",
    prompt="List the main new features"
)

# Search the web
results = quercle.search(
    query="best practices for Python async programming",
    allowed_domains=["python.org", "realpython.com"]
)

Tools

fetch

Fetch a web page and analyze its content using AI.

Parameters:

  • url (str): The URL to fetch and analyze
  • prompt (str): Instructions for how to analyze the page content

Returns: AI-processed analysis of the page content

search

Search the web and get AI-synthesized answers with citations.

Parameters:

  • query (str): The search query
  • allowed_domains (list[str], optional): Only include results from these domains
  • blocked_domains (list[str], optional): Exclude results from these domains

Returns: AI-synthesized answer with source citations

Async Support

Both tools support async operations:

import asyncio
from llama_index.tools.quercle import QuercleToolSpec

async def main():
    quercle = QuercleToolSpec()

    # Async fetch
    content = await quercle.afetch(
        url="https://example.com",
        prompt="Summarize this page"
    )

    # Async search
    results = await quercle.asearch(query="Python news")

asyncio.run(main())

Configuration

API Key

Set your Quercle API key either:

  1. Pass directly: QuercleToolSpec(api_key="qk_...")
  2. Environment variable: export QUERCLE_API_KEY=qk_...

Timeout

Configure request timeout in seconds:

quercle = QuercleToolSpec(timeout=60.0)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_tools_quercle-0.1.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_index_tools_quercle-0.1.0-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file llama_index_tools_quercle-0.1.0.tar.gz.

File metadata

File hashes

Hashes for llama_index_tools_quercle-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0cf1cb93d51b642943f66c0db75c1e3878ebf0cc7aed92393a95f4b917cb5871
MD5 417ecd6c0c7e79161d39f6dd1f45ac48
BLAKE2b-256 587d2e6ebcb78ecb293b01527b562ad916ac73ced9deb303cf68fdec9a5522f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for llama_index_tools_quercle-0.1.0.tar.gz:

Publisher: publish.yml on quercledev/quercle-llama-index

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llama_index_tools_quercle-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_index_tools_quercle-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 134b8a90d058a65e126ee3f76d88c51303f767a0a89e941947ce1bef9cce9ecd
MD5 e0aa22d83a28db3515eefacaa842973c
BLAKE2b-256 f4e8e2e9d3baab5eea6ec9a72fa74b37c86e72b64a80305df15b9623e74c45f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for llama_index_tools_quercle-0.1.0-py3-none-any.whl:

Publisher: publish.yml on quercledev/quercle-llama-index

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page