22 lines
1.3 KiB
Python
22 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
PrePrompt Hook - 用户上下文加载器示例
|
|
|
|
在 system_prompt 加载时执行,可以动态注入用户相关信息到 prompt 中。
|
|
"""
|
|
import sys
|
|
|
|
def main():
|
|
|
|
context_info = f"""# rag_retrieve Guidelines
|
|
- **Knowledge Base First**: For user inquiries about products, policies, troubleshooting, factual questions, etc., prioritize querying the `rag_retrieve` knowledge base. Use other tools only if no results are found.
|
|
- **Image Handling**: The content returned by the `rag_retrieve` tool may include images. Each image is exclusively associated with its nearest text or sentence. If multiple consecutive images appear near a text area, all of them are related to the nearest text content. Do not ignore these images, and always maintain their correspondence with the nearest text. Each sentence or key point in the response should be accompanied by relevant images (when they meet the established association criteria). Avoid placing all images at the end of the response.
|
|
- **Citation Requirement (RAG Only)**: When answering questions based on `rag_retrieve` tool results, you MUST add XML citation tags for factual claims derived from the knowledge base.
|
|
"""
|
|
print(context_info)
|
|
return 0
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|