File size: 7,140 Bytes
423736f
 
42dcd62
 
 
ac4281b
 
 
 
 
42dcd62
ac4281b
 
42dcd62
802b427
e87b10f
802b427
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e254022
802b427
 
e254022
 
 
802b427
 
 
e254022
 
 
 
 
 
 
802b427
 
e254022
 
 
802b427
 
e254022
 
 
802b427
 
e254022
 
 
802b427
 
 
 
e254022
 
802b427
 
e254022
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
802b427
 
e254022
 
 
 
 
 
 
 
 
 
 
 
 
 
 
802b427
 
e254022
 
 
802b427
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6a342f0
 
 
 
 
 
 
 
 
 
802b427
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6a342f0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
802b427
 
 
 
 
 
e254022
 
 
 
8b9d1e9
 
 
 
 
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
import json

SYSTEM_PROMPT = """You are a sophisticated AI assistant specializing in generating comprehensive exploration paths.
Your task is to analyze the given query and generate a structured exploration response.

Your response should include:
1. A detailed exploration summary with context and complexity level
2. Knowledge axes with both standard and emergent dimensions
3. Navigation strategies for both zooming in and out
4. Meta-level insights about the exploration

Ensure all numerical values are within their specified ranges and all required fields are included.
Format your response as a structured object following the ExplorationResponse schema."""


CONTEXTUAL_ZOOM_PROMPT = """# CONTEXTUAL EXPLORATION PATH GENERATOR

## CORE PURPOSE
Create a dynamic, intelligent system for transforming user queries into structured, multi-dimensional exploration paths by:
- Breaking down complex queries into meaningful axes
- Generating contextually relevant values
- Providing strategic navigation through exploration dimensions

## SYSTEM OBJECTIVE
Transform unstructured user inquiries into a comprehensive, navigable knowledge exploration framework that:
- Deconstructs complex topics into manageable exploration dimensions
- Generates intelligent, contextually-linked axes and values
- Enables flexible navigation through knowledge spaces
- Supports iterative learning and discovery

## INPUT REQUIREMENTS
Input is a JSON object containing:
{
"user_query": "Primary exploration intent or research question",
"selected_path": [
{"axis": "string", "value": "string"}  // Current exploration context
],
"exploration_parameters": {
"depth": 0-10,  // Exploration granularity
"domain": "optional domain-specific context",
"previous_explorations": []  // Historical exploration context
}
}

## CURRENT INPUT:
{
"user_query": "{{user_query}}",
"selected_path": {{selected_path}},
"exploration_parameters": {{exploration_parameters}}
}

### Input Components Explained:
1. `user_query`: The fundamental question or exploration intent
- Can be broad or specific
- Represents the initial knowledge seeking goal
- Provides context for axis and value generation

2. `selected_path`: Current exploration context
- Represents user's existing exploration trajectory
- Each tuple defines an axis-value pair
- Guides contextual relevance of future suggestions

3. `exploration_parameters`:
- `depth`: Controls exploration granularity
- `domain`: Provides additional contextual constraints
- `previous_explorations`: Tracks exploration history

## OUTPUT BLUEPRINT
{
"exploration_summary": {
"current_context": "Narrative summary of exploration state",
"complexity_level": 0-10
},
"knowledge_axes": {
"standard_axes": [
  {
    "name": "string",
    "current_values": [""],
    "potential_values": [
      {
        "value": "string",
        "relevance_score": 0-100,
        "contextual_rationale": "Why this value matters"
      }
    ],
    "axis_constraints": ["Logical limitations"]
  }
],
"emergent_axes": [
  {
    "name": "string",
    "parent_axis": "string",
    "innovative_values": [
      {
        "value": "string",
        "innovation_score": 0-100,
        "discovery_potential": "Unique exploration opportunity"
      }
    ]
  }
]
},
"navigation_strategies": {
"zoom_trajectories": [
  {
    "target_axis": "string",
    "zoom_value": "string",
    "unlocked_dimensions": [""],
    "depth_increment": 1-3
  }
],
"dezoom_pathways": [
  {
    "removal_tuple": {"axis": "string", "value": "string"},
    "contextual_expansion": "Broader exploration narrative",
    "new_possibility_vectors": [""]
  }
]
},
"meta_insights": {
"exploration_efficiency": 0-100,
"knowledge_gap_indicators": [""],
"recommended_next_steps": [""]
}
}

## PROCESSING GUIDELINES
1. Prioritize high-relevance, low-redundancy axes
2. Maintain semantic coherence across generated dimensions
3. Ensure logical progression in exploration paths
4. Dynamically adjust complexity based on exploration depth

## COGNITIVE MAPPING PRINCIPLES
- Connect axes through semantic and contextual relationships
- Generate values that expand conceptual understanding
- Provide actionable, insight-driven navigation suggestions
- Respect domain-specific knowledge constraints

## ADVANCED CONSTRAINTS
- Avoid circular or repetitive exploration paths
- Maintain logical consistency with initial query
- Provide clear rationale for axis and value selections
- Support iterative, progressive knowledge discovery

## OUTPUT INTERPRETATION GUIDE
- `exploration_summary`: Overall context and complexity
- `knowledge_axes`: 
- `standard_axes`: Traditional exploration dimensions
- `emergent_axes`: Innovative, context-derived dimensions
- `navigation_strategies`: 
- `zoom_trajectories`: Depth-increasing exploration paths
- `dezoom_pathways`: Breadth-expanding exploration options
- `meta_insights`: Performance and discovery potential metrics


## RESPONSE FORMAT
Response must be a valid JSON object matching the ExplorationResponse model with:
- exploration_summary: Contains current_context and complexity_level (0-10)
- knowledge_axes: Contains standard_axes and emergent_axes
- navigation_strategies: Contains zoom_trajectories and dezoom_pathways
- meta_insights: Contains efficiency score, gaps, and next steps
"""

DEFAULT_RESPONSE = {
  "exploration_summary": {
      "current_context": "Initial exploration state",
      "complexity_level": 1
  },
  "knowledge_axes": {
      "standard_axes": [
          {
              "name": "temporal",
              "current_values": ["present"],
              "potential_values": [
                  {
                      "value": "past",
                      "relevance_score": 80,
                      "contextual_rationale": "Historical context"
                  }
              ],
              "axis_constraints": ["chronological order"]
          }
      ],
      "emergent_axes": []
  },
  "navigation_strategies": {
      "zoom_trajectories": [
          {
              "target_axis": "temporal",
              "zoom_value": "present",
              "unlocked_dimensions": ["basic"],
              "depth_increment": 1
          }
      ],
      "dezoom_pathways": [
          {
              "removal_tuple": {"axis": "temporal", "value": "present"},
              "contextual_expansion": "Initial state",
              "new_possibility_vectors": ["begin"]
          }
      ]
  },
  "meta_insights": {
      "exploration_efficiency": 50,
      "knowledge_gap_indicators": ["initial state"],
      "recommended_next_steps": ["begin exploration"]
  }
}

def format_exploration_prompt(user_query: str, selected_path: list, exploration_parameters: dict) -> str:
  """Helper function to format the prompt with proper JSON structure"""
  # Create a template with the values already JSON-serialized
  formatted_prompt = CONTEXTUAL_ZOOM_PROMPT.replace("{{user_query}}", json.dumps(user_query))
  formatted_prompt = formatted_prompt.replace("{{selected_path}}", json.dumps(selected_path))
  formatted_prompt = formatted_prompt.replace("{{exploration_parameters}}", json.dumps(exploration_parameters))
  return formatted_prompt