For the complete documentation index, see llms.txt. This page is also available as Markdown.

System Prompts

Last updated: 2025-11-14

Overview

The system prompt defines an AI assistant's behavior and response style. A carefully designed system prompt enables an AI assistant to assume a specific role, follow specific rules, and answer questions in a way that meets your business needs.

Include the AI assistant's role description and instructions, including the rules and SOPs it should follow when responding. Think of these as rules that must be followed for every response. Include only the essentials, as an excessive number of instructions may overwhelm the AI and cause it to disregard some rules. Store large amounts of data, or data that only needs to be retrieved when a related question is asked, in the knowledge base.

Metadata Processing

What Is Metadata?

Metadata is additional information that describes knowledge base documents, such as:

  • Document category

  • Creation date

  • Author information

  • Permission labels

  • Other custom attributes

In a RAG (retrieval-augmented generation) system, metadata plays an important role by helping the AI assistant filter and use knowledge base content more precisely.

Optimized Metadata Exclusion Logic

The MaiAgent platform has optimized its metadata processing logic to ensure that the system handles metadata more accurately.

Improvements

Removed duplicate exclusion logic

In previous versions, the system might repeatedly check and exclude certain metadata keys, causing unnecessary performance overhead. The new version removes this duplicate logic to ensure:

  • Improved processing efficiency: Reduces repeated checks

  • Clearer logic: Prevents the same exclusion rules from running multiple times

  • Better maintainability: Simplifies the code structure

Scope of impact

This optimization primarily affects the system's internal metadata processing. For users:

  • ✅ Metadata filtering continues to work normally

  • ✅ Retrieval performance is improved

  • ✅ Answer accuracy remains consistent

  • ✅ No changes to existing settings are required

Using Metadata in System Prompts

Basic Usage

In a system prompt, you can instruct the AI assistant how to use metadata:

Advanced Metadata Usage

Permission management

Recency control

Multilingual support

Metadata Best Practices

1. Define a Clear Metadata Structure

Create a standardized metadata schema:

2. Clearly Describe Metadata Usage Rules in the System Prompt

3. Review Metadata Settings Regularly

  • Confirm that metadata categories meet actual usage requirements

  • Check for unused metadata keys

  • Evaluate the impact of metadata on retrieval performance

Technical Details

Metadata Processing Flow

Performance Considerations

  • Indexing: Metadata is indexed when a file is uploaded

  • Query efficiency: Simple metadata filtering usually completes within milliseconds

  • Complex queries: Metadata filtering with multiple conditions may take longer

System Limitations

  • No more than 20 metadata keys are recommended for each document

  • Use short strings or numbers for metadata values

  • Avoid storing large amounts of text in metadata

System Prompt Example

You are a professional XXX AI assistant.

\ You should (enhance responses):

  1. Provide clear, accurate, and helpful answers

  2. Maintain a friendly and professional conversational tone

  3. Answer in the user's language; use Traditional Chinese when answering in Chinese

  4. Avoid giving harmful or inappropriate advice

  5. Respect user privacy and do not disclose sensitive information

  6. Use correct Traditional Chinese in responses

  7. Adjust the level of detail based on the context

  8. Provide additional suggestions or related information when appropriate

  9. Before answering, confirm that the user has provided sufficiently clear information; answer only after it is clear

  10. Use examples when appropriate to explain complex concepts

You should not (response restrictions):

  1. Spread misinformation or unverified claims

  2. Make biased or discriminatory statements

  3. Discuss illegal or inappropriate content

  4. Pretend to be a real person

  5. Exceed the AI assistant's capabilities

  6. For questions outside the scope of the knowledge base, reply, "Sorry, I am currently unable to answer this question"

System Prompt Template

Last updated

Was this helpful?