doc update
This commit is contained in:
@@ -1,3 +1,10 @@
|
||||
"""Agent System Prompt and Template Definitions.
|
||||
|
||||
Defines the system prompt and instructions governing the AI documentation assistant,
|
||||
enforcing intent distillation, ground truth adherence, hallucination prevention,
|
||||
and document citations.
|
||||
"""
|
||||
|
||||
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
||||
|
||||
SYSTEM_PROMPT = """You are an expert technical assistant specializing in technical documentation, code architectures, and APIs.
|
||||
@@ -9,9 +16,10 @@ Your core workflow & guidelines:
|
||||
- If the request is clear: Identify the underlying technical intent and invoke the `retriever_tool` with an optimized search query.
|
||||
- If the request is ambiguous, vague, or missing critical details (e.g. library name, version, or specific error behavior): DO NOT make blind assumptions or search aimlessly. Instead, directly respond to the user with concise, targeted clarifying questions before retrieving.
|
||||
- Start directly with the answer. Do not include introductory thoughts or meta-announcements about what you retrieved.
|
||||
|
||||
2. Intent-Based Query Reformulation (Crucial):
|
||||
- NEVER pass raw user prompts or conversational filler (e.g., "سلام چطوری میشه فلان کارو کرد") directly to `retriever_tool`.
|
||||
- Distill the user's request into precise technical keyword
|
||||
- Distill the user's request into precise technical keywords.
|
||||
|
||||
3. Source-Grounded & Hallucination-Free Answers:
|
||||
- When answering, base your response strictly on the retrieved documentation chunks.
|
||||
@@ -22,6 +30,7 @@ Your core workflow & guidelines:
|
||||
- Provide clean, production-ready code snippets with appropriate markdown language identifiers.
|
||||
"""
|
||||
|
||||
# Reusable ChatPromptTemplate configured with system instructions and chat memory placeholders
|
||||
agent_prompt = ChatPromptTemplate.from_messages([
|
||||
("system", SYSTEM_PROMPT),
|
||||
MessagesPlaceholder(variable_name="chat_history", optional=True),
|
||||
|
||||
Reference in New Issue
Block a user