DeepImagix commited on
Commit
08539fe
Β·
verified Β·
1 Parent(s): 66e86d1

Upload 2 files

Browse files
Files changed (2) hide show
  1. models/neurones_r1.py +108 -160
  2. models/neurones_vision.py +98 -229
models/neurones_r1.py CHANGED
@@ -1,10 +1,10 @@
1
  """
2
- Neurones R1 1.1 β€” Advanced Reasoning Model (v2)
3
- ================================================
4
- Uses dataset examples for better chain-of-thought reasoning.
5
 
6
- This version loads the reasoning dataset and injects relevant
7
- few-shot examples to improve answer quality.
8
  """
9
 
10
  import json
@@ -12,7 +12,6 @@ import random
12
  import pathlib
13
  import logging
14
  from typing import List, Dict, Optional
15
- from dataclasses import dataclass, field
16
 
17
  logger = logging.getLogger("neurones_r1")
18
 
@@ -20,173 +19,122 @@ logger = logging.getLogger("neurones_r1")
20
  # DATASET LOADER (for few-shot examples)
21
  # ════════════════════════════════════════════════════════════════
22
 
23
- class ReasoningDataset:
24
- """Loads and manages the reasoning dataset for few-shot prompting."""
25
-
26
- def __init__(self, dataset_path: Optional[str] = None):
27
- self.dataset_path = dataset_path or "datasets/datdistilled_corpus_400k_with_cot-filtered.jsonl.txt"
28
- self.data: List[Dict] = []
29
- self.loaded = False
30
 
31
- def load(self, max_samples: int = 5000) -> bool:
32
- """Load reasoning dataset."""
33
- try:
34
- path = pathlib.Path(self.dataset_path)
35
- if not path.exists():
36
- logger.warning(f"Dataset not found: {self.dataset_path}")
37
- return False
38
-
39
- with open(path, "r", encoding="utf-8") as f:
40
- for i, line in enumerate(f):
41
- if len(self.data) >= max_samples:
42
- break
43
- line = line.strip()
44
- if not line:
45
- continue
46
- try:
47
- entry = json.loads(line)
48
- if entry.get("thinking") and entry.get("solution"):
49
- self.data.append({
50
- "problem": entry.get("problem", ""),
51
- "thinking": entry.get("thinking", ""),
52
- "solution": entry.get("solution", ""),
53
- "category": entry.get("category", "general"),
54
- })
55
- except:
56
- continue
57
-
58
- self.loaded = True
59
- logger.info(f"βœ… Loaded {len(self.data)} reasoning examples for R1")
60
- return True
61
-
62
- except Exception as e:
63
- logger.error(f"Failed to load dataset: {e}")
64
  return False
65
-
66
- def get_few_shot_examples(self, category: str = None, n: int = 2) -> str:
67
- """Get random few-shot examples, optionally filtered by category."""
68
- if not self.loaded or not self.data:
69
- return ""
70
-
71
- pool = self.data
72
- if category:
73
- filtered = [d for d in self.data if d.get("category") == category]
74
- if filtered:
75
- pool = filtered
76
-
77
- samples = random.sample(pool, min(n, len(pool)))
78
 
79
- blocks = []
80
- for s in samples:
81
- blocks.append(
82
- f"### Example\n"
83
- f"**Problem:** {s['problem'][:200]}\n\n"
84
- f"<think>\n{s['thinking'][:400]}\n</think>\n\n"
85
- f"**Answer:** {s['solution'][:300]}"
86
- )
 
 
 
 
 
 
 
 
 
 
87
 
88
- return "\n\n---\n\n".join(blocks)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
89
 
 
 
90
 
91
  # ════════════════════════════════════════════════════════════════
92
- # MODEL CONFIG
93
  # ════════════════════════════════════════════════════════════════
94
 
95
- @dataclass
96
- class Model:
97
- id: str = "neurones-r1-1.1"
98
- display_name: str = "Neurones R1 1.1"
99
- version: str = "1.1"
100
- tagline: str = "NeuraPrompt's deepest thinker with dataset-powered reasoning."
101
- created_by: str = "Andile Mtolo (Toxic Dee Modder)"
102
 
103
- groq_model: str = "openai/gpt-oss-120b"
104
- max_tokens: int = 1500
105
- temperature: float = 0.3
106
- context_window: int = 32768
107
 
108
- can_stream: bool = True
109
- can_reason: bool = True
110
- can_vision: bool = False
111
 
112
- speed: str = "slow"
113
- speed_label: str = "🧠 Deep Think"
114
- badge_color: str = "#7c4dff"
115
- icon: str = "🧠"
 
 
 
 
 
116
 
117
- recommended_for: List[str] = field(default_factory=lambda: [
118
- "complex reasoning", "mathematics", "step-by-step logic",
119
- "code debugging", "research analysis", "competitive programming"
120
- ])
121
 
122
- not_recommended_for: List[str] = field(default_factory=lambda: [
123
- "quick chat", "simple lookups", "image tasks"
124
- ])
125
-
126
-
127
- # ════════════════════════════════════════════════════════════════
128
- # SYSTEM PROMPT
129
- # ════════════════════════════════════════════════════════════════
130
-
131
- BASE_SYSTEM_PROMPT = """You are **Neurones R1 1.1**, NeuraPrompt's most advanced reasoning model.
132
-
133
- Created by: Andile Mtolo (Toxic Dee Modder)
134
- Company: Alysium Corporation Studios ZA
135
-
136
- ## Your Role
137
- You are a **deep thinking specialist**. You excel at complex reasoning, mathematics, logic, code analysis, and step-by-step problem solving.
138
-
139
- ## How to Think
140
- For reasoning tasks, always use this format:
141
-
142
- <think>
143
- 1. Understand the problem type and given information
144
- 2. Plan your step-by-step approach
145
- 3. Work through the solution carefully
146
- 4. Verify your answer
147
- </think>
148
-
149
- Then give your final answer.
150
-
151
- ## Rules
152
- - Show all reasoning steps clearly
153
- - Never guess numbers or make up facts
154
- - For code: plan first, then implement
155
- - Prioritize accuracy
156
- - Keep responses focused (300-500 words max)
157
- """
158
-
159
-
160
- # ════════════════════════════════════════════════════════════════
161
- # MODEL INSTANCE
162
- # ════════════════════════════════════════════════════════════════
163
-
164
- # Load dataset for few-shot examples
165
- reasoning_dataset = ReasoningDataset()
166
- reasoning_dataset.load(max_samples=3000)
167
-
168
- MODEL = Model()
169
-
170
-
171
- def get_system_prompt(user_question: str = "") -> str:
172
- """
173
- Build dynamic system prompt with relevant few-shot examples.
174
- """
175
- prompt = BASE_SYSTEM_PROMPT
176
 
177
- # Add few-shot examples if dataset is loaded
178
- if reasoning_dataset.loaded and reasoning_dataset.data:
179
- examples = reasoning_dataset.get_few_shot_examples(n=2)
180
- if examples:
181
- prompt += f"\n\n## Examples of Good Reasoning\n{examples}"
182
 
183
- prompt += "\n\nNow solve the user's question using the thinking format above."
184
- return prompt
185
-
186
-
187
- # ════════════════════════════════════════════════════════════════
188
- # EXPORTS (for registry)
189
- # ════════════════════════════════════════════════════════════════
190
-
191
- # This allows the registry to load this model automatically
192
- __all__ = ["MODEL", "get_system_prompt", "reasoning_dataset"]
 
1
  """
2
+ Neurones R1 1.1
3
+ ===============
4
+ NeuraPrompt's deepest reasoning model with dataset-powered thinking.
5
 
6
+ Specializes in: complex reasoning, mathematics, code debugging,
7
+ logic problems, step-by-step analysis, competitive programming.
8
  """
9
 
10
  import json
 
12
  import pathlib
13
  import logging
14
  from typing import List, Dict, Optional
 
15
 
16
  logger = logging.getLogger("neurones_r1")
17
 
 
19
  # DATASET LOADER (for few-shot examples)
20
  # ════════════════════════════════════════════════════════════════
21
 
22
+ _reasoning_data: List[Dict] = []
23
+ _dataset_loaded = False
24
+
25
+ def _load_reasoning_dataset(max_samples: int = 3000) -> bool:
26
+ """Load reasoning dataset for few-shot examples."""
27
+ global _reasoning_data, _dataset_loaded
 
28
 
29
+ try:
30
+ path = pathlib.Path("distilled_corpus_400k_with_cot-filtered.jsonl.txt")
31
+ if not path.exists():
32
+ logger.warning("Reasoning dataset not found")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  return False
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
+ with open(path, "r", encoding="utf-8") as f:
36
+ for line in f:
37
+ if len(_reasoning_data) >= max_samples:
38
+ break
39
+ line = line.strip()
40
+ if not line:
41
+ continue
42
+ try:
43
+ entry = json.loads(line)
44
+ if entry.get("thinking") and entry.get("solution"):
45
+ _reasoning_data.append({
46
+ "problem": entry.get("problem", ""),
47
+ "thinking": entry.get("thinking", ""),
48
+ "solution": entry.get("solution", ""),
49
+ "category": entry.get("category", "general"),
50
+ })
51
+ except:
52
+ continue
53
 
54
+ _dataset_loaded = True
55
+ logger.info(f"βœ… Loaded {len(_reasoning_data)} reasoning examples for R1")
56
+ return True
57
+ except Exception as e:
58
+ logger.error(f"Failed to load reasoning dataset: {e}")
59
+ return False
60
+
61
+ def _get_few_shot_examples(n: int = 2) -> str:
62
+ """Get random few-shot reasoning examples."""
63
+ if not _dataset_loaded or not _reasoning_data:
64
+ return ""
65
+
66
+ samples = random.sample(_reasoning_data, min(n, len(_reasoning_data)))
67
+
68
+ blocks = []
69
+ for s in samples:
70
+ blocks.append(
71
+ f"### Example\n"
72
+ f"**Problem:** {s['problem'][:180]}\n\n"
73
+ f"<think>\n{s['thinking'][:350]}\n</think>\n\n"
74
+ f"**Answer:** {s['solution'][:250]}"
75
+ )
76
+
77
+ return "\n\n---\n\n".join(blocks)
78
 
79
+ # Load dataset at import time
80
+ _load_reasoning_dataset()
81
 
82
  # ════════════════════════════════════════════════════════════════
83
+ # MODEL CONFIG (Plain Dictionary - Registry Compatible)
84
  # ════════════════════════════════════════════════════════════════
85
 
86
+ MODEL = {
87
+ "id": "neurones-r1-1.1",
88
+ "display_name": "Neurones R1 1.1",
89
+ "version": "1.1",
90
+ "release_date": "2026-04-01",
91
+ "tagline": "NeuraPrompt's deepest thinker with dataset-powered reasoning.",
92
+ "created_by": "Andile Mtolo (Toxic Dee Modder)",
93
 
94
+ "speed": "slow",
95
+ "speed_label": "🧠 Deep Think",
 
 
96
 
97
+ "groq_model": "openai/gpt-oss-120b",
98
+ "max_tokens": 1500,
99
+ "temperature": 0.3,
100
 
101
+ "can_stream": True,
102
+ "can_reason": True,
103
+ "can_vision": False,
104
+ "can_generate_image": False,
105
+ "can_search": True,
106
+ "can_code": True,
107
+ "can_translate": True,
108
+ "can_summarise": True,
109
+ "is_local": False,
110
 
111
+ "context_window": 32768,
112
+ "rate_limit_rpm": 5,
 
 
113
 
114
+ "system_prompt": (
115
+ "You are Neurones R1 1.1, NeuraPrompt's most advanced reasoning model, "
116
+ "created by Andile Mtolo (Toxic Dee Modder).\n\n"
117
+ "You are a deep thinking specialist. For reasoning tasks (math, code, logic, science), "
118
+ "always use this format:\n\n"
119
+ "<think>\n"
120
+ "1. Understand the problem type and given information\n"
121
+ "2. Plan your step-by-step approach\n"
122
+ "3. Work through the solution carefully\n"
123
+ "4. Verify your answer\n"
124
+ "</think>\n\n"
125
+ "Then give your final answer.\n\n"
126
+ "Rules: Show all steps. Never guess numbers. For code, plan then implement. "
127
+ "Prioritise accuracy. Keep responses focused (300-500 words max)."
128
+ ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
 
130
+ "badge_color": "#7c4dff",
131
+ "icon": "🧠",
 
 
 
132
 
133
+ "recommended_for": [
134
+ "complex reasoning", "mathematics", "step-by-step logic",
135
+ "code debugging", "research analysis", "competitive programming"
136
+ ],
137
+ "not_recommended_for": [
138
+ "quick chat", "simple lookups", "image tasks", "general conversation"
139
+ ],
140
+ }
 
 
models/neurones_vision.py CHANGED
@@ -1,269 +1,138 @@
1
- #!/usr/bin/env python3
2
  """
3
- Neurones Vision 1.0 β€” Professional Model Configuration v9.0
4
- Clean, robust, production-ready (2026 best practices)
 
5
 
6
- Author: Toxic Dee Modder (Andile Mtolo)
7
- Company: Alysium Corporation Studios ZA
8
  """
9
 
10
  import pathlib
11
  import json
12
  import logging
13
- from dataclasses import dataclass, field
14
- from typing import List, Dict, Optional
15
- from datetime import datetime
16
 
17
- # ════════════════════════════════════════════════════════════════
18
- # LOGGING
19
- # ════════════════════════════════════════════════════════════════
20
-
21
- logging.basicConfig(
22
- level=logging.INFO,
23
- format="%(asctime)s | %(levelname)-8s | %(message)s"
24
- )
25
  logger = logging.getLogger("neurones_vision")
26
 
27
  # ════════════════════════════════════════════════════════════════
28
- # DATA STRUCTURES
29
  # ════════════════════════════════════════════════════════════════
30
 
31
- @dataclass
32
- class VisionDatasetPair:
33
- prompt: str
34
- response: str
35
- source_file: str
36
-
37
 
38
- @dataclass
39
- class VisionModelConfig:
40
- """Professional configuration for Neurones Vision 1.0"""
41
-
42
- # Identity
43
- id: str = "neurones-vision-1.0"
44
- display_name: str = "Neurones Vision 1.0"
45
- version: str = "1.2"
46
- release_date: str = "2026-04-29"
47
- tagline: str = "NeuraPrompt's eyes. Sees, reads, and understands images and files."
48
- created_by: str = "Andile Mtolo (Toxic Dee Modder)"
49
-
50
- # Backend
51
- groq_model: str = "meta-llama/llama-4-scout-17b-16e-instruct"
52
- max_tokens: int = 4096
53
- temperature: float = 0.3
54
- context_window: int = 16384
55
-
56
- # Capabilities (honest declaration)
57
- can_vision: bool = True
58
- can_files: bool = True
59
- can_ocr: bool = True
60
- can_document_analysis: bool = True
61
- can_visual_qa: bool = True
62
- can_generate_image: bool = False # Not implemented in this version
63
 
64
- # UI
65
- badge_color: str = "#ff6d00"
66
- icon: str = "πŸ‘οΈ"
67
-
68
- # Recommended use cases
69
- recommended_for: List[str] = field(default_factory=lambda: [
70
- "image analysis", "OCR / text extraction", "PDF & document reading",
71
- "screenshot analysis", "photo description", "visual Q&A",
72
- "chart/diagram understanding", "file content extraction"
73
- ])
74
-
75
- not_recommended_for: List[str] = field(default_factory=lambda: [
76
- "general chat", "mathematics", "coding", "real-time search", "creative writing"
77
- ])
78
-
79
-
80
- # ════════════════════════════════════════════════════════════════
81
- # DATASET SCANNER (Improved)
82
- # ════════════════════════════════════════════════════════════════
83
-
84
- class VisionDatasetLoader:
85
- """Smart loader for vision/image-related datasets"""
86
 
87
- _IMAGE_KEYWORDS = {
88
- "image", "vision", "visual", "photo", "picture", "img",
89
- "caption", "scene", "object", "detection", "classify",
90
- "ocr", "document", "diagram", "chart", "screenshot", "pdf"
91
- }
92
 
93
- def __init__(self, datasets_dir: Optional[pathlib.Path] = None):
94
- self.datasets_dir = datasets_dir or (pathlib.Path(__file__).parent / "datasets")
95
- self.pairs: List[VisionDatasetPair] = []
96
-
97
- def _is_vision_dataset(self, filepath: pathlib.Path) -> bool:
98
- """Check if file is vision-related by name and content sample."""
99
- name = filepath.stem.lower()
100
 
101
- # Check filename
102
- if any(kw in name for kw in self._IMAGE_KEYWORDS):
103
- return True
104
 
105
- # Sample first few lines for content keywords
106
  try:
107
- with open(filepath, "r", encoding="utf-8", errors="replace") as f:
108
- sample = f.read(2000).lower()
109
- if any(kw in sample for kw in ["image", "caption", "visual", "photo", "screenshot"]):
110
- return True
111
- except Exception:
112
- pass
113
-
114
- return False
115
-
116
- def load(self, max_per_file: int = 1500) -> List[VisionDatasetPair]:
117
- """Load all vision-related datasets."""
118
- if not self.datasets_dir.exists():
119
- logger.warning(f"Datasets directory not found: {self.datasets_dir}")
120
- return []
121
-
122
- self.pairs = []
123
-
124
- for filepath in sorted(self.datasets_dir.iterdir()):
125
- if not filepath.is_file():
126
- continue
127
-
128
- suffix = "".join(filepath.suffixes).lower()
129
- if suffix not in (".jsonl", ".jsonl.txt", ".json", ".txt"):
130
- continue
131
-
132
- if not self._is_vision_dataset(filepath):
133
- logger.debug(f"Skipping non-vision dataset: {filepath.name}")
134
- continue
135
-
136
- count = self._load_file(filepath, max_per_file)
137
- if count:
138
- logger.info(f"Loaded {count} vision pairs from {filepath.name}")
139
-
140
- logger.info(f"Total vision pairs loaded: {len(self.pairs)}")
141
- return self.pairs
142
-
143
- def _load_file(self, filepath: pathlib.Path, max_samples: int) -> int:
144
- """Load pairs from a single file."""
145
- count = 0
146
- try:
147
- with open(filepath, "r", encoding="utf-8", errors="replace") as f:
148
  for line in f:
149
- if count >= max_samples:
150
  break
151
-
152
  line = line.strip()
153
  if not line:
154
  continue
155
-
156
  try:
157
  entry = json.loads(line)
158
- except json.JSONDecodeError:
159
  continue
160
 
161
- prompt = (
162
- entry.get("question") or
163
- entry.get("prompt") or
164
- entry.get("instruction") or
165
- entry.get("input") or ""
166
- )
167
- response = (
168
- entry.get("answer") or
169
- entry.get("response") or
170
- entry.get("output") or
171
- entry.get("caption") or ""
172
- )
173
 
174
  if prompt and response and len(response) > 15:
175
- self.pairs.append(VisionDatasetPair(
176
- prompt=str(prompt)[:200],
177
- response=str(response)[:600],
178
- source_file=filepath.name
179
- ))
180
  count += 1
181
-
182
  except Exception as e:
183
- logger.warning(f"Failed to read {filepath.name}: {e}")
184
-
185
- return count
186
-
187
-
188
- # ════════════════════════════════════════════════════════════════
189
- # SYSTEM PROMPT (Improved & Professional)
190
- # ════════════════════════════════════════════════════════════════
191
-
192
- VISION_SYSTEM_PROMPT = """You are **Neurones Vision 1.0**, NeuraPrompt's specialized visual analysis model.
193
-
194
- Created by: Andile Mtolo (Toxic Dee Modder)
195
- Company: Alysium Corporation Studios ZA
196
-
197
- ## Your Role
198
- You are an expert at analyzing **images and files only**. You do NOT handle general chat, math, or coding.
199
-
200
- ## Capabilities
201
- - **Images**: Describe scenes, objects, people, colors, context. Perform OCR on all visible text. Answer visual questions with precision.
202
- - **Documents/PDFs**: Extract and summarize key content. Identify structure (headings, tables, lists). Answer questions about the document.
203
- - **Code in Images/Files**: Analyze code screenshots or files. Explain what the code does and identify potential bugs or issues.
204
-
205
- ## Critical Rules
206
- 1. If the user sends **plain text with no image or file attached**, respond exactly:
207
- "I am Neurones Vision 1.0 β€” I specialize in images and files. Please upload an image or file to analyze. For general chat, switch to Neurones R1, Pro, or Flash using the model selector."
208
-
209
- 2. If a user asks a general question without an image/file, do not describe any previous image. Just redirect them.
210
-
211
- 3. If the user removes the image/file mid-conversation, say: "The image/file has been removed. Please upload a new one if you'd like me to analyze something."
212
-
213
- 4. Never guess or hallucinate details you cannot clearly see.
214
-
215
- 5. Keep responses clear, structured, and under 400 words unless the user asks for more detail.
216
-
217
- 6. If analyzing code (from image or file), explain:
218
- - What the code does
219
- - Any obvious bugs or issues
220
- - Suggestions for improvement (if relevant)
221
- """
222
 
 
 
223
 
224
  # ════════════════════════════════════════════════════════════════
225
- # MAIN CONFIG
226
  # ════════════════════════════════════════════════════════════════
227
 
228
- MODEL = VisionModelConfig()
229
-
230
- # Pre-load vision examples (optional)
231
- vision_dataset_loader = VisionDatasetLoader()
232
- VISION_FEW_SHOT_EXAMPLES = vision_dataset_loader.load(max_per_file=800)
233
-
234
-
235
- def get_vision_system_prompt() -> str:
236
- """Return the full system prompt with optional few-shot examples."""
237
- prompt = VISION_SYSTEM_PROMPT
238
 
239
- if VISION_FEW_SHOT_EXAMPLES:
240
- examples_text = "\n\n## Example Analyses\n"
241
- for i, pair in enumerate(VISION_FEW_SHOT_EXAMPLES[:3], 1):
242
- examples_text += f"\n**Example {i}:**\nQ: {pair.prompt}\nA: {pair.response}\n"
243
- prompt += examples_text
244
 
245
- return prompt
246
-
247
-
248
- # ════════════════════════════════════════════════════════════════
249
- # QUICK INFO
250
- # ════════════════════════════════════════════════════════════════
251
-
252
- def print_model_info():
253
- """Print model information."""
254
- print(f"""
255
- ╔══════════════════════════════════════════════════════════════╗
256
- β•‘ {MODEL.display_name} v{MODEL.version}
257
- β•‘ {MODEL.tagline}
258
- ╠══════════════════════════════════════════════════════════════╣
259
- β•‘ Created by: {MODEL.created_by}
260
- β•‘ Backend: {MODEL.groq_model}
261
- β•‘ Vision: {'βœ… Enabled' if MODEL.can_vision else '❌ Disabled'}
262
- β•‘ Files: {'βœ… Enabled' if MODEL.can_files else '❌ Disabled'}
263
- β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•
264
- """)
265
-
266
-
267
- if __name__ == "__main__":
268
- print_model_info()
269
- print(f"Loaded {len(VISION_FEW_SHOT_EXAMPLES)} vision examples from datasets.")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  """
2
+ Neurones Vision 1.0
3
+ ===================
4
+ NeuraPrompt's multimodal model for images and files.
5
 
6
+ Handles: images, documents (PDF/text/code), OCR, file analysis, visual Q&A.
 
7
  """
8
 
9
  import pathlib
10
  import json
11
  import logging
12
+ from typing import List, Dict
 
 
13
 
 
 
 
 
 
 
 
 
14
  logger = logging.getLogger("neurones_vision")
15
 
16
  # ════════════════════════════════════════════════════════════════
17
+ # DATASET SCANNER
18
  # ════════════════════════════════════════════════════════════════
19
 
20
+ _vision_pairs: List[Dict] = []
 
 
 
 
 
21
 
22
+ def _load_vision_datasets(max_per_file: int = 1000) -> int:
23
+ """Load vision-related datasets."""
24
+ global _vision_pairs
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
+ datasets_dir = pathlib.Path(__file__).parent / "datasets"
27
+ if not datasets_dir.exists():
28
+ return 0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
+ _IMAGE_KEYWORDS = {"image", "vision", "visual", "photo", "picture", "img",
31
+ "caption", "scene", "object", "ocr", "document", "diagram", "chart"}
 
 
 
32
 
33
+ count = 0
34
+ for fp in sorted(datasets_dir.iterdir()):
35
+ if not fp.is_file():
36
+ continue
37
+ suffix = "".join(fp.suffixes).lower()
38
+ if suffix not in (".jsonl", ".jsonl.txt", ".json", ".txt"):
39
+ continue
40
 
41
+ name = fp.stem.lower()
42
+ if not any(kw in name for kw in _IMAGE_KEYWORDS):
43
+ continue
44
 
 
45
  try:
46
+ with open(fp, "r", encoding="utf-8", errors="replace") as f:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  for line in f:
48
+ if count >= max_per_file:
49
  break
 
50
  line = line.strip()
51
  if not line:
52
  continue
 
53
  try:
54
  entry = json.loads(line)
55
+ except:
56
  continue
57
 
58
+ prompt = (entry.get("question") or entry.get("prompt") or
59
+ entry.get("instruction") or entry.get("input") or "")
60
+ response = (entry.get("answer") or entry.get("response") or
61
+ entry.get("output") or entry.get("caption") or "")
 
 
 
 
 
 
 
 
62
 
63
  if prompt and response and len(response) > 15:
64
+ _vision_pairs.append({
65
+ "prompt": str(prompt)[:180],
66
+ "response": str(response)[:500]
67
+ })
 
68
  count += 1
 
69
  except Exception as e:
70
+ logger.warning(f"Failed to read {fp.name}: {e}")
71
+
72
+ logger.info(f"βœ… Loaded {len(_vision_pairs)} vision examples")
73
+ return len(_vision_pairs)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
 
75
+ # Load at import
76
+ _load_vision_datasets()
77
 
78
  # ════════════════════════════════════════════════════════════════
79
+ # MODEL CONFIG (Plain Dictionary - Registry Compatible)
80
  # ════════════════════════════════════════════════════════════════
81
 
82
+ MODEL = {
83
+ "id": "neurones-vision-1.0",
84
+ "display_name": "Neurones Vision 1.0",
85
+ "version": "1.2",
86
+ "release_date": "2026-04-29",
87
+ "tagline": "NeuraPrompt's eyes. Sees, reads, and understands images and files.",
88
+ "created_by": "Andile Mtolo (Toxic Dee Modder)",
 
 
 
89
 
90
+ "speed": "balanced",
91
+ "speed_label": "πŸ‘οΈ Vision",
 
 
 
92
 
93
+ "groq_model": "meta-llama/llama-4-scout-17b-16e-instruct",
94
+ "groq_vision_model": "meta-llama/llama-4-scout-17b-16e-instruct",
95
+ "max_tokens": 4096,
96
+ "temperature": 0.3,
97
+
98
+ "can_stream": False,
99
+ "can_reason": True,
100
+ "can_vision": True,
101
+ "can_files": True,
102
+ "can_generate_image": False,
103
+ "can_search": False,
104
+ "can_code": False,
105
+ "can_translate": True,
106
+ "can_summarise": True,
107
+ "is_local": False,
108
+ "vision_only": True,
109
+
110
+ "context_window": 16384,
111
+ "rate_limit_rpm": 20,
112
+
113
+ "system_prompt": (
114
+ "You are Neurones Vision 1.0, NeuraPrompt's specialized visual analysis model, "
115
+ "created by Andile Mtolo (Toxic Dee Modder). "
116
+ "Your specialty is images and files ONLY.\n\n"
117
+ "For IMAGES: describe thoroughly, extract all visible text (OCR), "
118
+ "identify objects, people, colours, scene type, and context.\n\n"
119
+ "For FILES/DOCUMENTS: extract text content, summarise key points, "
120
+ "identify structure (headings, tables, code).\n\n"
121
+ "If a user sends plain text with NO image or file, respond: "
122
+ "'I am Neurones Vision 1.0 β€” I specialise in images and files. "
123
+ "Please upload an image or file. For general chat, switch to Neurones Pro or Flash.'\n\n"
124
+ "Never guess when you cannot see something clearly."
125
+ ),
126
+
127
+ "badge_color": "#ff6d00",
128
+ "icon": "πŸ‘οΈ",
129
+
130
+ "recommended_for": [
131
+ "image analysis", "OCR / text extraction", "file reading",
132
+ "document scanning", "photo description", "visual Q&A",
133
+ "PDF summary", "screenshot analysis",
134
+ ],
135
+ "not_recommended_for": [
136
+ "general chat", "math", "coding", "real-time search",
137
+ ],
138
+ }