Skip to main content

Python bindings for QueryMT

Project description

querymt

Python bindings for QueryMT.

Install

From the repository root:

python -m venv .venv
source .venv/bin/activate
pip install maturin
maturin develop --manifest-path crates/py/querymt-py/Cargo.toml

Then verify the module imports:

python -c "import querymt; print(querymt.__all__)"

Quick Start

import asyncio
import querymt


async def main() -> None:
    registry = await querymt.Registry.default()
    provider = await registry.provider("openai", model="gpt-4o-mini")
    response = await provider.chat([
        {"role": "user", "content": "Say hello briefly."}
    ])
    print(response.text)


asyncio.run(main())

Examples

  • crates/py/querymt-py/examples/chat.py
  • crates/py/querymt-py/examples/stream_chat.py
  • crates/py/querymt-py/examples/tools_chat.py
  • crates/py/querymt-py/examples/tools_stream_chat.py
  • crates/py/querymt-py/examples/share_provider.py
  • crates/py/querymt-py/examples/remote_chat.py

Tool Calling

You can pass tool definitions as plain Python dictionaries matching QueryMT's Tool schema:

TOOLS = [
    {
        "type": "function",
        "function": {
            "name": "lookup_weather",
            "description": "Look up the current weather for a city.",
            "parameters": {
                "type": "object",
                "properties": {
                    "city": {
                        "type": "string",
                        "description": "City name"
                    }
                },
                "required": ["city"],
            },
        },
    }
]

Use them with chat_with_tools(...) or chat_stream_with_tools(...).

Helper Builders

The module also exposes small helper builders:

  • querymt.user_message(...)
  • querymt.assistant_message(...)
  • querymt.text_block(...)
  • querymt.image_block(...)
  • querymt.image_url_block(...)
  • querymt.pdf_block(...)
  • querymt.audio_block(...)
  • querymt.thinking_block(...)
  • querymt.tool_use_block(...)
  • querymt.tool_result_block(...)
  • querymt.resource_link_block(...)
  • querymt.function_tool(...)

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

querymt-0.5.2.tar.gz (432.3 kB view details)

Uploaded Source

Built Distributions

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

querymt-0.5.2-cp310-abi3-win_amd64.whl (20.5 MB view details)

Uploaded CPython 3.10+Windows x86-64

querymt-0.5.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (26.6 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

querymt-0.5.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (26.2 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64

querymt-0.5.2-cp310-abi3-macosx_11_0_arm64.whl (22.1 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file querymt-0.5.2.tar.gz.

File metadata

  • Download URL: querymt-0.5.2.tar.gz
  • Upload date:
  • Size: 432.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for querymt-0.5.2.tar.gz
Algorithm Hash digest
SHA256 62e4c4ef002c458ddafcb287a98b6fed9125e76b0d64cae74978c9fabd01743e
MD5 6d73b800dd4d9bae30c45df8be9b3470
BLAKE2b-256 9b894e7ae3c729500aa80e4ca2c309417f7c80bbe075f72d0d78d372ae5a0451

See more details on using hashes here.

Provenance

The following attestation bundles were made for querymt-0.5.2.tar.gz:

Publisher: publish-querymt-pypi.yml on querymt/querymt

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

File details

Details for the file querymt-0.5.2-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: querymt-0.5.2-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 20.5 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for querymt-0.5.2-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 7e3e12ff610ba3ac45b411488675720a3bc913b14aac1ec7f3bf6a332228128e
MD5 c87638254886b164d51f34d31c0e8715
BLAKE2b-256 cfc39f5c7370c2ea474c82c9bcee6f30a68d98c912c35d963a4e7bb3a5fa6f2d

See more details on using hashes here.

Provenance

The following attestation bundles were made for querymt-0.5.2-cp310-abi3-win_amd64.whl:

Publisher: publish-querymt-pypi.yml on querymt/querymt

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

File details

Details for the file querymt-0.5.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for querymt-0.5.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 005bfd45b5c8cb991fb1a4db0edcb5847381d3a2292285e23a49672b2b045e60
MD5 0bc0fb162d54fbe5f72b942ee53fcbd0
BLAKE2b-256 1e9cf082a67ef0097de9cbac3a0904d1265f49a68cc73d7bf7cf84585b9cd4d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for querymt-0.5.2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: publish-querymt-pypi.yml on querymt/querymt

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

File details

Details for the file querymt-0.5.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for querymt-0.5.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 1cc172c14872a2d7d351b4dec43007282300efb2f6587d7580c60fc13a8c5950
MD5 48adc52e571e52fe2d25ddb7b59e6bed
BLAKE2b-256 3df7b3c848751277c82059b9a4815af2425adf389d6b3e953089583f189798a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for querymt-0.5.2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: publish-querymt-pypi.yml on querymt/querymt

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

File details

Details for the file querymt-0.5.2-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for querymt-0.5.2-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2c1ec96f9fd43943dfce7ba1205a3946e415fa28a08d3b87b18e1b8ce65a37db
MD5 c0ab08488497bef1bb75f76e1efb1ba0
BLAKE2b-256 ce40053f014bc56baf44de9e9929f962098083393d3e9c877a0082bbe57cc07d

See more details on using hashes here.

Provenance

The following attestation bundles were made for querymt-0.5.2-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: publish-querymt-pypi.yml on querymt/querymt

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