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
textql-2.0.0.tar.gz
(11.2 kB
view details)
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.0.0.tar.gz.
File metadata
- Download URL: textql-2.0.0.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
679bfa3ab64a0dbe6d6c42622f2f1133d292aa52c45a02d4db7a18024cb41432
|
|
| MD5 |
30669041a789511331cb60bfea0a936e
|
|
| BLAKE2b-256 |
c6c2fe5bb281e0480bb778b2d00dc578fa2ba58e583bf08bbd1c193559759297
|
File details
Details for the file textql-2.0.0-py3-none-any.whl.
File metadata
- Download URL: textql-2.0.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a64d61dfc5f8aec00b597a094d2557df8e45a841a8b9db1da6a7ed40ebe14a3
|
|
| MD5 |
ea827dc8ac8a69426f5a3d6391c3d1d0
|
|
| BLAKE2b-256 |
59aa54ee750d0c30004fc5a6ac467c88c5a3668ea14df9a631b959fe796fee58
|