Skip to main content

Building a Knowledge Agent from Scratch

This case study uses an AI technology company specializing in large language model research as an example to demonstrate how to build an enterprise-level intelligent Q&A system from scratch.

The company has accumulated a large amount of high-value knowledge such as technical papers, API documentation, and market reports internally, but these are scattered and isolated, making it difficult for the intelligent assistant to provide accurate and unified answers.

To address this, we will build an enterprise-level knowledge base to centrally integrate and manage all knowledge resources, providing real-time and reliable knowledge support for the intelligent assistant.

This tutorial will guide you through the complete process from creating an enterprise space, establishing knowledge bases, uploading and processing documents, to finally integrating with the Agent, enabling the assistant to provide professional and high-quality answers.

Creating the Enterprise Knowledge Space "AI Technology"

  1. Open the SERVICEME NEXT platform, click "Management" in the left navigation bar to enter the management interface.
  2. Click "Knowledge Management" to enter the enterprise space management interface.
  3. Click the “⚙️” next to the enterprise space to enter the enterprise space configuration page.
  4. Click "Add New" on the right to enter the new enterprise space page.
  5. Enter the following basic information:
  • ID: enter 123456.
  • Title: enter AI Technology.
  • Icon: upload an image from your local device.
  • Order: the order of this space among enterprise spaces. In this case, set to 1.
  • Description: for example, AI Technology.
  1. Click "Save" to successfully create the enterprise space.

💡 Tip: Creating an enterprise knowledge space requires relevant permissions. Please ensure you have creation permissions before proceeding.

Creating Enterprise Knowledge Bases

Create enterprise knowledge bases: "Multimodal Model Technology Library" and "Large language model knowledge bas"

  • To efficiently manage and utilize enterprise knowledge assets, it is recommended to divide knowledge bases according to business lines, projects, or topics. This approach has two main advantages:
    • Facilitates precise authorization: The smallest unit for permission configuration is the knowledge base. Clear classification makes it easier to assign precise document access permissions to different roles (e.g., algorithm engineers, product managers).
    • Improves retrieval efficiency: Subsequent intent recognition and Q&A systems usually use knowledge bases as the retrieval scope. The more precise the classification, the faster the system can locate information and the more accurate the answers. Operation example: Following the above principles, we create two separate knowledge bases under the AI Technology enterprise space.

Creation Steps

  1. Return to the enterprise space management interface.
  2. Click the newly created enterprise space AI Technology, then click "Add New" in the upper right corner.
  3. In the pop-up create knowledge base page, enter the following general information:
    • Name: enter Multimodal Model Technology Library
    • Type: When creating the knowledge base, the enterprise space (e.g., AI Technology) is already selected and will be automatically filled here.
    • Security Level: select the security level. In this case, choose internal.
    • Description: for example, Multimodal Model Technology Library.
    • Order: the order of this knowledge base within the enterprise space. In this case, set to 1.
    • Description: for example, Multimodal Model Technology Library.
    • Storage Quota (optional): adjust within 0-1GB according to actual needs.
    • File Size Limit (optional): supports custom upload file size limits for the knowledge base. No specific limit set in this case.
    • Supported File Formats (optional): supports custom file formats for the knowledge base. No specific limit set in this case.
  4. Click "Save" to successfully add the "Multimodal Model Technology Library" knowledge base under the "AI Technology" enterprise space.
  5. Similarly, create another knowledge base named Large language model knowledge bas with order 2.

💡 Tip: After customizing upload file size and file formats, if uploaded files do not meet the restrictions, the system will prompt accordingly.

Creating a Personal Knowledge Base "Personal knowledge base"

In the enterprise knowledge management system, besides the public knowledge bases for team collaboration, employees also need a private knowledge management space. Personal knowledge bases complement enterprise knowledge bases by protecting personal privacy while laying the foundation for future knowledge sharing.

💡 Tip: My Space cannot create spaces, only knowledge bases, and has a built-in default knowledge base. Enterprise spaces can create different spaces, under which knowledge bases can be created.

  1. Open the SERVICEME NEXT platform, click Knowledge in the left navigation bar to enter the Knowledge Agent interface.
  2. Click "My Space", then click "Add Knowledge Base" in the upper right corner.
  3. Fill in the following basic information:
  • Knowledge Base Name: enter Personal knowledge base
  • Description: for example, Personal knowledge base
  1. Click "Save" to successfully create the personal knowledge base.

Knowledge Base Space Configuration

💡 Tip: Knowledge base space settings require management permissions for the enterprise space. Please ensure you have this permission before modifying knowledge base settings.

General Settings

General settings of the knowledge base are the information filled in when creating the knowledge base, including knowledge base name, type, security level, description, storage quota, file size limit, supported file formats.

File Settings

Indexing Method:

  • Basic Parsing: Suitable for general text recognition; choose this when files do not contain tables or images.
  • OCR Intelligent Parsing:
    • Intelligent Model Parsing Mode: Calls integrated models to generate documents. Note that in complex cases such as low resolution, generation quality may be affected. Helps LLM generate high-quality answers, suitable for documents containing many tables.
    • Azure AI Document Intelligence: Basic mode: provides more accurate text extraction, suitable for complex documents including printed and handwritten text extraction. Layout mode: supports text recognition, table restoration, and image recognition, suitable for extracting text, tables, and document structure.
  • Recommended in this example: OCR Intelligent Parsing with "Intelligent Model Parsing Mode", which can more accurately extract structured information from documents, ensuring completeness and accuracy of subsequent knowledge retrieval.

Segmentation Mode:

  • Default Segmentation: Uses large models for semantic segmentation, improving segmentation accuracy but consuming more tokens.
  • Fine Segmentation Mode: Text is first split by a maximum of 1024 characters, then each segment is further subdivided by 200 characters, each small segment having an independent index.
  • Custom Mode: Users can customize the maximum number of characters per segment, e.g., set to 500, then split every 500 characters.
  • Recommended in this example: Default Segmentation, which ensures coherence of related concepts and context, improving retrieval accuracy.

Retrieval Settings:

  • File Preview: Controls whether files (documents, images, videos, audio) in the knowledge base support online preview.
  • File Indexing: Sets whether various resources (documents, images, videos, audio) in the knowledge base are included in global search indexing. If disabled, corresponding resources cannot be found via keyword search.
  • Recommended in this example: Enable all, ensuring all technical documents, code specifications, and research reports can be fully searched and previewed online, facilitating quick lookup and reference by R&D personnel.

File Summary Generation:

  • Automatically generates content summaries for documents in the knowledge base to facilitate quick browsing of core information. If disabled, newly uploaded documents will no longer automatically generate summaries.
  • If users often ask questions like "Please summarize the XXX document" or "What does the file named XXX describe?", this feature should be enabled.
  • Recommended in this example: Enabled by default, automatically generating summaries for technical papers, API documentation, etc., to better support document summarization queries.

Metadata

Metadata is data used to describe and identify file attributes and background information, such as file size, name, location, etc.

Recommendations:

  • It is recommended to configure exclusive metadata for each document, extracting and filling in key information such as file type (e.g., training log) and date information (e.g., October 30) to enable precise retrieval and version tracking.
  • For example: when a user asks "Find the training logs generated on October 30"
  • The system naturally prioritizes matching documents labeled with metadata "October 30" and "training log", quickly locating the target file instead of returning all types of logs or historical documents.

Member Permission Configuration

Assign different document access permissions based on user roles.

For example:

  • Roles and needs:

    • Algorithm Engineer: participates in both "Multimodal Model" and "Large Language Model" project groups, needs access to all technical documents.
    • Product Manager: responsible only for the "Large Language Model" product line, only needs to view related product documents and API descriptions.
  • Permission setting plan:

    • Establish two independent knowledge bases: "Multimodal Model Technology Library" and "Large Language Model Knowledge Base".
    • Through permission configuration, grant algorithm engineers full access to both knowledge bases, while product managers can only access non-core technical documents in the "Large Language Model Knowledge Base".
  • Advanced scenarios: Combined authorization: Consider and list more complex scenarios (e.g., project group collaboration, inter-departmental confidentiality), and inform users how to set combined permissions.

  1. Go to "Management -> Permissions -> Role Management"
  2. Click the "+" next to the role group to create a role group. Name it AI Technology, order 1.
  3. In the AI Technology role group, click the "Add New" button on the right to create a new role.
  4. Enter basic role information: role name, group, description. (If AI Technology is selected earlier, it will be auto-filled here.)
  • In this example, create two roles: algorithm engineer and product manager.
  1. Click "..." on the right side of the role, select "Function Authorization".
  • Authorize algorithm engineer with full access to both "Multimodal Model Technology Library" and "Large Language Model Knowledge Base".
  • Authorize product manager only to the "Large Language Model Knowledge Base".

File Operations

Creating a New Folder

  • Both My Space and Enterprise Space support folder creation.
  • On the knowledge base page, click "New Folder" on the right, enter the folder name (e.g., literature), then click "Confirm".
  • The images show the process of adding a folder named "literature" in the "Large language model knowledge bas" knowledge base.

Uploading Files

  • Upload files in both My Space and Enterprise Space.
  • Click "Upload Files" in the upper right corner, select the files to upload, click "Open", then click "Confirm Upload" to successfully upload files to the knowledge base.
  • The images show the process of uploading files into the "literature" folder.

💡 Tip: Supports uploading up to 10 files simultaneously, with each file size not exceeding 100MB.

Creating the "AI Technology" Agent

Regular Creation

After creating the knowledge bases, we will create an intelligent Agent using the regular method, dedicated to quickly searching technical materials.

✅ Tip: The creation process can refer to the tutorial "Building a Simple Agent Assistant from Scratch".

In this example, the Agent is named AI Technology, positioned as the authoritative assistant in the company's internal AI technology domain, focusing on providing fast, accurate, and traceable technical material search and Q&A services based on the company's internal knowledge bases.

The Agent creation interface is as follows:

Configuring the "AI Technology" Agent

  1. Prompt Configuration
  • Fill in brief prompt information in the Prompt input box.
  • Click "Intelligent Generation" to have the system call the model to automatically expand the prompt and generate a more complete version.
  • The prompt in this example is:
##Role
You are an AI technology expert, specializing in providing information, guidance, and solutions related to artificial intelligence technologies, concepts, and applications.

##Skills
1. Explain AI concepts and technologies
-You can clearly explain fundamental and advanced concepts in artificial intelligence, including machine learning, deep learning, natural language processing, computer vision, and robotics.
-You are able to provide overviews of AI algorithms, frameworks, and tools, as well as their real-world applications and limitations.

2. Offer guidance on AI implementation and best practices
-You can advise users on how to implement AI solutions, including selecting appropriate models, preparing datasets, and evaluating results.
-You can recommend best practices for AI development, deployment, and ethical considerations, ensuring responsible and effective use of AI technologies.

##Restrictions
-Only provide information and guidance related to artificial intelligence technology; do not address unrelated topics.
-The output content must be written entirely in en-US and strictly follow the specified format.

  1. Greeting Configuration
  • You can fill in a custom greeting or click "Intelligent Generation" to automatically generate a welcome message.
  • The greeting in this example is:
Hello, I am your AI Technology assistant, here to help you explore and understand various aspects of artificial intelligence technology.

[What are the latest trends in AI technology?] [How can AI technology be applied in different industries?] [What are the benefits and challenges of using AI technology?]

  1. Model Group Settings
  • The model group (e.g., Standard Model Group) is selected during Agent creation and will be automatically filled here.

  • You can switch as needed, noting:

    • Model group contents may differ in different environments;
    • Model groups are pre-configured by administrators;
    • The Standard Model Group used in this example includes models: gpt-4.1, deepseek-ai/DeepSeek, gpt-4.1-mini.

  1. Knowledge Base Configuration

Configuring knowledge bases is a key step to ensure the Agent can answer based on professional knowledge. Please follow the steps below:

  • Click the “+” button next to Knowledge Source to open the knowledge base selection popup;

  • Find and select the prepared knowledge bases from the organizational space category list:

    • “Multimodal Model Technology Library”
    • “Large language model knowledge bas”
  • Click "Confirm" at the bottom right to add the databases; (keep the default knowledge base configuration)

  • After returning to the configuration interface, confirm that the selected knowledge bases are correctly displayed in the Agent configuration panel;

  • Finally, click the "Publish" button in the upper right corner to ensure all configurations take effect.

By creating enterprise or personal knowledge bases, uploading files, building an Agent, and configuring its knowledge bases, you can complete the full process of building a Knowledge Agent from scratch.

Through this process, enterprises can centrally integrate and efficiently manage internal knowledge resources, providing real-time and trustworthy knowledge support for intelligent assistants, helping business decision-making and team collaboration become more intelligent.