Spaces:
Running
Running
Update model's response with a structured pattern targeting user learning process of coding.
Browse files
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 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
## Response Structure
|
|
|
|
|
|
|
|
|
|
| 81 |
```[language]
|
| 82 |
-
#
|
| 83 |
```
|
| 84 |
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
|
| 89 |
-
|
| 90 |
|
| 91 |
# Example prompts for UI
|
| 92 |
EXAMPLE_PROMPTS = [
|
|
@@ -102,40 +119,40 @@ EXAMPLE_PROMPTS = [
|
|
| 102 |
|
| 103 |
# File download templates
|
| 104 |
NOTEBOOK_TEMPLATE = '''{{
|
| 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 |
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
|