Skip to main content

Official async Python SDK for the Q answer engine (Sonar-compatible + extended APIs).

Project description

getq

Async Python SDK for the Q HTTP API (/v1 Sonar-compatible surface plus skills, rules, hooks, and streaming helpers).

Install

pip install getq

Quick start

import asyncio
from q_client import Q

async def main():
    q = Q(api_key="q_…")
    ans = await q.sonar.chat(
        model="sonar",
        messages=[{"role": "user", "content": "What is quantum tunneling?"}],
    )
    print(ans.choices[0].message.content)
    await q.aclose()

asyncio.run(main())

Streaming

Use q.sonar.stream_reader(...) for normalized SSE events (text_delta, citation, tool_use, thinking, artifact, error, done).

reader = await q.sonar.stream_reader(
    model="sonar-pro",
    messages=[{"role": "user", "content": "Hello"}],
)
async for event in reader:
    if event.type == "text_delta":
        print(event.payload.text, end="", flush=True)
await reader.aclose()

License

Apache-2.0

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

getq-0.1.0.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

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

getq-0.1.0-py3-none-any.whl (1.4 kB view details)

Uploaded Python 3

File details

Details for the file getq-0.1.0.tar.gz.

File metadata

  • Download URL: getq-0.1.0.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for getq-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ee25161405faaf470720024ecc7b1850577eba7b01b785c27616860de3d1d2d7
MD5 7a0cf00065cf5f11a20c8de2fd62f8a5
BLAKE2b-256 3bf73d2f582dd0ecbf616843b1026eb01fa6d1a4337a2e0437e218bd4cceb26f

See more details on using hashes here.

File details

Details for the file getq-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: getq-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 1.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for getq-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 46fa92e466b6b21ceb6840076a00ad506d0f31a7ce687533911011a93a74e13c
MD5 4530d68864d2f0f619b21016ba4a5f49
BLAKE2b-256 c6d17d46d5a3215fff32a3961814891823ebdf74cd360636ea3ae7de9dd71110

See more details on using hashes here.

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