Skip to main content

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


Download files

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

Source Distribution

langchain_querit-0.0.2.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

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

langchain_querit-0.0.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

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

Hashes for langchain_querit-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8e2d4c374430019f18d339cf841d4976752fc2eeef451da2522d81225a13d850
MD5 52dcbc1cde0aaec94bed2a17ac63fb3f
BLAKE2b-256 da9032489e58e3a96f45ae996137bb8f9dfd4b34557ba5e2a0d1af90bfd7723a

See more details on using hashes here.

Provenance

The following attestation bundles were made for langchain_querit-0.0.2.tar.gz:

Publisher: publish.yml on querit-ai/langchain-querit

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

File details

Details for the file langchain_querit-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_querit-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 33190fbe0066f9e75989917b7227881ac2be20dfabec9c98fa8143696d3972e1
MD5 439746f061e3cf3b4f45c96a3b140200
BLAKE2b-256 5d46de57f973d9da80cb32b90e78d63282ec324594da3b32f3d2244eed5c0fd3

See more details on using hashes here.

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

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