Skip to content

Commit 10a0eb5

Browse files
committed
docs: rewrite README with quickstart and usage examples
1 parent 43938a4 commit 10a0eb5

1 file changed

Lines changed: 44 additions & 14 deletions

File tree

README.md

Lines changed: 44 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,55 @@
11
# hotdata-llamaindex
22

3-
LlamaIndex tools for [Hotdata](https://hotdata.dev), built on **hotdata-runtime**.
4-
5-
## Features
6-
7-
- **SQL tool** — run workspace SQL and return JSON rows for agents
8-
- **Managed database tools** — list, create, and load parquet into Hotdata-owned catalogs (replaces legacy dataset uploads)
3+
Give your [LlamaIndex](https://www.llamaindex.ai/) agents access to [Hotdata](https://hotdata.dev) — run SQL against your workspace connections and work with managed databases.
94

105
## Install
116

127
```bash
138
pip install hotdata-llamaindex
149
```
1510

16-
Requires `HOTDATA_API_KEY`. Optionally set `HOTDATA_WORKSPACE`, `HOTDATA_API_URL`, or `HOTDATA_SANDBOX`.
11+
## Authentication
12+
13+
Set `HOTDATA_API_KEY` in your environment. Optionally set `HOTDATA_WORKSPACE` to pin a specific workspace (the first available workspace is used if unset).
1714

18-
## Usage
15+
## Quickstart
1916

2017
```python
18+
from llama_index.core.agent.workflow import FunctionAgent
2119
import hotdata_llamaindex as hli
2220

2321
client = hli.from_env()
2422
tools = hli.make_hotdata_tools(client)
2523

26-
for tool in tools:
27-
print(tool.metadata.name, tool.metadata.description)
24+
agent = FunctionAgent(tools=tools, llm=your_llm)
25+
response = await agent.run("How many rows are in the orders table?")
2826
```
2927

30-
Managed database example:
28+
## Tools
29+
30+
`make_hotdata_tools(client)` returns a list of LlamaIndex `FunctionTool` objects ready to pass to any agent:
31+
32+
| Tool | What it does |
33+
|------|-------------|
34+
| `hotdata_execute_sql` | Run a SQL query and return rows as JSON |
35+
| `hotdata_list_managed_databases` | List available managed databases |
36+
| `hotdata_create_managed_database` | Create a new managed database |
37+
| `hotdata_load_managed_table` | Load a parquet file into a managed table |
38+
39+
## Calling tools directly
40+
41+
You can also call tools outside of an agent loop:
3142

3243
```python
33-
tools = {tool.metadata.name: tool for tool in hli.make_hotdata_tools(client)}
44+
tools = {t.metadata.name: t for t in hli.make_hotdata_tools(client)}
45+
46+
result = tools["hotdata_execute_sql"].call(sql="SELECT * FROM orders LIMIT 10")
47+
print(result.content) # JSON rows
3448

3549
tools["hotdata_create_managed_database"].call(
3650
name="sales",
3751
schema_name="public",
38-
tables="orders",
52+
tables="orders,customers",
3953
)
4054

4155
tools["hotdata_load_managed_table"].call(
@@ -45,7 +59,23 @@ tools["hotdata_load_managed_table"].call(
4559
)
4660
```
4761

48-
## Examples
62+
## Scoping queries to a managed database
63+
64+
Pass `database=` so all SQL the agent runs resolves against a specific managed database:
65+
66+
```python
67+
tools = hli.make_hotdata_tools(client, database="sales")
68+
```
69+
70+
## Controlling result size
71+
72+
Limit how many rows are returned to the LLM. Useful for keeping responses within context limits (default: 100):
73+
74+
```python
75+
tools = hli.make_hotdata_tools(client, max_rows=50)
76+
```
77+
78+
## Run the examples
4979

5080
```bash
5181
uv run python examples/llamaindex_basic.py

0 commit comments

Comments
 (0)