Skip to main content

Querit Content Retrieval Platform — Python SDK

The Querit Python SDK provides a convenient way to interact with the Querit Content Retrieval Platform. It offers:

  • Simple search interface for content retrieval
  • Type-annotated request/response models
  • Error handling for API responses
  • Support for various search parameters and filters

For the Querit Content Retrieval Platform, we provide a Python SDK (Querit SDK) that allows developers to easily integrate and use Querit's content search capabilities programmatically.

Installation

Requirements

  • Python 3.7+
  • pip package manager

Install from PyPI

pip install querit

Install from source

git clone https://github.com/querit-ai/querit-python.git
pip install -e .

Verify Installation

python3 -c "import querit; print(querit.__version__)"

Quick Start

Authentication

First, obtain your API key from the Querit platform.

Basic Usage

from querit import QueritClient
from querit.models.request import SearchRequest
from querit.errors import QueritError

# Initialize client
client = QueritClient(
    api_key="Bearer your_api_key_here",
    timeout=30  # Optional timeout in seconds
)

# Create search request
request = SearchRequest(
    query="chat",
    count=5,
    # Add more parameters as needed
)

try:
    # Execute search
    response = client.search(request)

    # Process results
    for item in response.results:
        print(f"Title: {item.title}")
        print(f"URL: {item.url}")
        print("-" * 50)

except QueritError as e:
    print(f"Search failed: {e}")

## Advanced Usage

### Customizing Search Requests
```python
from querit.models.request import SearchRequest

# Advanced search with filters
request = SearchRequest(
    query="machine learning",
    count=10,
    filters={
        "language": "english",
        "date_range": "d1"
    }
)

Error Handling

The SDK provides specific error classes:

  • QueritAPIError: API request failures
  • QueritAuthError: Authentication failures
  • QueritValidationError: Invalid request parameters

Best Practices

  1. Reuse client instances rather than creating new ones for each request
  2. Set appropriate timeout values for your use case
  3. Handle rate limiting by implementing retry logic
  4. Cache frequently used search results when possible

AI-Powered Search Examples

These examples combine Querit with an OpenAI-compatible LLM to answer questions using live web search results. Both require the following environment variables:

export OPENAI_API_KEY="sk-..."
export OPENAI_BASE_URL="https://api.deepseek.com/v1"   # or any OpenAI-compatible endpoint
export OPENAI_MODEL="deepseek-chat"                    # or gpt-4o-mini, qwen-max, etc.
export QUERIT_API_KEY="qr-..."

AI Search with Summarization (ai_search_summary.py)

A three-step pipeline: the LLM first rephrases the question into optimized search keywords (XML output), then Querit executes the searches, and finally the LLM synthesizes a cited answer from the results.

python examples/ai_search_summary.py "GDP Data of Laos for the Past 10 Years"

AI Search via Tool Use (ai_search_tool_use.py)

Lets the LLM drive the search through function calling (tool use). In Round 1 the model decides which queries to run; in Round 2 it synthesizes a final answer from the retrieved results. No XML parsing needed — the model controls query decomposition autonomously and can issue multiple parallel searches in a single turn.

python examples/ai_search_tool_use.py "GDP Data of Laos for the Past 10 Years"

For more examples, see the examples/ directory in this repository.

Contact

If you experience any problems while using Querit, please feel free to reach out to us at support@querit.ai. Our team is ready to assist you.

Metadata

Release files for querit 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for querit 0.1.5
File Size Uploaded
querit-0.1.5.tar.gz 19.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for querit 0.1.5
File Interpreter ABI Platform
querit-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 42.1 kB

Release files / querit-0.1.5.tar.gz

Download URL querit-0.1.5.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3b051d40dbb41585aaf7bb0914c15b14668bf15e3161479640e6ea80587f0d20
BLAKE2b-256 checksum
How to use checksums
c545343997aeeb7181ab29567f01d66c7a770a6150d1fc7148433725b2cb2f4a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / querit-0.1.5-py3-none-any.whl

Download URL querit-0.1.5-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0ae6197201f3230803fadf7d671f4aa98b7b51ba8e1819e06dd04429c8a39184
BLAKE2b-256 checksum
How to use checksums
ac6cae21b7b50ba1c535e97eb059991de3da2c4b0b85e9d1fa366132d48fa416
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page