Skip to main content

Official Python SDK for the TextQL Platform API

Project description

TextQL Python SDK

PyPI version Python versions License: MIT

Official Python SDK for the TextQL Platform API.

Installation

pip install textql

Requires Python 3.9+.

Quickstart

from textql import TextQL

client = TextQL(api_key="tql_...")  # or set TEXTQL_API_KEY in the environment

# Ask a question
response = client.chat.create("What was total revenue last quarter?", connector_ids=[1])
print(response["response"])

# Stream a response
for event in client.chat.stream("Summarize sales by region"):
    if event["type"] == "text":
        print(event["text"], end="", flush=True)

# Upload files with a question
response = client.chat.create(
    "Analyze this data",
    files=["./sales.csv"],
)

Resources

Chat

client.chat.list(limit=10)
client.chat.create("What connectors are available?")
client.chat.get("chat-uuid")
client.chat.stream("Summarize revenue")
client.chat.cancel("chat-uuid")

Connectors

client.connectors.list()

Playbooks

client.playbooks.list(limit=10)
pb = client.playbooks.create()
client.playbooks.update(pb["id"], name="Weekly Revenue", prompt="Summarize revenue by region")
client.playbooks.deploy(pb["id"])
client.playbooks.run(pb["id"])
client.playbooks.get(pb["id"])
client.playbooks.delete(pb["id"])

Sandbox

sb = client.sandbox.start()
sid = sb["sandbox_id"]

client.sandbox.execute(sid, code="import pandas as pd; print(pd.__version__)")
client.sandbox.query(sid, connector_id=1, query="SELECT * FROM sales LIMIT 10", dataframe_name="sales")
client.sandbox.upload_file(sid, "./data.csv")
client.sandbox.status(sid)
client.sandbox.stop(sid)

Configuration

Option Env var Default
api_key TEXTQL_API_KEY — (required)
base_url TEXTQL_BASE_URL https://app.textql.com
timeout 60.0 seconds

The base_url accepts a bare hostname (e.g. app.textql.com) or a full URL.

Links

License

MIT

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

textql-2.1.0.tar.gz (16.4 kB view details)

Uploaded Source

Built Distribution

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

textql-2.1.0-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file textql-2.1.0.tar.gz.

File metadata

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

File hashes

Hashes for textql-2.1.0.tar.gz
Algorithm Hash digest
SHA256 c3731b0034015ad4e4e9c7a7d2a6e986699775e46b07ffe8e03f51b716ce28a3
MD5 d9ab83fc55684f3273e3bb69e5f10e82
BLAKE2b-256 0db3cb0e51e1bb140238e00e025598538f1ea93fecf652479b86ae79e4658847

See more details on using hashes here.

Provenance

The following attestation bundles were made for textql-2.1.0.tar.gz:

Publisher: publish.yml on TextQLLabs/textql-python

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

File details

Details for the file textql-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: textql-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for textql-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5106c47a75f13c950d8a5906c9de274e0aa60fc4f22c653f0502afa7a185e9bc
MD5 b4407b8c6dd2b3dee862f20a78ab9aa5
BLAKE2b-256 51eb394f59024af948fc13c8a59f9d2ce2755ca0aa99acf7f52c4ab8a0883e4f

See more details on using hashes here.

Provenance

The following attestation bundles were made for textql-2.1.0-py3-none-any.whl:

Publisher: publish.yml on TextQLLabs/textql-python

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