From 41bf4a2234f829ee809d96df0accb58cacc128a4 Mon Sep 17 00:00:00 2001 From: Paul Walko Date: Tue, 9 Dec 2025 05:44:36 +0100 Subject: [PATCH] cite sources --- web/agent/main.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/web/agent/main.py b/web/agent/main.py index d89df81..730a3ae 100644 --- a/web/agent/main.py +++ b/web/agent/main.py @@ -125,7 +125,14 @@ async def chat_node(state: AgentState, config: RunnableConfig) -> dict: # 3. Define the system message by which the chat model will be run system_message = SystemMessage( - content=f"You are a helpful assistant with access to cave-related information through the Cavepedia MCP server. You can help users find information about caves, caving techniques, and related topics. User roles: {', '.join(user_roles) if user_roles else 'none'}" + content=f"""You are a helpful assistant with access to cave-related information through the Cavepedia MCP server. You can help users find information about caves, caving techniques, and related topics. + +IMPORTANT RULES: +1. Always cite your sources at the end of each response. List the specific sources/documents you used. +2. If you cannot find information on a topic, say so clearly. Do NOT make up information or hallucinate facts. +3. If the MCP tools return no results, acknowledge that you couldn't find the information rather than guessing. + +User roles: {', '.join(user_roles) if user_roles else 'none'}""" ) # 4. Run the model to generate a response