Skip to content

Commit 47546fb

Browse files
committed
added response structure
1 parent 2de47d3 commit 47546fb

File tree

4 files changed

+100
-1
lines changed

4 files changed

+100
-1
lines changed

src/content/docs/autorag/use-autorag/rest-api.mdx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ You can get your `ACCOUNT_ID` by navigating to Workers & Pages on the Dashboard,
6161

6262
<Render file="ai-search-api-params" product="autorag" />
6363

64+
### Response
65+
66+
This is the response structure without `stream` enabled.
67+
68+
<Render file="ai-search-response" product="autorag" />
69+
6470
## Search
6571

6672
This REST API searches for results from your data source and returns the relevant results:
@@ -90,3 +96,7 @@ You can get your `ACCOUNT_ID` by navigating to Workers & Pages on the Dashboard,
9096
### Parameters
9197

9298
<Render file="search-api-params" product="autorag" />
99+
100+
### Response
101+
102+
<Render file="search-response" product="autorag" />

src/content/docs/autorag/use-autorag/workers-binding.mdx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,20 @@ const answer = await env.AI.AutoRAG("my-autorag").aiSearch({
4242
ranking_options: {
4343
score_threshold: 0.7,
4444
},
45-
stream: true,
45+
stream: false,
4646
});
4747
```
4848

4949
### Parameters
5050

5151
<Render file="ai-search-api-params" product="autorag" />
5252

53+
### Response
54+
55+
This is the response structure without `stream` enabled.
56+
57+
<Render file="ai-search-response" product="autorag" />
58+
5359
## `search()`
5460

5561
This method searches for results from your corpus and returns the relevant results, for the AutoRAG instance named `my-autorag`:
@@ -69,6 +75,10 @@ const answer = await env.AI.AutoRAG("my-autorag").search({
6975

7076
<Render file="search-api-params" product="autorag" />
7177

78+
### Response
79+
80+
<Render file="search-response" product="autorag" />
81+
7282
## Local development
7383

7484
Local development is supported by proxying requests to your deployed AutoRAG instance. When running in local mode, your application forwards queries to the configured remote AutoRAG instance and returns the generated responses as if they were served locally.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
{}
3+
---
4+
5+
```json
6+
{
7+
"success": true,
8+
"result": {
9+
"object": "vector_store.search_results.page",
10+
"search_query": "How do I train a llama to deliver coffee?",
11+
"response": "To train a llama to deliver coffee:\n\n1. **Build trust** — Llamas appreciate patience (and decaf).\n2. **Know limits** — Max 3 cups per llama, per `llama-logistics.md`.\n3. **Use voice commands** — Start with \"Espresso Express!\"\n4. **Set a route** — Carrot GPS markers help.\n5. **Track metrics** — Monitor spills, detours, and snack breaks via telemetry.\n\nNote: This is a demo. Please don’t caffeinate your llama.",
12+
"data": [
13+
{
14+
"file_id": "llama001",
15+
"filename": "docs/llama-logistics.md",
16+
"score": 0.98,
17+
"content": [
18+
{
19+
"type": "text",
20+
"text": "Llamas can carry 3 drinks max. Avoid iced coffee — they hate condensation."
21+
}
22+
]
23+
},
24+
{
25+
"file_id": "llama042",
26+
"filename": "docs/llama-commands.md",
27+
"score": 0.95,
28+
"content": [
29+
{
30+
"type": "text",
31+
"text": "Start with basic commands like 'Espresso Express!' Llamas love alliteration."
32+
}
33+
]
34+
}
35+
],
36+
"has_more": false,
37+
"next_page": null
38+
}
39+
}
40+
```
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
{}
3+
---
4+
5+
```json
6+
{
7+
"success": true,
8+
"result": {
9+
"object": "vector_store.search_results.page",
10+
"search_query": "How do I train a llama to deliver coffee?",
11+
"data": [
12+
{
13+
"file_id": "llama001",
14+
"filename": "docs/llama-logistics.md",
15+
"score": 0.98,
16+
"content": [
17+
{
18+
"type": "text",
19+
"text": "Llamas can carry 3 drinks max. Avoid iced coffee — they hate condensation."
20+
}
21+
]
22+
},
23+
{
24+
"file_id": "llama042",
25+
"filename": "docs/llama-commands.md",
26+
"score": 0.95,
27+
"content": [
28+
{
29+
"type": "text",
30+
"text": "Start with basic commands like 'Espresso Express!' Llamas love alliteration."
31+
}
32+
]
33+
}
34+
],
35+
"has_more": false,
36+
"next_page": null
37+
}
38+
}
39+
```

0 commit comments

Comments
 (0)