LangChain tools for Quercle web search and URL fetching
Project description
quercle-langchain
LangChain tools for Quercle web search and URL fetching.
Installation
uv add langchain-quercle
Or with pip:
pip install langchain-quercle
Quick Start
from quercle_langchain import QuercleSearchTool, QuercleFetchTool
# Initialize tools (uses QUERCLE_API_KEY env var by default)
search = QuercleSearchTool()
fetch = QuercleFetchTool()
# Or with explicit API key
search = QuercleSearchTool(api_key="qk_...")
fetch = QuercleFetchTool(api_key="qk_...")
Usage with LangChain Agents
from langchain.agents import initialize_agent, AgentType
from langchain_openai import ChatOpenAI
from quercle_langchain import QuercleSearchTool, QuercleFetchTool
# Initialize tools
tools = [QuercleSearchTool(), QuercleFetchTool()]
# Create agent
llm = ChatOpenAI(model="gpt-4")
agent = initialize_agent(
tools=tools,
llm=llm,
agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION,
)
# Run the agent
result = agent.run("Search for the latest Python release and summarize it")
Direct Tool Usage
Search
from quercle_langchain import QuercleSearchTool
search = QuercleSearchTool()
# Basic search
result = search.invoke({"query": "What is TypeScript?"})
print(result)
# With domain filtering
result = search.invoke({
"query": "machine learning tutorials",
"allowed_domains": ["*.edu", "*.org"],
"blocked_domains": ["ads.com"],
})
Fetch
from quercle_langchain import QuercleFetchTool
fetch = QuercleFetchTool()
result = fetch.invoke({
"url": "https://docs.python.org/3/whatsnew/3.12.html",
"prompt": "Summarize the key new features in bullet points",
})
print(result)
Async Usage
Both tools support async operations:
import asyncio
from quercle_langchain import QuercleSearchTool, QuercleFetchTool
async def main():
search = QuercleSearchTool()
fetch = QuercleFetchTool()
# Async search
result = await search.ainvoke({"query": "async Python programming"})
print(result)
# Async fetch
result = await fetch.ainvoke({
"url": "https://example.com",
"prompt": "Extract main topics",
})
print(result)
asyncio.run(main())
Configuration
Environment Variable
Set your API key as an environment variable:
export QUERCLE_API_KEY=qk_your_api_key_here
Tool Parameters
Both tools accept these optional parameters:
api_key: Your Quercle API key (falls back toQUERCLE_API_KEYenv var)timeout: Request timeout in seconds
tool = QuercleSearchTool(
api_key="qk_...",
timeout=60.0,
)
Tool Descriptions
QuercleSearchTool
- Name:
search - Description: Search the web and get AI-synthesized answers with citations
- Arguments:
query(required): The search queryallowed_domains(optional): List of domains to include (e.g.,["*.edu"])blocked_domains(optional): List of domains to exclude
QuercleFetchTool
- Name:
fetch - Description: Fetch a URL and analyze its content with AI
- Arguments:
url(required): The URL to fetchprompt(required): Instructions for content analysis
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_quercle-0.1.1.tar.gz.
File metadata
- Download URL: langchain_quercle-0.1.1.tar.gz
- Upload date:
- Size: 64.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b96cd67cecbbdc0dc1012c758fac6138f60cf96af5d30a980ca7cc0a2e3df677
|
|
| MD5 |
37b5cb05660d91bb0d79bb8ca529f69f
|
|
| BLAKE2b-256 |
9321cc4e09b8ef3c56c13b76bb79e7f913faaae888c20ebc4b5b2cf1ace60010
|
Provenance
The following attestation bundles were made for langchain_quercle-0.1.1.tar.gz:
Publisher:
publish.yml on quercledev/langchain-quercle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_quercle-0.1.1.tar.gz -
Subject digest:
b96cd67cecbbdc0dc1012c758fac6138f60cf96af5d30a980ca7cc0a2e3df677 - Sigstore transparency entry: 761048927
- Sigstore integration time:
-
Permalink:
quercledev/langchain-quercle@550fefc8f86c160675d122363bd5354d5fabb83a -
Branch / Tag:
refs/heads/master - Owner: https://github.com/quercledev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@550fefc8f86c160675d122363bd5354d5fabb83a -
Trigger Event:
push
-
Statement type:
File details
Details for the file langchain_quercle-0.1.1-py3-none-any.whl.
File metadata
- Download URL: langchain_quercle-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ed010d12ec53e241a506f43e06ec6c3e060720badb1b72def7741e5fb076ad1
|
|
| MD5 |
9de2cd7b1a9ec1c0ecd793da0d43448b
|
|
| BLAKE2b-256 |
138fdeb52320e17cd2262faeba1a70258ae62db6bfa31829d190bd43b63e44a3
|
Provenance
The following attestation bundles were made for langchain_quercle-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on quercledev/langchain-quercle
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_quercle-0.1.1-py3-none-any.whl -
Subject digest:
3ed010d12ec53e241a506f43e06ec6c3e060720badb1b72def7741e5fb076ad1 - Sigstore transparency entry: 761048944
- Sigstore integration time:
-
Permalink:
quercledev/langchain-quercle@550fefc8f86c160675d122363bd5354d5fabb83a -
Branch / Tag:
refs/heads/master - Owner: https://github.com/quercledev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@550fefc8f86c160675d122363bd5354d5fabb83a -
Trigger Event:
push
-
Statement type: