Convert all Chinese comments, docstrings, logger/print output, HTTPException detail messages, and API response messages to English across the entire codebase. Functional zh/ja localized strings (e.g. prompt templates, timezone display names, date formats) are preserved as-is. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
30 lines
768 B
Python
30 lines
768 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
PreMemoryPrompt Hook - User context loader example
|
|
|
|
Executed when the fact extraction prompt (FACT_RETRIEVAL_PROMPT) is loaded,
|
|
decides whether to enable the retrieval policy that forbids using the model's
|
|
own knowledge based on an environment variable.
|
|
"""
|
|
import os
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
|
|
def main():
|
|
enable_self_knowledge = (
|
|
os.getenv("ENABLE_SELF_KNOWLEDGE", "false").lower() == "true"
|
|
)
|
|
policy_name = (
|
|
"retrieval-policy.md"
|
|
if enable_self_knowledge
|
|
else "retrieval-policy-forbidden-self-knowledge.md"
|
|
)
|
|
prompt_file = Path(__file__).parent / policy_name
|
|
print(prompt_file.read_text(encoding="utf-8"))
|
|
return 0
|
|
|
|
|
|
if __name__ == '__main__':
|
|
sys.exit(main())
|