Skip to content

Commit 3333333

Browse files
committed
Feat: Update Readmes
1 parent 4444444 commit 3333333

2 files changed

Lines changed: 83 additions & 24 deletions

File tree

README.md

Lines changed: 56 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@
44
[![Python versions](https://img.shields.io/pypi/pyversions/textql.svg)](https://pypi.org/project/textql/)
55
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
66

7-
Official Python SDK for the [TextQL Platform API](https://docs.textql.com).
8-
9-
> **Status:** v0.1.0 is a scaffolding release. Resource clients (`chat`, `playbooks`, `sandbox`, `connectors`) are stubs and not yet functional.
7+
Official Python SDK for the [TextQL Platform API](https://docs.textql.com/api-reference/v2/introduction).
108

119
## Installation
1210

@@ -22,45 +20,79 @@ Requires Python 3.9+.
2220
from textql import TextQL
2321

2422
client = TextQL(api_key="tql_...") # or set TEXTQL_API_KEY in the environment
23+
24+
# Ask a question
25+
response = client.chat.create("What was total revenue last quarter?", connector_ids=[1])
26+
print(response["response"])
27+
28+
# Stream a response
29+
for event in client.chat.stream("Summarize sales by region"):
30+
if event["type"] == "text":
31+
print(event["text"], end="", flush=True)
32+
33+
# Upload files with a question
34+
response = client.chat.create(
35+
"Analyze this data",
36+
files=["./sales.csv"],
37+
)
2538
```
2639

27-
Once resource clients land, the surface will look like:
40+
## Resources
41+
42+
### Chat
2843

2944
```python
30-
# Simple chat
31-
response = client.chat.create(question="What was total revenue last quarter?")
45+
client.chat.list(limit=10)
46+
client.chat.create("What connectors are available?")
47+
client.chat.get("chat-uuid")
48+
client.chat.stream("Summarize revenue")
49+
client.chat.cancel("chat-uuid")
50+
```
3251

33-
# Streaming
34-
for event in client.chat.stream(question="..."):
35-
print(event.text, end="", flush=True)
52+
### Connectors
3653

37-
# File upload
38-
response = client.chat.create(
39-
question="Analyze this",
40-
files=[{"path": "./sales.csv"}],
41-
)
54+
```python
55+
client.connectors.list()
56+
```
57+
58+
### Playbooks
59+
60+
```python
61+
client.playbooks.list(limit=10)
62+
pb = client.playbooks.create()
63+
client.playbooks.update(pb["id"], name="Weekly Revenue", prompt="Summarize revenue by region")
64+
client.playbooks.deploy(pb["id"])
65+
client.playbooks.run(pb["id"])
66+
client.playbooks.get(pb["id"])
67+
client.playbooks.delete(pb["id"])
68+
```
69+
70+
### Sandbox
71+
72+
```python
73+
sb = client.sandbox.start()
74+
sid = sb["sandbox_id"]
75+
76+
client.sandbox.execute(sid, code="import pandas as pd; print(pd.__version__)")
77+
client.sandbox.query(sid, connector_id=1, query="SELECT * FROM sales LIMIT 10", dataframe_name="sales")
78+
client.sandbox.upload_file(sid, "./data.csv")
79+
client.sandbox.status(sid)
80+
client.sandbox.stop(sid)
4281
```
4382

4483
## Configuration
4584

4685
| Option | Env var | Default |
4786
|---|---|---|
4887
| `api_key` | `TEXTQL_API_KEY` | — (required) |
49-
| `base_url` | `TEXTQL_BASE_URL` | `https://api.textql.com` |
88+
| `base_url` | `TEXTQL_BASE_URL` | `https://app.textql.com` |
5089
| `timeout` || `60.0` seconds |
5190

52-
## Development
53-
54-
```bash
55-
pip install -e ".[dev]"
56-
ruff check . && ruff format --check .
57-
pyright
58-
pytest
59-
```
91+
The `base_url` accepts a bare hostname (e.g. `app.textql.com`) or a full URL.
6092

6193
## Links
6294

63-
- [API documentation](https://docs.textql.com)
95+
- [API documentation](https://docs.textql.com/api-reference/v2/introduction)
6496
- [Changelog](CHANGELOG.md)
6597
- [Issues](https://github.com/TextQLLabs/textql-python/issues)
6698

tests/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Tests
2+
3+
## Unit tests
4+
5+
```bash
6+
pip install -e ".[dev]"
7+
pytest tests/test_client.py
8+
```
9+
10+
## Integration tests
11+
12+
Run against a live TextQL environment. Requires two env vars:
13+
14+
```bash
15+
export TEXTQL_STAGING_API_KEY="..."
16+
export TEXTQL_STAGING_BASE_URL="staging.textql.com"
17+
pytest tests/test_integration.py -v
18+
```
19+
20+
Tests are skipped automatically when the env vars are missing.
21+
22+
## Lint / type check
23+
24+
```bash
25+
ruff check . && ruff format --check .
26+
pyright
27+
```

0 commit comments

Comments
 (0)