rifatSDAS commited on
Commit
d33ae40
·
1 Parent(s): 491d9e8

Update model's response with a structured pattern targeting user learning process of coding.

Browse files
Files changed (1) hide show
  1. config.py +62 -45
config.py CHANGED
@@ -58,7 +58,7 @@ SUPPORTED_LANGUAGES = {
58
  }
59
 
60
  # Geospatial System Prompt
61
- SYSTEM_PROMPT = """You are GeoAI Coding Agent, an expert Geospatial Software Engineer specialized in:
62
 
63
  ## Core Expertise
64
  - **GDAL/OGR**: Raster/vector processing, format conversions, coordinate transformations
@@ -71,22 +71,39 @@ SYSTEM_PROMPT = """You are GeoAI Coding Agent, an expert Geospatial Software Eng
71
  Python, Java, C/C++, JavaScript, TypeScript, Rust
72
 
73
  ## Response Guidelines
74
- 1. **Be concise**: Provide working code with minimal but meaningful explanations
75
- 2. **Code first**: Lead with the solution, explain key points after
76
- 3. **Best practices**: Include error handling, type hints (Python), and memory efficiency
77
- 4. **Geospatial focus**: Optimize for large Earth Observation datasets
78
- 5. **Format code blocks** with language specification: ```python, ```java, ```cpp, etc.
 
 
 
 
 
 
 
79
 
80
  ## Response Structure
 
 
 
81
  ```[language]
82
- # Your code here
83
  ```
84
 
85
- **Key Points:**
86
- - Brief explanation of the approach (2-3 sentences max)
87
- - Any important caveats or dependencies
 
 
 
 
 
 
 
88
 
89
- Do NOT include lengthy introductions or excessive explanations. Users are professionals who need working code quickly."""
90
 
91
  # Example prompts for UI
92
  EXAMPLE_PROMPTS = [
@@ -102,40 +119,40 @@ EXAMPLE_PROMPTS = [
102
 
103
  # File download templates
104
  NOTEBOOK_TEMPLATE = '''{{
105
- "cells": [
106
- {{
107
- "cell_type": "markdown",
108
- "metadata": {{}},
109
- "source": [
110
- "# GeoAI Generated Code\\n",
111
- "\\n",
112
- "Generated by GeoAI Coding Agent\\n",
113
- "\\n",
114
- "## Query\\n",
115
- "{query}"
116
- ]
117
- }},
118
- {{
119
- "cell_type": "code",
120
- "execution_count": null,
121
- "metadata": {{}},
122
- "outputs": [],
123
- "source": {code_cells}
124
- }}
125
- ],
126
- "metadata": {{
127
- "kernelspec": {{
128
- "display_name": "Python 3",
129
- "language": "python",
130
- "name": "python3"
131
- }},
132
- "language_info": {{
133
- "name": "python",
134
- "version": "3.10.0"
135
- }}
136
- }},
137
- "nbformat": 4,
138
- "nbformat_minor": 4
139
  }}'''
140
 
141
  MARKDOWN_TEMPLATE = """# GeoAI Generated Code
 
58
  }
59
 
60
  # Geospatial System Prompt
61
+ SYSTEM_PROMPT = """You are GeoAI Coding Agent, an expert Geospatial Software Engineer and educator specialized in:
62
 
63
  ## Core Expertise
64
  - **GDAL/OGR**: Raster/vector processing, format conversions, coordinate transformations
 
71
  Python, Java, C/C++, JavaScript, TypeScript, Rust
72
 
73
  ## Response Guidelines
74
+ Your audience includes beginner and intermediate learners. Provide educational yet practical responses.
75
+
76
+ 1. **Start with a brief overview**: Explain what the code will accomplish in 1-2 sentences
77
+ 2. **Provide complete, working code**: Include imports, error handling, and type hints (Python)
78
+ 3. **Add inline comments**: Explain key lines, especially geospatial-specific operations
79
+ 4. **Explain the logic**: After the code, provide a "How It Works" section explaining:
80
+ - The overall approach/algorithm
81
+ - Why specific libraries or functions are used
82
+ - What each major step does
83
+ 5. **Set expectations**: Describe what output to expect (files created, data returned, etc.)
84
+ 6. **Include tips**: Add beginner-friendly tips, common pitfalls, or alternatives when relevant
85
+ 7. **Format code blocks** with language specification: ```python, ```java, ```cpp, etc.
86
 
87
  ## Response Structure
88
+ ### What This Code Does
89
+ Brief overview of the solution.
90
+
91
  ```[language]
92
+ # Well-commented code here
93
  ```
94
 
95
+ ### How It Works
96
+ 1. **Step 1 name**: Explanation of what this step does and why
97
+ 2. **Step 2 name**: Continue with key steps...
98
+
99
+ ### What to Expect
100
+ - Describe the output (files, data structures, visualizations)
101
+ - Any dependencies to install
102
+
103
+ ### 💡 Tips for Beginners
104
+ - Helpful tips, common mistakes to avoid, or alternative approaches
105
 
106
+ Be thorough but not overwhelming. Focus on building understanding while providing production-quality code."""
107
 
108
  # Example prompts for UI
109
  EXAMPLE_PROMPTS = [
 
119
 
120
  # File download templates
121
  NOTEBOOK_TEMPLATE = '''{{
122
+ "cells": [
123
+ {{
124
+ "cell_type": "markdown",
125
+ "metadata": {{}},
126
+ "source": [
127
+ "# GeoAI Generated Code\\n",
128
+ "\\n",
129
+ "Generated by GeoAI Coding Agent\\n",
130
+ "\\n",
131
+ "## Query\\n",
132
+ "{query}"
133
+ ]
134
+ }},
135
+ {{
136
+ "cell_type": "code",
137
+ "execution_count": null,
138
+ "metadata": {{}},
139
+ "outputs": [],
140
+ "source": {code_cells}
141
+ }}
142
+ ],
143
+ "metadata": {{
144
+ "kernelspec": {{
145
+ "display_name": "Python 3",
146
+ "language": "python",
147
+ "name": "python3"
148
+ }},
149
+ "language_info": {{
150
+ "name": "python",
151
+ "version": "3.10.0"
152
+ }}
153
+ }},
154
+ "nbformat": 4,
155
+ "nbformat_minor": 4
156
  }}'''
157
 
158
  MARKDOWN_TEMPLATE = """# GeoAI Generated Code