Tom Claude commited on
Commit
42e8b59
·
1 Parent(s): 6466c00

Remove LangChain dependency from prompts

Browse files

Replace langchain_core.PromptTemplate with simple string formatting class to eliminate LangChain dependency completely.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (1) hide show
  1. src/prompts.py +28 -18
src/prompts.py CHANGED
@@ -1,7 +1,5 @@
1
  """Prompt templates for OSINT investigation assistant"""
2
 
3
- from langchain_core.prompts import PromptTemplate
4
-
5
 
6
  SYSTEM_PROMPT = """You are an OSINT investigation assistant. Your responses must be SHORT and FOCUSED.
7
 
@@ -44,12 +42,6 @@ Respond with:
44
  **Notes:** [1-2 sentences explaining why these specific tools]"""
45
 
46
 
47
- INVESTIGATION_PROMPT = PromptTemplate(
48
- template=INVESTIGATION_PROMPT_TEMPLATE,
49
- input_variables=["query", "context"]
50
- )
51
-
52
-
53
  FOLLOWUP_PROMPT_TEMPLATE = """You are an expert OSINT investigation assistant continuing a conversation.
54
 
55
  CONVERSATION HISTORY:
@@ -64,12 +56,6 @@ RELEVANT OSINT TOOLS FROM DATABASE:
64
  Based on the conversation history and the user's follow-up question, provide a helpful response. If they're asking for clarification or more details about a specific tool or technique, provide that information. If they're asking a new question, follow the structured investigation methodology format."""
65
 
66
 
67
- FOLLOWUP_PROMPT = PromptTemplate(
68
- template=FOLLOWUP_PROMPT_TEMPLATE,
69
- input_variables=["chat_history", "query", "context"]
70
- )
71
-
72
-
73
  TOOL_RECOMMENDATION_TEMPLATE = """Based on this investigation need: {query}
74
 
75
  Available tools:
@@ -84,22 +70,46 @@ Recommend the top 3-5 most relevant tools and explain why each is suitable. Form
84
  """
85
 
86
 
87
- TOOL_RECOMMENDATION_PROMPT = PromptTemplate(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
  template=TOOL_RECOMMENDATION_TEMPLATE,
89
  input_variables=["query", "context"]
90
  )
91
 
92
 
93
- def get_investigation_prompt(include_system: bool = True) -> PromptTemplate:
94
  """Get the main investigation prompt template"""
95
  return INVESTIGATION_PROMPT
96
 
97
 
98
- def get_followup_prompt() -> PromptTemplate:
99
  """Get the follow-up conversation prompt template"""
100
  return FOLLOWUP_PROMPT
101
 
102
 
103
- def get_tool_recommendation_prompt() -> PromptTemplate:
104
  """Get the tool recommendation prompt template"""
105
  return TOOL_RECOMMENDATION_PROMPT
 
1
  """Prompt templates for OSINT investigation assistant"""
2
 
 
 
3
 
4
  SYSTEM_PROMPT = """You are an OSINT investigation assistant. Your responses must be SHORT and FOCUSED.
5
 
 
42
  **Notes:** [1-2 sentences explaining why these specific tools]"""
43
 
44
 
 
 
 
 
 
 
45
  FOLLOWUP_PROMPT_TEMPLATE = """You are an expert OSINT investigation assistant continuing a conversation.
46
 
47
  CONVERSATION HISTORY:
 
56
  Based on the conversation history and the user's follow-up question, provide a helpful response. If they're asking for clarification or more details about a specific tool or technique, provide that information. If they're asking a new question, follow the structured investigation methodology format."""
57
 
58
 
 
 
 
 
 
 
59
  TOOL_RECOMMENDATION_TEMPLATE = """Based on this investigation need: {query}
60
 
61
  Available tools:
 
70
  """
71
 
72
 
73
+ class SimplePromptTemplate:
74
+ """Simple prompt template using string formatting"""
75
+
76
+ def __init__(self, template: str, input_variables: list):
77
+ self.template = template
78
+ self.input_variables = input_variables
79
+
80
+ def format(self, **kwargs) -> str:
81
+ """Format the template with provided variables"""
82
+ return self.template.format(**kwargs)
83
+
84
+
85
+ INVESTIGATION_PROMPT = SimplePromptTemplate(
86
+ template=INVESTIGATION_PROMPT_TEMPLATE,
87
+ input_variables=["query", "context"]
88
+ )
89
+
90
+
91
+ FOLLOWUP_PROMPT = SimplePromptTemplate(
92
+ template=FOLLOWUP_PROMPT_TEMPLATE,
93
+ input_variables=["chat_history", "query", "context"]
94
+ )
95
+
96
+
97
+ TOOL_RECOMMENDATION_PROMPT = SimplePromptTemplate(
98
  template=TOOL_RECOMMENDATION_TEMPLATE,
99
  input_variables=["query", "context"]
100
  )
101
 
102
 
103
+ def get_investigation_prompt(include_system: bool = True) -> SimplePromptTemplate:
104
  """Get the main investigation prompt template"""
105
  return INVESTIGATION_PROMPT
106
 
107
 
108
+ def get_followup_prompt() -> SimplePromptTemplate:
109
  """Get the follow-up conversation prompt template"""
110
  return FOLLOWUP_PROMPT
111
 
112
 
113
+ def get_tool_recommendation_prompt() -> SimplePromptTemplate:
114
  """Get the tool recommendation prompt template"""
115
  return TOOL_RECOMMENDATION_PROMPT