Skip to main content

Use knowledge base

You can use a RAG knowledge base in the AI agent.

The agent gets small fragments of text (chunks) from the base for each user request and takes them into account when generating a response.

Connect knowledge base to AI agent

  1. Prepare a knowledge base in Jay Knowledge Hub.
  2. Connect the knowledge base in JAICP.
  3. In the AIAgent tag, specify the name of the knowledge base secret in the knowledgeBase parameter.
  4. In the knowledgeBaseConfidence parameter, you can also specify the confidence level of the knowledge base: from 0.0 to 1.0. Then the agent only gets those chunks from the knowledge base that have a relevance score above this threshold.
tip

When searching for relevant chunks, knowledge base settings are used.

Example

The example below shows an agent who is acting as a support specialist.

connection to the knowledge base has been already created in JAICP. Name of the knowledge base secret is common_problems. This knowledge base contains solutions to common problems reported to technical support.

In the dialog, the agent:

  1. Retrieves chunks from the knowledge base for each user request. The agent only gets those chunks for which the relevance score is higher than 0.8.

    In this example, the chunks contain solutions to the problems similar to the user’s problem.

  2. Uses information from these chunks to create instructions.

  3. Sends the instructions to the user.

AIAgent:
id = support_agent
model = gpt-4o
# Role in the dialog
role = Technical support specialist
# Goal in the dialog
goal = Help the user solve the problem
instructions = Give instructions with detailed steps
# Knowledge base secret name
knowledgeBase = common_problems
# Knowledge base confidence level
knowledgeBaseConfidence = 0.8