You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add Version 2 request support to Natural Language API documentation (#130)
## Description 📝
This PR enhances the Natural Language API documentation by adding
comprehensive support for Version 2 (v2) requests alongside the existing
Version 1 (v1) documentation.
Key changes:
- Added complete v2 request documentation with build-based configuration
- Clarified authentication requirements for both versions (Bearer token
vs deprecated API key field)
- Documented PromptQL configuration resolution order for v2 (build-level
config with project-level fallback)
- Enhanced DDN authentication section to cover both v1 and v2
implementations
- Improved overall structure and organization of the API documentation
- The updates provide clear guidance for developers migrating to v2
while maintaining backward compatibility documentation for v1 users.
## Quick Links 🚀
<!-- Links to the relevant place(s) in the CloudFlare Pages build. Wait
for CF comment for link. -->
## Assertion Tests 🤖
<!-- Add assertions between the comments below to have ChatGPT check the
quality of your docs contribution (Diff) and
how well it integrates with existing docs. E.g., A user should be able
to easily understand how to make a simple
query. -->
<!-- For more info, see the Action's docs in the marketplace:
https://github.com/marketplace/actions/docs-assertion-tester#usage -->
<!-- DX:Assertion-start -->
<!-- DX:Assertion-end -->
---------
Co-authored-by: Sean <[email protected]>
Co-authored-by: Sean Park-Ross <[email protected]>
|`interactions`| array | Yes | List of message interactions, including user messages and assistant responses. Each interaction contains a `user_message` object with the user's text and an optional `assistant_actions` array containing previous assistant responses with their messages, plans, code executions, and outputs. |
140
163
|`stream`| boolean | Yes | Whether to return a streaming response |
141
164
142
-
**LLM Provider Options**
165
+
#### LLM Provider Configuration
143
166
144
167
The `llm` and `ai_primitives_llm` fields support the following providers:
145
168
@@ -176,16 +199,155 @@ You get $20 worth of free credits with Hasura's built-in provider during the tri
176
199
}
177
200
```
178
201
179
-
#### Request DDN Auth
202
+
</TabItem>
203
+
<TabItemvalue="v2"label="Version 2">
204
+
205
+
### Request
206
+
207
+
Version 2 requests use supergraph build versions instead of direct DDN URLs. The `build_version` refers to the version
208
+
of supergraph builds created in your DDN project. Users can view build details in the DDN console or fetch information
209
+
using the [`ddn supergraph build get`](/reference/cli/commands/ddn_supergraph_build_get) command.
210
+
211
+
#### Headers
212
+
213
+
```
214
+
Content-Type: application/json
215
+
Authorization: Bearer <your-promptql-api-key>
216
+
```
217
+
218
+
:::info Authentication
219
+
220
+
Version 2 requests require the PromptQL API key to be sent as a Bearer token in the Authorization header.
|`interactions`| array | Yes | List of message interactions, including user messages and assistant responses. Each interaction contains a `user_message` object with the user's text and an optional `assistant_actions` array containing previous assistant responses with their messages, plans, code executions, and outputs. |
264
+
|`stream`| boolean | Yes | Whether to return a streaming response |
265
+
266
+
#### PromptQL Configuration
267
+
268
+
Unlike v1 requests, v2 requests do not accept `llm`, `ai_primitives_llm`, or `system_instructions` fields in the request
269
+
body. Instead, these PromptQL settings are automatically inferred from the supergraph build configuration.
270
+
271
+
**Configuration Resolution Order:**
272
+
273
+
1.**Build-level PromptQL Config**: Settings are first retrieved from the
274
+
[PromptQL configuration](/project-configuration/promptql-config/) associated with the specified `build_version`
275
+
2.**Project-level Fallback**: For older builds that don't have PromptQL config included, the system falls back to the
276
+
PromptQL configuration saved in the project settings
277
+
278
+
This approach ensures consistent configuration management and eliminates the need to specify LLM settings in each API
279
+
request when using v2.
280
+
281
+
</TabItem>
282
+
</Tabs>
283
+
284
+
## Authentication
285
+
286
+
### PromptQL API Authentication
287
+
288
+
Both API versions require authentication using your PromptQL API key:
289
+
290
+
-**Version 1**: Supports both `Authorization` header (recommended) and deprecated `promptql_api_key` field
291
+
-**Version 2**: Requires `Authorization` header with Bearer token format
292
+
293
+
### DDN Authentication
294
+
295
+
The `ddn.headers` field allows you to pass authentication headers to your DDN endpoint and is supported in both
296
+
**version 1 (v1)** and **version 2 (v2)** requests. This enables you to use any DDN-compatible authentication strategy
0 commit comments