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
Copy file name to clipboardExpand all lines: src/content/docs/apis/nerdgraph/examples/nerdgraph-rag.mdx
+43-41Lines changed: 43 additions & 41 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,7 @@ To learn more about the knowledge connector, refer to [New Relic AI Knowledge co
24
24
25
25
To start indexing your content and benefit from the knowledge connector with New Relic AI, follow these mentioned steps:
26
26
27
-
## Create your RAG tool [#create-your-rag-tool]
27
+
## Task 1: Create your RAG tool [#create-your-rag-tool]
28
28
29
29
<CollapserGroup>
30
30
<Collapserid="get-started"title="Obtain your organization ID">
@@ -33,7 +33,7 @@ Organization ID uniquely identifies your account and ensures that any RAG tool y
33
33
34
34
Organization ID is required to perform mutations and queries in NerdGraph when setting up and managing RAG tools and documents. Run the following query and keep the organization ID handy for later steps.
35
35
36
-
####Sample query
36
+
### Sample query
37
37
```graphql
38
38
{
39
39
actor {
@@ -52,7 +52,8 @@ To create a new RAG tool in your New Relic account, run the following `entityMan
52
52
53
53
1. Make sure to replace `${ORGANIZATION_ID}` with your actual organization ID obtained in the previous step.
54
54
2. If successful, you'll receive an `id` for your RAG tool.
55
-
#### Input parameters
55
+
56
+
### Input parameters
56
57
57
58
<table>
58
59
<thead>
@@ -103,7 +104,7 @@ To create a new RAG tool in your New Relic account, run the following `entityMan
103
104
</tbody>
104
105
</table>
105
106
106
-
####Sample mutation
107
+
### Sample mutation
107
108
```graphql
108
109
mutation {
109
110
entityManagementCreateRagTool(
@@ -122,9 +123,11 @@ mutation {
122
123
123
124
You should save the `id` returned as you'll need it in later steps to link documents to the tool, verify relationships, and query the tool for relevant information in New Relic.
124
125
</Collapser>
126
+
</CollapserGroup>
125
127
126
-
## The indexing phase [#the-indexing-phase]
128
+
## Task 2: Index your documents [#index-your-documents]
127
129
130
+
<CollapserGroup>
128
131
<Collapserid="upload-document"title="Upload a document via the Blob API">
129
132
130
133
<Calloutvariant="important">
@@ -144,7 +147,7 @@ You need a valid New Relic API key with permissions to upload documents. To get
144
147
145
148
Here's an example of how to upload a document using a `curl``bash` command:
146
149
147
-
####Input parameters
150
+
### Input parameters
148
151
149
152
<table>
150
153
<thead>
@@ -184,7 +187,7 @@ Here's an example of how to upload a document using a `curl` `bash` command:
184
187
</table>
185
188
186
189
187
-
####Sample query
190
+
### Sample query
188
191
```shell
189
192
curl -X POST https://blob-api.one-service.newrelic.com/v1/e/organizations/$ORGANIZATION_ID/RagDocuments \
190
193
-H 'Api-Key: NRAK-XXXXXXXXXX' \
@@ -193,7 +196,7 @@ curl -X POST https://blob-api.one-service.newrelic.com/v1/e/organizations/$ORGAN
193
196
-d @incidents.json
194
197
```
195
198
196
-
####Sample response
199
+
### Sample response
197
200
198
201
<table>
199
202
<thead>
@@ -253,7 +256,7 @@ After a document is uploaded via the Blob API, running this query confirms that
253
256
</tbody>
254
257
</table>
255
258
256
-
####Sample query
259
+
### Sample query
257
260
258
261
In the query below, replace the `${RAG_DOCUMENT_GUID}` placeholder with the `entityGuid` you received in the previous step.
259
262
@@ -293,7 +296,7 @@ Now that you've created a RAG tool, uploaded your document, and verified that th
293
296
1. Replace `${RAG_DOCUMENT_GUID}` with the `entityGuid` from the response of the document upload via the Blob API.
294
297
2. Replace `${RAG_TOOL_GUID}` with the `id` from the response of the RAG tool creation mutation.
295
298
296
-
####Input parameters
299
+
### Input parameters
297
300
298
301
<table>
299
302
<thead>
@@ -356,7 +359,7 @@ Now that you've created a RAG tool, uploaded your document, and verified that th
356
359
</tbody>
357
360
</table>
358
361
359
-
####Sample mutation
362
+
### Sample mutation
360
363
361
364
```graphql
362
365
mutation {
@@ -388,17 +391,19 @@ mutation {
388
391
}
389
392
```
390
393
</Collapser>
394
+
</CollapserGroup>
391
395
392
-
## The retrieval phase [#the-retrieval-phase]
396
+
## Task 3: Retrieve relevant information [#retrieve-relevant-information]
393
397
398
+
<CollapserGroup>
394
399
<Collapserid="query-to-see-relationships-between-rag-documents-and-rag-tools"title="Query to see relationships between RAG documents and RAG tools">
395
400
396
401
After creating a relationship between your RAG document and RAG tool, you can verify the association by querying relationships in NerdGraph. This helps ensure your document is properly linked and available for New Relic AI to use.
397
402
398
403
- Replace `${RAG_DOCUMENT_ID}` with the `entityGuid` of your uploaded document.
399
404
400
405
401
-
####Input parameters
406
+
### Input parameters
402
407
403
408
<table>
404
409
<thead>
@@ -437,7 +442,7 @@ After creating a relationship between your RAG document and RAG tool, you can ve
437
442
</tbody>
438
443
</table>
439
444
440
-
####Sample query
445
+
### Sample query
441
446
442
447
```graphql
443
448
{
@@ -464,37 +469,34 @@ After creating a relationship between your RAG document and RAG tool, you can ve
464
469
465
470
After you've set up your RAG tool and indexed documents, you can query the RAG tool to retrieve relevant information based on your prompt. This allows New Relic AI to surface context-aware answers using your organization's documentation.
466
471
467
-
####Input parameters
472
+
### Input parameters
468
473
469
474
<table>
470
-
<thead>
471
-
<tr>
472
-
<th>Parameter Name</th>
473
-
<th>Data Type</th>
474
-
<th>Is it Required?</th>
475
-
<th>Description</th>
476
-
<th>Response (If required)</th>
477
-
</tr>
478
-
</thead>
479
-
<tbody>
480
-
<tr>
481
-
<td>`prompt`</td>
482
-
<td>String</td>
483
-
<td>Yes</td>
484
-
<td>The natural language query you want the RAG tool to process.</td>
485
-
<td>(Input parameter)</td>
486
-
</tr>
487
-
<tr>
488
-
<td>`toolId`</td>
489
-
<td>String</td>
490
-
<td>Yes</td>
491
-
<td>The unique GUID of the RAG tool to be queried.</td>
492
-
<td>(Input parameter)</td>
493
-
</tr>
494
-
</tbody>
475
+
<thead>
476
+
<tr>
477
+
<th>Parameter Name</th>
478
+
<th>Data Type</th>
479
+
<th>Is it Required?</th>
480
+
<th>Description</th>
481
+
</tr>
482
+
</thead>
483
+
<tbody>
484
+
<tr>
485
+
<td>`prompt`</td>
486
+
<td>String</td>
487
+
<td>Yes</td>
488
+
<td>The natural language query you want the RAG tool to process.</td>
489
+
</tr>
490
+
<tr>
491
+
<td>`toolId`</td>
492
+
<td>String</td>
493
+
<td>Yes</td>
494
+
<td>The unique GUID of the RAG tool to be queried.</td>
0 commit comments