diff --git a/src/content/docs/agentic-ai/knowledge-integration/overview.mdx b/src/content/docs/agentic-ai/knowledge-integration/overview.mdx index bd701d86bf8..00aecf83409 100644 --- a/src/content/docs/agentic-ai/knowledge-integration/overview.mdx +++ b/src/content/docs/agentic-ai/knowledge-integration/overview.mdx @@ -13,17 +13,37 @@ redirects: This feature is currently provided as part of a preview program pursuant to our [pre-release policies](/docs/licenses/license-information/referenced-policies/new-relic-pre-release-policy). -New Relic AI uses large language models (LLMs) and New Relic's data platform to help you understand your system and how to better glean insights about the performance of those systems. It allows you to ask questions, troubleshoot issues, and explore telemetry data using plain language. +To provide more context-specific answers, New Relic AI can use a technique called Retrieval Augmented Generation (RAG) through the New Relic AI knowledge connector. While New Relic AI LLMs have a vast general knowledge, RAG enhances their responses. -To provide more context-specific answers, New Relic AI can use a technique called Retrieval Augmented Generation (RAG) through the New Relic AI knowledge connector. While foundation LLMs have a vast general knowledge, RAG enhances their responses by retrieving relevant information from your external data sources. +By setting up the New Relic AI knowledge connector, you can expect tangible outcomes such as faster incident resolution, more accurate and context-aware AI responses, and reduced manual searching across multiple documents. This unified approach helps your team make better decisions and respond to issues more efficiently. -## How it works -The New Relic AI knowledge connector integrates your internal knowledge with the analytical power of New Relic AI through the following three-step process: -- **Index:** The first step is to connect your content and knowledge bases, such as Confluence, to the New Relic AI platform. Once connected, the knowledge connector will perform an initial indexing of your documents. You can configure this process to run on a recurring basis, ensuring that New Relic AI always has access to the most up-to-date information as your documents evolve. -- **Retrieval:** When a user asks a question in New Relic AI, the system searches the indexed content for information relevant to the user's query. This step ensures that the context is pulled directly from your trusted, internal documentation. -- **Generation:** Finally, the system combines the retrieved information with the powerful generative capabilities of the underlying LLM. This synthesis produces a comprehensive and context-aware answer, grounded in your specific data and best practices. +## Use cases and value + +The following examples show how the knowledge connector integration helps tackle challenges like fragmented documentation and slow incident response by surfacing relevant information. + + + + +When a critical incident occurs, you face a time-consuming investigation because historical context is fragmented across multiple sources like Confluence and runbooks. + +The knowledge connector integrates all of these disparate sources, transforming the Retro DocSearch tool into a powerful historical intelligence engine that provides all the context in one place. This allows the tool to: -This RAG approach significantly improves the accuracy and relevance of the responses, reducing the likelihood of generic or hallucinated answers. +* Provide an immediate summary of an original incident's root cause. +* Present specific actionable steps from the runbook that resolved the issue. +* Identify the names of the experts or teams who solved it before. + + + + +When an IT issue reoccurs, you'll often have to spend valuable time trying to figure out if it has happened before. Your historical context is often scattered across separate retrospective or postmortem documents, which can make it difficult to quickly find the information you need to resolve a recurring incident. + +By leveraging RAG, the New Relic AI platform stores information from your existing retrospective or postmortem documents for future reference. This helps you save valuable time during an incident. The What happened previously widget, with RAG implementation, allows you to: + +* Quickly find relevant information and learn from previous incidents. +* Get a summary of similar past issues, along with links to the retrospective documents for detailed analysis. + + + ## Key features With New Relic AI knowledge connector, you can: @@ -35,17 +55,40 @@ With New Relic AI knowledge connector, you can: - "Show me the runbook for a `database connection limit exceeded` error." - - At this time, all indexed documents can be retrieved by all users within your organization's New Relic account. Before you begin indexing, ensure that the documents you intend to connect comply with your internal data security and privacy policies for use of the services. - + + At this time, all indexed documents can be retrieved by all users within your organization's New Relic account. Please verify that only appropriate content is indexed, as there's currently no option to restrict access or redact information after indexing. + +## How it works + +High-level visual of Knowledge connector + +The knowledge connector securely integrates with your content and knowledge bases, such as Confluence, to enhance New Relic AI's responses with your specific organizational knowledge. The process follows these steps: + +- **Index:** Once your knowledge bases are connected to the New Relic AI platform, the knowledge connector performs an initial indexing of your documents. You can configure this process to run on a recurring basis, ensuring that New Relic AI always has access to the most up-to-date information as your documents evolve. + +- **Retrieval:** When you ask a question in New Relic AI, the system searches the indexed content for the most relevant information. This step ensures that the context is pulled directly from your trusted, internal documentation. + +- **Generation:** Finally, the system combines the retrieved information with the powerful generative capabilities of the underlying LLM. This synthesis produces a comprehensive and context-aware answer, grounded in your specific data and best practices. + +If a query doesn't require your organizational knowledge, New Relic AI will generate an answer using the underlying LLM's vast general knowledge. In both cases, the goal is to provide you with the most relevant and accurate information possible. + ## Prerequisites -To begin using the New Relic AI knowledge connector: -- **Enable New Relic AI:** Before you can configure the knowledge connector, New Relic AI must be enabled for your account. -- **Configure user permissions for indexing:** To manage which users can index data sources (which may have future billing implications), you must grant the appropriate permissions. Users responsible for setting up and managing the knowledge connectors will need the “Org Product Admin” role. -You have two options to assign this role: +Before you begin using the New Relic AI knowledge connector, ensure that: + +- Only documents suitable for organization-wide access are indexed. +- Sensitive information is redacted. +- All the documents to be indexed comply with your organization's internal data security and privacy policies. +- New Relic AI is enabled for your account. +- Appropriate user permissions are configured for indexing (you'll need the “Org Product Admin” role, which allows you to perform actions—such as set up and manage the knowledge connectors—that may have future billing implications). + +You have two options to assign the Org Product Admin role: - **Apply to an existing user group:** Add the Org Product Admin role to an existing group of users who will be responsible for managing the knowledge connectors. - **Create a dedicated group:** For more granular control, create a new user group specifically for this purpose and assign the Org Product Admin role to that group. diff --git a/src/content/docs/apis/nerdgraph/examples/nerdgraph-rag.mdx b/src/content/docs/apis/nerdgraph/examples/nerdgraph-rag.mdx index 80448ee8a92..7c2baf90ead 100644 --- a/src/content/docs/apis/nerdgraph/examples/nerdgraph-rag.mdx +++ b/src/content/docs/apis/nerdgraph/examples/nerdgraph-rag.mdx @@ -1,5 +1,5 @@ --- -title: "NerdGraph tutorial: Configure RAG Tools and Documents" +title: "NerdGraph tutorial: Set up RAG integration" metaDescription: Enhance New Relic AI with RAG (Retrieval Augmented Generation) redirects: - /docs/agentic-ai/knowledge-integration/apis-and-communication-protocol @@ -12,12 +12,28 @@ freshnessValidatedDate: never This feature is currently provided as part of a preview program pursuant to our [pre-release policies](/docs/licenses/license-information/referenced-policies/new-relic-pre-release-policy). -With New Relic, you can enhance New Relic AI agents with RAG. This means that you can associate documentation, runbooks, incident retros and even source code with your services, giving New Relic AI better insight into issues with your system. +With New Relic, you can enhance New Relic AI agents with Retrieval Augmented Generation (RAG) by associating your documentation, runbooks, incident retros, and even source code with your services. This process gives New Relic AI better insight into issues with your system. The tutorial outlines how to obtain your organization ID, create a RAG tool, and add your documents to the platform using the Blob API. -## Get Started with RAG [#get-started] +After adding your documents, you will create a relationship to associate them with the RAG tool. You can then verify your configuration by querying the relationships between the RAG documents and the RAG tool. The final step is to query the RAG tool itself to retrieve relevant, indexed information. -### Obtain your organization ID [#get-org-id] +To learn more about the knowledge connector, refer to [New Relic AI Knowledge connector](/docs/agentic-ai/knowledge-integration/overview). + + Before performing the following steps, ensure that you have "Org Product Admin" permissions. + + +To start indexing your content and benefit from the knowledge connector with New Relic AI, follow these mentioned steps: + +## Task 1: Create your RAG tool [#create-your-rag-tool] + + + + +Organization ID uniquely identifies your account and ensures that any RAG tool you create, documents you upload, or relationships you establish are associated with your organization in New Relic. + +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. + +### Sample query ```graphql { actor { @@ -27,11 +43,68 @@ With New Relic, you can enhance New Relic AI agents with RAG. This means that yo } } ``` + + + +A RAG tool acts as a specialized container for organizing related documents and resources in New Relic. A clear name and accurate description for your RAG tools helps the LLM select the right tool for each prompt, ensuring relevant and context-aware responses. + +To create a new RAG tool in your New Relic account, run the following `entityManagementCreateRagTool` mutation: + +1. Make sure to replace `${ORGANIZATION_ID}` with your actual organization ID obtained in the previous step. +2. If successful, you'll receive an `id` for your RAG tool. -### Create a RAG Tool [#create-rag-tool] +### Input parameters -It should be noted - the name and description of your RAG Tool are extremely important! The LLM will choose to leverage a tool when responding to a prompt based on the accuracy of a tool's name and description. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Parameter NameData TypeIs it Required?Description
`ragToolEntity`ObjectYesThe input object that contains the configuration for the new RAG tool.
`description`StringYesA clear and accurate description of the RAG tool's purpose.
`name`StringYesThe unique name for your RAG tool.
`scope`ObjectYesAn object defining the context in which the tool will be created.
`scope.id`StringYesThe unique ID of your organization (`${ORGANIZATION_ID}`).
`scope.type`StringYesThe type of the scope, which must be `ORGANIZATION`.
+### Sample mutation ```graphql mutation { entityManagementCreateRagTool( @@ -48,14 +121,73 @@ mutation { } ``` -### Upload a document to the Blob API [#upload-document] +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. +
+
+ +## Task 2: Index your documents [#index-your-documents] + + + - All indexed documents are visible to all users within your organization. Make sure the documents you index comply with your internal policies for use of the services. + All indexed documents are visible to all users within your organization. Make sure the documents you index comply with your internal policies, and do not upload sensitive or private data. -* Note that this specific step is not through NerdGraph. This is because NerdGraph does support file uploads through it's APIs. +### The Blob API and its purpose +The Blob API is a New Relic service designed for uploading files, such as documentation and runbooks, to your account. NerdGraph is optimized for structured data queries and mutations and not for efficient transfer of files, so the Blob API is required for uploading documents. + +### Authentication requirements +You need a valid New Relic API key with permissions to upload documents. To get the API key for uploading a document to New Relic using the Blob API: + +1. Log in to your [New Relic](https://one.newrelic.com/) account. +2. Create and manage your API keys from the [API keys UI page](https://one.newrelic.com/administration/api-keys). +3. Click **Create a key**, and fill the required details (or use an existing one with the required permissions). +4. Click **Create a key** and copy the generated key (it'll look like NRAK-XXXXXXXXXX). + +Here's an example of how to upload a document using a `curl` `bash` command: +### Input parameters + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Parameter NameData TypeIs it Required?Description
`Api-Key`StringYesYour New Relic API key for authentication.
`NewRelic-Entity`JSON ObjectYesMetadata about the document, such as its name.
`Content-Type`StringYesThe format of the file being uploaded (e.g., `application/json`).
`payload` (`@incidents.json`)FileYesThe document file you are uploading, specified by its file path.
+ + +### Sample query ```shell curl -X POST https://blob-api.one-service.newrelic.com/v1/e/organizations/$ORGANIZATION_ID/RagDocuments \ -H 'Api-Key: NRAK-XXXXXXXXXX' \ @@ -64,7 +196,29 @@ curl -X POST https://blob-api.one-service.newrelic.com/v1/e/organizations/$ORGAN -d @incidents.json ``` -The response will look like this: +### Sample response + + + + + + + + + + + + + + + + + + + + + +
ResponseData TypeDescription
`entityGuid`StringThe unique identifier for the uploaded RAG document.
`blobVersionEntity`ObjectRepresents the version of the uploaded blob.
```json { @@ -72,8 +226,39 @@ The response will look like this: "blobVersionEntity": null } ``` +### Next steps + +After uploading your document, it is indexed and becomes available for New Relic AI to search and retrieve. You must save the `entityGuid` from the response to create a relationship with your RAG tool or to query the document in NerdGraph. -### View the RAG Document entity represented in NerdGraph +
+ + +After a document is uploaded via the Blob API, running this query confirms that the upload was successful and that the document has been properly registered as a RAG document entity with its own unique identifier and properties. + +#### Input parameters + + + + + + + + + + + + + + + + + + +
Parameter NameData TypeIs it Required?Description
`id`StringYesThe unique GUID of the RAG document to be retrieved.
+ +### Sample query + +In the query below, replace the `${RAG_DOCUMENT_GUID}` placeholder with the `entityGuid` you received in the previous step. ```graphql { @@ -96,9 +281,85 @@ The response will look like this: } ``` -Now that we have a RAG Tool and a RAG Document, we need to associate them with each other. This is done via the Entity Management APIs in NerdGraph. +This query will return the following details about your RAG document: + +- `id`: The unique ID of the RAG document. +- `name`: The name of the RAG document. +- `blob { url }`: The URL to access the uploaded document. +- `type`: The type of the entity, which in this case is `EntityManagementRagDocumentEntity`. + +
+ + +Now that you've created a RAG tool, uploaded your document, and verified that the upload was successful, the next step is to associate the RAG tool and the RAG document thereby making your document searchable and usable by New Relic AI. To do this, run the `entityManagementCreateRelationship` mutation: + +1. Replace `${RAG_DOCUMENT_GUID}` with the `entityGuid` from the response of the document upload via the Blob API. +2. Replace `${RAG_TOOL_GUID}` with the `id` from the response of the RAG tool creation mutation. + +### Input parameters -### Create a relationship between the RAG Document and the RAG Tool + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Parameter NameData TypeIs it Required?Description
`relationship`ObjectYesThe input object that contains the details for the relationship.
`source`ObjectYesThe source entity of the relationship, which is the RAG document.
`source.scope`StringYesThe scope of the source entity, which must be `ORGANIZATION`.
`source.id`StringYesThe unique GUID of the RAG document (`${RAG_DOCUMENT_GUID}`).
`target`ObjectYesThe target entity of the relationship, which is the RAG tool.
`target.scope`StringYesThe scope of the target entity, which must be `ORGANIZATION`.
`target.id`StringYesThe unique GUID of the RAG tool (`${RAG_TOOL_GUID}`).
`type`StringYesThe type of the relationship, which must be `"INDEXED_FOR"`.
+ +### Sample mutation ```graphql mutation { @@ -129,8 +390,59 @@ mutation { } } ``` +
+
+ +## Task 3: Retrieve relevant information [#retrieve-relevant-information] + + + + +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. + +- Replace `${RAG_DOCUMENT_ID}` with the `entityGuid` of your uploaded document. -### Query to see relationships between RAG Documents and RAG Tools + +### Input parameters + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Parameter NameData TypeIs it Required?Description
`relationships`QueryYesThe query to retrieve relationships between entities.
`filter`ObjectNoAn object used to filter the relationships based on attributes.
`filter.sourceId`ObjectNoAn object to filter by the source entity's unique identifier.
`filter.sourceId.eq`StringNoThe unique GUID of the RAG document to match.
+ +### Sample query ```graphql { @@ -152,10 +464,39 @@ mutation { } ``` -### Query the RAG Tool +
+ + +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. + +### Input parameters -You can query your RAG Tool and receive chunked matches based on the documents indexed for a given tool. You may use New Relic AI to summarize the returned chunk matches, or you may use the NerdGraph APIs to retrieve the match and use your own AI on your own systems. + + + + + + + + + + + + + + + + + + + + + + + +
Parameter NameData TypeIs it Required?Description
`prompt`StringYesThe natural language query you want the RAG tool to process.
`toolId`StringYesThe unique GUID of the RAG tool to be queried.
+### Sample query ```graphql { actor { @@ -174,3 +515,6 @@ You can query your RAG Tool and receive chunked matches based on the documents i } } ``` +The response will include chunked matches from your indexed documents, which you can use directly or summarize with New Relic AI. +
+
\ No newline at end of file diff --git a/static/images/High-Level Visual Overview of the New Relic AI Knowledge Connector.webp b/static/images/High-Level Visual Overview of the New Relic AI Knowledge Connector.webp new file mode 100644 index 00000000000..19c24235b95 Binary files /dev/null and b/static/images/High-Level Visual Overview of the New Relic AI Knowledge Connector.webp differ