@hasura/promptql 2.0.0-alpha.41 → 2.0.0-alpha.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -57
- package/biome.json +1 -1
- package/dist/index.d.mts +880 -68
- package/dist/index.d.ts +880 -68
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,21 +1,10 @@
|
|
|
1
1
|
# PromptQL TypeScript SDK
|
|
2
2
|
|
|
3
|
-
The PromptQL TypeScript SDK is a general-purpose SDK that interacts with the [PromptQL API](https://promptql.
|
|
3
|
+
The PromptQL TypeScript SDK is a general-purpose SDK that interacts with the [PromptQL API](https://promptql.io) by Hasura. PromptQL is a multiplayer AI agent — think Claude or ChatGPT, but with shared threads and a shared brain.
|
|
4
4
|
|
|
5
5
|
> [!NOTE]
|
|
6
6
|
> This SDK supports PromptQL v2. Please install [@hasura/promptql@1.0.0](https://www.npmjs.com/package/@hasura/promptql/v/1.0.0) if you wants to integrate PromptQL v1.
|
|
7
7
|
|
|
8
|
-
## Features
|
|
9
|
-
|
|
10
|
-
- **Type-safe API Client**: Fully typed TypeScript SDK with auto-generated types from GraphQL schema
|
|
11
|
-
- **Thread Management**: Create, list, and manage conversation threads
|
|
12
|
-
- **Real-time Streaming**: Subscribe to thread events with GraphQL subscriptions using RxJS observables
|
|
13
|
-
- **Authentication**: Built-in authentication handling with service account tokens
|
|
14
|
-
- **Query Planning**: Access to AI agent query plans and execution steps
|
|
15
|
-
- **Artifact Support**: Handle modified artifacts from AI responses
|
|
16
|
-
- **CLI Tool**: Command-line interface for quick interactions
|
|
17
|
-
- **Flexible Configuration**: Support for custom base URLs, headers, and fetch implementations
|
|
18
|
-
|
|
19
8
|
## Requirements
|
|
20
9
|
|
|
21
10
|
- Node.js >= 24
|
|
@@ -42,16 +31,14 @@ bun add @hasura/promptql@latest
|
|
|
42
31
|
|
|
43
32
|
## Quick Start
|
|
44
33
|
|
|
45
|
-
### Getting
|
|
34
|
+
### Getting PromptQL access token
|
|
46
35
|
|
|
47
|
-
1. Visit your
|
|
48
|
-
2. Navigate to
|
|
49
|
-
3.
|
|
50
|
-
4. Create a
|
|
36
|
+
1. Visit your PromptQL project
|
|
37
|
+
2. Navigate to User Directory
|
|
38
|
+
3. Use your account or create a bot account.
|
|
39
|
+
4. Create a personal access token with `MCP` scope.
|
|
51
40
|
5. Copy the token and use it in your SDK configuration
|
|
52
41
|
|
|
53
|
-
For more details, check the [Hasura documentation](https://hasura.io/docs/3.0/project-configuration/project-management/service-accounts/#how-to-create-service-account).
|
|
54
|
-
|
|
55
42
|
### Basic Usage
|
|
56
43
|
|
|
57
44
|
#### Start a PromptQL thread
|
|
@@ -61,7 +48,8 @@ import { PromptQLSdk } from '@hasura/promptql';
|
|
|
61
48
|
|
|
62
49
|
// Initialize the SDK
|
|
63
50
|
const sdk = new PromptQLSdk({
|
|
64
|
-
|
|
51
|
+
baseUrl: 'https://your-data-plane-url',
|
|
52
|
+
accessToken: 'personal-access-token',
|
|
65
53
|
});
|
|
66
54
|
|
|
67
55
|
// Start a new thread
|
|
@@ -109,7 +97,6 @@ import { lastValueFrom } from "rxjs";
|
|
|
109
97
|
|
|
110
98
|
// Initialize the SDK
|
|
111
99
|
const sdk = new PromptQLSdk({
|
|
112
|
-
projectId: 'your-project-id',
|
|
113
100
|
serviceAccountToken: 'your-service-account-token',
|
|
114
101
|
});
|
|
115
102
|
|
|
@@ -139,8 +126,8 @@ import { pairwise, map } from 'rxjs';
|
|
|
139
126
|
|
|
140
127
|
// Initialize the SDK
|
|
141
128
|
const sdk = new PromptQLSdk({
|
|
142
|
-
|
|
143
|
-
|
|
129
|
+
baseUrl: 'https://your-data-plane-url',
|
|
130
|
+
accessToken: 'personal-access-token',
|
|
144
131
|
});
|
|
145
132
|
|
|
146
133
|
// Start a new thread
|
|
@@ -260,49 +247,38 @@ console.log(source.replaceAll(xmlRegex, ""));
|
|
|
260
247
|
## Configuration Options
|
|
261
248
|
|
|
262
249
|
```typescript
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
// Optional: Custom fetch implementation
|
|
250
|
+
export type PromptQLSdkOptions = {
|
|
251
|
+
/**
|
|
252
|
+
* Base URL of the PromptQL API.
|
|
253
|
+
*/
|
|
254
|
+
baseUrl?: string;
|
|
255
|
+
/**
|
|
256
|
+
* Access token of the PromptQL project.
|
|
257
|
+
*/
|
|
258
|
+
accessToken: string;
|
|
259
|
+
/**
|
|
260
|
+
* A function to use instead of calling the Fetch API directly when sending HTTP requests to your GraphQL endpoint. The function must conform to the signature of fetch.
|
|
261
|
+
* By default, the Fetch API is used unless it isn't available in your runtime environment.
|
|
262
|
+
*/
|
|
278
263
|
fetch?: typeof fetch;
|
|
279
|
-
|
|
280
|
-
|
|
264
|
+
/**
|
|
265
|
+
* An object representing headers to include in every HTTP request.
|
|
266
|
+
*/
|
|
281
267
|
headers?: Record<string, string>;
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
268
|
+
/**
|
|
269
|
+
* An [IANA timezone](https://data.iana.org/time-zones/tzdb-2021a/zone1970.tab) for interpreting time-based queries. Default is the timezone from the client config.
|
|
270
|
+
*/
|
|
285
271
|
timezone?: string;
|
|
286
|
-
|
|
287
|
-
// Optional: DDN build ID
|
|
288
|
-
// Default: Applied build
|
|
289
|
-
buildId?: string;
|
|
290
|
-
}
|
|
272
|
+
};
|
|
291
273
|
```
|
|
292
274
|
|
|
293
|
-
## License
|
|
294
|
-
|
|
295
|
-
Apache License 2.0 - see [LICENSE](LICENSE) file for details.
|
|
296
|
-
|
|
297
275
|
## Links
|
|
298
276
|
|
|
299
|
-
- [PromptQL Website](https://promptql.
|
|
300
|
-
- [PromptQL
|
|
301
|
-
- [Hasura Documentation](https://hasura.io/docs)
|
|
277
|
+
- [PromptQL Website](https://promptql.io)
|
|
278
|
+
- [PromptQL App](https://hasura.ql.app)
|
|
302
279
|
|
|
303
280
|
## Support
|
|
304
281
|
|
|
305
282
|
For support, please:
|
|
306
283
|
|
|
307
|
-
1.
|
|
308
|
-
2. Join the [Hasura Discord community](https://discord.gg/hasura)
|
|
284
|
+
1. Join the [Hasura Discord community](https://discord.gg/hasura)
|
package/biome.json
CHANGED