A LangChain tool for Querit search functionality
Project description
LangChain WebSearch Tool
A powerful LangChain tool for web search functionality using Querit Search API.
🔍 Features
- Querit Search API Integration: Powered by Querit Search API
- API Key Management: Secure API key handling with environment variables
- LangChain Integration: Seamlessly integrates with LangChain agents and chains
- Structured Results: Returns formatted search results with metadata
- Async Support: Asynchronous version available
- Flexible Configuration: Customizable search parameters
🚀 Quick Start
Installation
pip install langchain-querit
Basic Usage
import os
from langchain_websearch import WebSearchTool
# Set your API key (recommended: use environment variables)
os.environ["QUERIT_API_KEY"] = "your-querit-api-key"
# Initialize the tool
search_tool = WebSearchTool()
# Perform a search
results = search_tool._run("latest Python programming news")
print(results)
Advanced Configuration
from langchain_websearch import WebSearchTool
# Configure with specific parameters
search_tool = WebSearchTool(
num_results=5 # Number of results to return
)
# Use with custom query
results = search_tool._run("machine learning tutorials")
print(results)
🧪 Testing
To run tests with your API key:
export QUERIT_API_KEY="your-querit-api-key" && python3 -m pytest tests/
For verbose test output:
export QUERIT_API_KEY="your-querit-api-key" && python3 tests/test_basic.py
⚙️ Configuration
Environment Variables
QUERIT_API_KEY: Your Querit Search API key (required)
WebSearchTool Parameters
num_results: Number of results to return (default: 10, range: 1-50)region: Search region/language (default: "en-US", currently not used)safe_search: Enable safe search filtering (default: True, currently not used)
📚 Documentation
For full API reference and examples, see the examples directory.
Example Usage
Check examples/basic_usage.py for complete usage examples including LangChain agent integration.
🔧 Development
Development Setup
# Clone the repository
git clone https://github.com/KKKPJSKEY/langchain-querit.git
cd langchain-querit
# Install in development mode
pip install -e ".[dev]"
Running Tests
# Run all tests
export QUERIT_API_KEY="your-querit-api-key" && pytest tests/
# Run with coverage
export QUERIT_API_KEY="your-querit-api-key" && pytest --cov=src tests/
# Run specific test file
export QUERIT_API_KEY="your-querit-api-key" && python3 tests/test_basic.py
See CONTRIBUTING.md for detailed development guidelines.
🤝 Contributing
Contributions are welcome! Please read CONTRIBUTING.md for guidelines on how to contribute.
📜 License
MIT License - See LICENSE for details.
🔗 Links
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_querit-0.0.2.tar.gz.
File metadata
- Download URL: langchain_querit-0.0.2.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8e2d4c374430019f18d339cf841d4976752fc2eeef451da2522d81225a13d850
|
|
| MD5 |
52dcbc1cde0aaec94bed2a17ac63fb3f
|
|
| BLAKE2b-256 |
da9032489e58e3a96f45ae996137bb8f9dfd4b34557ba5e2a0d1af90bfd7723a
|
Provenance
The following attestation bundles were made for langchain_querit-0.0.2.tar.gz:
Publisher:
publish.yml on querit-ai/langchain-querit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_querit-0.0.2.tar.gz -
Subject digest:
8e2d4c374430019f18d339cf841d4976752fc2eeef451da2522d81225a13d850 - Sigstore transparency entry: 995696859
- Sigstore integration time:
-
Permalink:
querit-ai/langchain-querit@d5460c989133da3bc75b18e7e1c304638208c60b -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/querit-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d5460c989133da3bc75b18e7e1c304638208c60b -
Trigger Event:
release
-
Statement type:
File details
Details for the file langchain_querit-0.0.2-py3-none-any.whl.
File metadata
- Download URL: langchain_querit-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.0 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 |
33190fbe0066f9e75989917b7227881ac2be20dfabec9c98fa8143696d3972e1
|
|
| MD5 |
439746f061e3cf3b4f45c96a3b140200
|
|
| BLAKE2b-256 |
5d46de57f973d9da80cb32b90e78d63282ec324594da3b32f3d2244eed5c0fd3
|
Provenance
The following attestation bundles were made for langchain_querit-0.0.2-py3-none-any.whl:
Publisher:
publish.yml on querit-ai/langchain-querit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
langchain_querit-0.0.2-py3-none-any.whl -
Subject digest:
33190fbe0066f9e75989917b7227881ac2be20dfabec9c98fa8143696d3972e1 - Sigstore transparency entry: 995696864
- Sigstore integration time:
-
Permalink:
querit-ai/langchain-querit@d5460c989133da3bc75b18e7e1c304638208c60b -
Branch / Tag:
refs/tags/v0.0.2 - Owner: https://github.com/querit-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d5460c989133da3bc75b18e7e1c304638208c60b -
Trigger Event:
release
-
Statement type: