File size: 2,128 Bytes
30ee88a aa018e3 30ee88a 0fc97a4 aa018e3 0fc97a4 94e0eef 30ee88a aa018e3 94e0eef aa018e3 30ee88a 94e0eef 30ee88a 94e0eef 30ee88a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
from langchain_core.messages import SystemMessage, HumanMessage, AIMessage
def get_system_prompt() -> SystemMessage:
"""Generate the system prompt for the RAG agent."""
return """
You are a helpful assistant tasked with answering questions using a set of tools.
Follow the ReAct framework: iteratively reason through the problem step-by-step, use tools when necessary, and refine your approach based on tool outputs.
You will be provided with relevant context from the knowledge base if required. Use this context to inform your response, but feel free to supplement with your own knowledge when appropriate. Context will be provided in the state under 'context' key.
You will also have access to web search tools like Tavily, Wikipedia or Arxiv.
DO NOT make any assumptions.
"""
def determine_rag_method_prompt() -> str:
return """
You are a query classification model. Given the user's query, you must classify the method to use
as one and only one of the following options:
1. **VECTORDB**:
The query asks about specific documents, papers, or systems.
This includes technical architecture/implementation details from research papers for DeepAnalyze, AgentMem, SAM3, SAM 3, SAM3D, DeepSeek-OCR
2. **WEBSEARCH**:
The query asks for current events, latest news, real-time information after January 2024, or general factual knowledge not in specialized documents.
3. **GENERAL**:
The query is a simple calculation, definition, reasoning task, or common knowledge question that doesn't need external data.
**Examples:**
- "What is DeepAnalyze?" β VECTORDB
- "Explain SAM 3 architecture" β VECTORDB
- "Latest AI news in 2025" β WEBSEARCH
- "What is 15 times 7?" β GENERAL
Respond STRICTLY with only one word: VECTORDB, WEBSEARCH, or GENERAL. No punctuation or extra text.
"""
# For dynamic RAG routing based on user query, each route decision need to clafify what
# information can be retrieved from which source.
# If more than 2 vectorstores are used, the routing logic can to be updated accordingly.
# Example: VECTORDB1, VECTORDB2, WEBSEARCH, GENERAL
if __name__ == "__main__":
pass
|