Official Python SDK for the TextQL Platform API
Project description
TextQL Python SDK
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3731b0034015ad4e4e9c7a7d2a6e986699775e46b07ffe8e03f51b716ce28a3
|
|
| MD5 |
d9ab83fc55684f3273e3bb69e5f10e82
|
|
| BLAKE2b-256 |
0db3cb0e51e1bb140238e00e025598538f1ea93fecf652479b86ae79e4658847
|
Provenance
The following attestation bundles were made for textql-2.1.0.tar.gz:
Publisher:
publish.yml on TextQLLabs/textql-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
textql-2.1.0.tar.gz -
Subject digest:
c3731b0034015ad4e4e9c7a7d2a6e986699775e46b07ffe8e03f51b716ce28a3 - Sigstore transparency entry: 1916174523
- Sigstore integration time:
-
Permalink:
TextQLLabs/textql-python@88777148aae061c1767acd6e13fb684f22c16ed9 -
Branch / Tag:
refs/tags/v2.1.0 - Owner: https://github.com/TextQLLabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@88777148aae061c1767acd6e13fb684f22c16ed9 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5106c47a75f13c950d8a5906c9de274e0aa60fc4f22c653f0502afa7a185e9bc
|
|
| MD5 |
b4407b8c6dd2b3dee862f20a78ab9aa5
|
|
| BLAKE2b-256 |
51eb394f59024af948fc13c8a59f9d2ce2755ca0aa99acf7f52c4ab8a0883e4f
|
Provenance
The following attestation bundles were made for textql-2.1.0-py3-none-any.whl:
Publisher:
publish.yml on TextQLLabs/textql-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
textql-2.1.0-py3-none-any.whl -
Subject digest:
5106c47a75f13c950d8a5906c9de274e0aa60fc4f22c653f0502afa7a185e9bc - Sigstore transparency entry: 1916174611
- Sigstore integration time:
-
Permalink:
TextQLLabs/textql-python@88777148aae061c1767acd6e13fb684f22c16ed9 -
Branch / Tag:
refs/tags/v2.1.0 - Owner: https://github.com/TextQLLabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@88777148aae061c1767acd6e13fb684f22c16ed9 -
Trigger Event:
push
-
Statement type: